C100DBA认证讲解 MongoDB 讲解-quick initiating new replica set member?

C100DBA认证讲解 MongoDB 讲解-quick initiating new replica set member?

Screen Shot 2015-05-25 at 11.15.20 PM

 

dbDao 百度贴吧:http://tieba.baidu.com/dbdao

MongoDB技术学习QQ群: 421431253

 

题目正文

which of the following is the recommended method for quickly initiating a new replica set member?

  1. Empty the dbpath directory for the new member to force an initial sync
  2. Mongodump a existing replica set member’s data and then mongorestore it to the new member
  3. Use the seed command
  4. Step up the new member to be the replica set primary
  5. Use a recent file system snapshot of an existing member with journaling turned on ,assuming the data files in the snapshot are more recent than the oldest operation in the primary’s oplog .

 

翻译:

以下哪个选项是被推荐的初始化一个新的replica set 复制集成员的?

  1. 为新成员清空dbpath路径下的文件,强制一个初始化同步
  2. mongodump一个replica set Member复制集成员的数据,并mongorestore到新成员
  3. 使用seed 命令
  4. 将新成员配置成replica set中的primary
  5. 使用一个现有成员的文件系统快照且需要启用了journaling ,假设快照中的数据文件要比primary的oplog中的最老的操作更新

 

官方文档对应的解释:

  • Initial sync occurs when MongoDB creates new databases on a new or restored member, populating the member with the replica set’s data. When a new or restored member joins or rejoins a set, the member waits to receive heartbeats from other members. By default, the member syncs from theclosest member of the set that is either the primary or another secondary with more recent oplog entries. This prevents two secondaries from syncing from each other.
  • Replication occurs continually after initial sync and keeps the member updated with changes to the replica set’s data.

http://docs.mongodb.org/v2.2/core/replication-internals/

 

Initial Sync

Initial sync copies all the data from one member of the replica set to another member. A member uses initial sync when the member has no data, such as when the member is new, or when the member has data but is missing a history of the set’s replication.

When you perform an initial sync, MongoDB:

  1. Clones all databases. To clone, the mongod queries every collection in each source database and inserts all data into its own copies of these collections. At this time, _id indexes are also built. The clone process only copies valid data, omitting invalid documents.

  2. Applies all changes to the data set. Using the oplog from the source, the mongod updates its data set to reflect the current state of the replica set.

  3. Builds all indexes on all collections (except _id indexes, which were already completed).

    When the mongod finishes building all index builds, the member can transition to a normal state, i.e.secondary.

http://docs.mongodb.org/manual/core/replica-set-sync/

此条目发表在 未分类 分类目录。将固定链接加入收藏夹。

评论功能已关闭。