>>>>>>> cn
翻译或纠错本页面

保持域名不变迁移配置服务器

重要

This procedure applies to migrating config servers when using three mirrored mongod instances as config servers.

Starting in MongoDB 3.2, config servers can be deployed as replica set. MongoDB 3.2 deprecates the use of three mirrored mongod instances for config servers.

For replacing config servers deployed as members of a replica set, see Replace a Config Server.

For a sharded cluster that uses 3 mirrored config servers, use the following procedure migrates a config server to a new system that uses the same hostname.

To migrate all three mirrored config servers, perform this procedure for each config server separately and migrate the config servers in reverse order from how they are listed in the mongos instances’ configDB string. Start with the last config server listed in the configDB string.

  1. 关闭配置服务器

    这使得所有配置服务器变为只读.

  2. 更改DNS条目使得之前指向旧的配置服务器的域名在 不改变 的前提下指向新的配置服务器,具体如何做取决于你怎样组织你的DNS与域名解析服务.

  3. 从旧的配置服务器上将 dbPath 拷贝到新的配置服务器上.

    比如,为了将 dbPath 拷贝到名为 mongodb.config2.example.net 的机器上,你需要使用像这样的命令:

    rsync -az /data/configdb/ mongodb.config2.example.net:/data/configdb
    
  4. 启动新系统的配置服务器,默认的指令为:

    mongod --configsvr
    

When you start the third config server, your cluster will become writable and it will be able to create new splits and migrate chunks as needed.