[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 }