[root@vm3 ~]# mongo MongoDB shell version: 2.2.2 connecting to: test rs1:PRIMARY> rs.initiate({_id:'rs1',members:[{_id:0,host:'localhost:27017',priority:1},{_id:1,host:'localhost:27018'},{_id:2,host:'localhost:27019'}]})
當我們想添加其他機器的mongodb實例進入集群時,問題來了,出現下面錯誤:
[root@vm3 ~]# mongo MongoDB shell version: 2.2.2 connecting to: test rs1:PRIMARY> rs.add('192.168.18.241:27020') { "errmsg" : "exception: can't use localhost in repl set member names except when using it for all members", "code" : 13393, "ok" : 0 }