centos7全离线安装MongoDB3.2.8集群

原文链接: http://blog.51cto.com/zhaoanan/2312261

1.自启动脚本
/usr/local/mongodb/bin/mongod -f /usr/local/mongodb/master.conf
/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/confs/slave1.conf
/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/confs/slave2.conf
2.配置文件参数
master.conf
dbpath=/home/data/mongodbdata/master
logpath=/usr/local/mongodb/logs/master.log
logappend=true
port=27017
fork=true
replSet=tonghao

slave1.conf
dbpath=/home/data/mongodbdata/slave1/
logpath=/usr/local/mongodb/logs/slave1.log
logappend=true
port=27017
fork=true
replSet=tonghao

slave2.conf
dbpath=/home/data/mongodbdata/slave2
logpath=/usr/local/mongodb/logs/slave2.log
logappend=true
port=27016
fork=true
replSet=tonghao

3.集群config配置
./mongo
use admin

config = {"_id" : "tonghao", "members" : [ {"_id" : 0, "host" : "10.2.42.101:27017"},{"_id" :

你可能感兴趣的:(centos7全离线安装MongoDB3.2.8集群)