C100DBA MongoDB DBA认证考题讲解 备份运行中的分片集群
dbDao 百度贴吧:http://tieba.baidu.com/dbdao
MongoDB技术学习QQ群: 421431253
which of the following must you do before backing up a running sharded cluster using a file system snapshot?
- Disable Journaling
- Force an election
- Stop all the config server
- backup secondaries
- Disable the balancer
下列哪个选项是当你使用文件系统快照备份一个在运行中的分片集群时必要做的?
- 禁用 Journaling 日志
- 强制一次election
- 关闭所有的config server
- 备份secondaries
- 禁用balancer
可参考文档 https://docs.mongodb.org/manual/tutorial/backup-sharded-cluster-with-filesystem-snapshots/
最佳答案为 E 禁用balancer
其过程分为:
Disable the balancer.
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.
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.
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
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.
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.
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)