主机192.168.99.80
[root@master ~]# grep -v "^#" /etc/mongod.conf | grep -v "^$" bind_ip = 192.168.99.80 fork = true pidfilepath = /var/run/mongodb/mongod.pid logpath = /var/log/mongodb/mongod.log unixSocketPrefix = /var/run/mongodb dbpath = /mongodb/data httpinterface = true rest = true replSet = testSet replIndexPrefetch = _id_only
主机192.168.99.81
[root@master ~]# grep -v "^#" /etc/mongod.conf | grep -v "^$" bind_ip = 192.168.99.81 fork = true pidfilepath = /var/run/mongodb/mongod.pid logpath = /var/log/mongodb/mongod.log unixSocketPrefix = /var/run/mongodb dbpath = /mongodb/data httpinterface = true rest = true replSet = testSet replIndexPrefetch = _id_only
主机192.168.99.70
[root@master ~]# grep -v "^#" /etc/mongod.conf | grep -v "^$" bind_ip = 192.168.99.70 fork = true pidfilepath = /var/run/mongodb/mongod.pid logpath = /var/log/mongodb/mongod.log unixSocketPrefix = /var/run/mongodb dbpath = /mongodb/data httpinterface = true rest = true replSet = testSet replIndexPrefetch = _id_only
启动三台主机
mongo --host 192.168.99.81
在192.168.99.80添加
本文出自 “迷荼” 博客,谢绝转载!
原文:http://runingday.blog.51cto.com/2154382/1863151