C100DBA MongoDB DBA认证考题讲解 备份运行中的分片集群

C100DBA MongoDB  DBA认证考题讲解 备份运行中的分片集群

 

Screen Shot 2015-04-28 at 10.43.33 PM

 

 

which of the following must you do before backing up a running sharded  cluster using a file system snapshot?

  1. Disable Journaling
  2. Force an election
  3. Stop all the config server
  4. backup secondaries
  5. Disable the balancer

下列哪个选项是当你使用文件系统快照备份一个在运行中的分片集群时必要做的?

  1. 禁用 Journaling 日志
  2. 强制一次election
  3. 关闭所有的config server
  4. 备份secondaries
  5. 禁用balancer

可参考文档 https://docs.mongodb.org/manual/tutorial/backup-sharded-cluster-with-filesystem-snapshots/

 

最佳答案为 E  禁用balancer

其过程分为:

Disable the balancer.

1

Disable the balancer.

Disable the balancer process that equalizes the distribution of data among the shards. To disable the balancer, use the sh.stopBalancer() method in the mongo shell.

Consider the following example:

use config
sh.stopBalancer()

For more information, see the Disable the Balancer procedure.

2

If necessary, lock one secondary member of each replica set in each shard.

If your mongod does not have journaling enabled or your journal and data files are on different volumes, you must lock your mongod before capturing a back up.

If your mongod has journaling enabled and your journal and data files are on the same volume, you may skip this step.

If you need to lock the mongod, attempt to lock one secondary member of each replica set in each shard so that your backups reflect the state of your database at the nearest possible approximation of a single moment in time.

To lock a secondary, connect through the mongo shell to the secondary member’s mongod instance and issue the db.fsyncLock() method.

3

Back up one of the config servers.

Backing up a config server backs up the sharded cluster’s metadata. You need back up only one config server, as they all hold the same data. Do one of the following to back up one of the config servers:

Create a file-system snapshot of the config server.

Do this only if the config server has journaling enabled. Use the procedure in Backup and Restore with Filesystem Snapshots. Never use db.fsyncLock() on config databases.

Create a database dump to backup the config server.

Issue mongodump against one of the config mongod instances. If you are running MongoDB 2.4 or later with the –configsvr option, then include the –oplog option to ensure that the dump includes a partial oplog containing operations from the duration of the mongodump operation. For example:

mongodump --oplog
4

Back up the replica set members of the shards that you locked.

You may back up the shards in parallel. For each shard, create a snapshot. Use the procedure inBackup and Restore with Filesystem Snapshots.

5

Unlock locked replica set members.

If you locked any mongod instances to capture the backup, unlock them now.

Unlock all locked replica set members of each shard using the db.fsyncUnlock() method in themongo shell.

6

Enable the balancer.

Re-enable the balancer with the sh.setBalancerState() method. Use the following command sequence when connected to the mongos with the mongo shell:

use config
sh.setBalancerState(true)

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *