mongoDB sharding服务器架构如下图:
config=rs.conf()
config.members[0].host ="10.9.110.116:30001"
rs.reconfig(config,{force:true})
根据实际情况,更改每个节点的IP地址信息,config.members[0]的数字是根据rs.conf()显示的自然排序来的,从0开始,并非id
【shard部分】
修改mongos记录分片的IP地址
>use config;
>db.shards.find()
{ "_id" : "kk-comic-test-shard02", "host" : "kk-comic-test-shard02/10.9.70.22:30004,10.9.70.22:30005" }
{ "_id" : "kk-comic-test-shard03", "host" : "kk-comic-test-shard03/10.9.70.22:30007,10.9.70.22:30008" }
{ "_id" : "kk-comic-test-shard01", "host" : "kk-comic-test-shard01/10.9.110.116:30001,10.9.110.116:30002" }
将上述地址进行如下更改:
>db.shards.update( { "_id" : "kk-comic-test-shard02" }, { $set: { "host": "kk-comic-test-shard02/10.9.110.116:30004,10.9.110.116:30005" } }, { multi: true })
>db.shards.update( { "_id" : "kk-comic-test-shard03" }, { $set: { "host": "kk-comic-test-shard03/10.9.110.116:30007,10.9.110.116:30008" } }, { multi: true })
>db.shards.update( { "_id" : "kk-comic-test-shard01" }, { $set: { "host": "kk-comic-test-shard01/10.9.110.116:30001,10.9.110.116:30002" } }, { multi: true })
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。