32433221 发表于 2016-10-19 10:08:32

mongoDB的副本机制

主机192.168.99.80

1
2
3
4
5
6
7
8
9
10
11
# 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

1
2
3
4
5
6
7
8
9
10
11
# 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

1
2
3
4
5
6
7
8
9
10
11
# 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





启动三台主机

1
mongo --host 192.168.99.81




在192.168.99.80添加

页: [1]
查看完整版本: mongoDB的副本机制