日期:2014-05-16  浏览次数:20516 次

MongoDB线上服务器增加节点

项目数据库为MongoDB,分片DB,每个片为一个复制集,每复制集三台DB,

现在需给其中一个复制集增加一台DB,先把用到的资料贴上来,等有时间了再

整理:


?

Add Members to a Replica Set --Production Notes

?

If you have a backup or snapshot of an existing member, you can move the data files (i.e. /data/db or dbpath) to a new system and use them to quickly initiate a new member. These files must be:

??? 1. clean: the existing dataset must be from a consistent copy of the database from a member of the same replica set. See the Backup and Restoration Strategies document for more information.

??? http://docs.mongodb.org/manual/administration/backups/


??? 2. recent: the copy must more recent than the oldest operation in the primary member’s oplog. The new secondary must be able to become current using operations from the primary’s oplog.

?

?

-------------------------------------------------------

?

Creating a slave from an existing master's disk image

If you can stop write operations to the master for an indefinite period, you can copy the data files from the master to the new slave, and then start the slave with --fastsync .

Be careful with --fastsync. If the data is not perfectly in sync, a discrepancy will exist forever.

--fastsync is a way to start a slave starting with an existing master disk image/backup. This option declares that the adminstrator guarantees the image is correct and completely up to date with that of the master. If you have a full and complete copy of data from a master you can use this option to avoid a full synchronization upon starting the slave.

?

/////////////////////////////

Would like to get documentation for the --fastsync feature. My hope is the ability to make raw file system copies to seed slaves, then tell the slave where to "pick up" reads from the oplog. This would make deploying slaves much faster than performing a initial sync, especially when there is a slow connection between master/slave (i.e. across data centers).

//////////////////////////////

?

?

Yes. --fastsync is a way to speed up the sync when you have a recent
copy of all the data and oplog

On Feb 24, 3:06?pm, tetlika <tetl...@xxxxxxxxx> wrote:
> ah ok
>
> I think i understood: fast resync is used just when we have a copy of
> data - including oplogs - it just tells not to do a full resync
>
> when we dont use fastresync all data will be synced, not depending on
> oplog
>
> On 25 ?DD, 00:55, sridhar <srid...@xxxxxxxxx> wrote:
>
>
>
>
>
>
>
> > fastsync does not replay all the oplog. It only replays the necessary
> > entries post where your database is at. If your oplog is not big
> > enough and has rolled over, fastsync falls back to a full resync.
>
> > On Feb 24, 2:49?pm, tetlika <tetl...@xxxxxxxxx> wrote:
>
> > > Hi!
>
> > > According to
> > > thehttp://www.mongodb.org/display/DOCS/Adding+a+New+Set+Member
> > > fastsync is just "replaying" ALL ?oplog on the new slave, so if we
> > > dont have the oplog ?big enough - we need copy data to the new slave
> > > and run it with the fastsync option?

?

?

Creating a slave from an existing slave's disk image

You can just copy the other slave's