mongoDB sharding服務器架構(gòu)如下圖:
專注于為中小企業(yè)提供成都網(wǎng)站設計、成都網(wǎng)站建設服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)海倫免費做網(wǎng)站提供優(yōu)質(zhì)的服務。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上千余家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設實現(xiàn)規(guī)模擴充和轉(zhuǎn)變。
config=rs.conf()
config.members[0].host ="10.9.110.116:30001"
rs.reconfig(config,{force:true})
根據(jù)實際情況,更改每個節(jié)點的IP地址信息,config.members[0]的數(shù)字是根據(jù)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 })