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

迁移配置服务器到不同的域名

On this page

重要

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

在 3.2 版更改: 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 three mirrored config servers, all three config servers must be available in order to support operations that result in cluster metadata changes, e.g. chunk splits and migrations. If one of the config servers is unavailable or inoperable, you must replace it as soon as possible.

For a sharded cluster that uses three mirrored config servers, this procedure migrates a config server to a new server that uses a different hostname. Use this procedure only if the config server will not be accessible via the same hostname. If possible, avoid changing the hostname so that you can instead use the procedure to migrate a config server and use the same hostname.

注意事项

With three mirrored config servers, changing a config server’s hostname requires downtime and requires restarting every process in the sharded cluster.

在迁移配置服务器时,要确保所有的 mongos 都配置了三台配置服务器,且这三台配置服务器在 configDB 配置中使用了相同的顺序.

过程

重要

This procedure applies to migrating config servers when using three mirrored mongod instances as config servers. For replacing config servers deployed as members of a replica set, see Replace a Config Server.

  1. 暂时禁用集群的均衡,参见 禁用均衡器 获得更多细节.

  2. Shut down the config server to migrate.

    这使得集群所有的配置服务器变得只读.

  3. Copy the contents of dbPath from the old config server to the new config server. For example, to copy the contents of dbPath to a machine named mongodb.config2.example.net, use a command that resembles the following:

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

    mongod --configsvr
    
  5. 关闭集群中所有的MongoDB实例,包括:

  6. Restart all shard mongod instances.

  7. Restart the mongod instances for the two existing non-migrated config servers.

  8. 更新每个 mongosconfigDB 配置.

  9. 重启所有的 mongos 实例.

  10. Re-enable the balancer to allow the cluster to resume normal balancing operations. See the 禁用均衡器 section for more information on managing the balancer process.