主机192.168.99.80
[root@master ~]# grep -v "^#" /etc/mongod.conf | grep -v "^$"bind_ip = 192.168.99.80fork = truepidfilepath = /var/run/mongodb/mongod.pidlogpath = /var/log/mongodb/mongod.logunixSocketPrefix = /var/run/mongodbdbpath = /mongodb/datahttpinterface = truerest = truereplSet = testSetreplIndexPrefetch = _id_only
主机192.168.99.81
[root@master ~]# grep -v "^#" /etc/mongod.conf | grep -v "^$"bind_ip = 192.168.99.81fork = truepidfilepath = /var/run/mongodb/mongod.pidlogpath = /var/log/mongodb/mongod.logunixSocketPrefix = /var/run/mongodbdbpath = /mongodb/datahttpinterface = truerest = truereplSet = testSetreplIndexPrefetch = _id_only
主机192.168.99.70
[root@master ~]# grep -v "^#" /etc/mongod.conf | grep -v "^$"bind_ip = 192.168.99.70fork = truepidfilepath = /var/run/mongodb/mongod.pidlogpath = /var/log/mongodb/mongod.logunixSocketPrefix = /var/run/mongodbdbpath = /mongodb/datahttpinterface = truerest = truereplSet = testSetreplIndexPrefetch = _id_only
启动三台主机
mongo --host 192.168.99.81
在192.168.99.80添加