centos7全离线安装MongoDB3.2.8集群
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7全离线安装MongoDB3.2.8集群相关的知识,希望对你有一定的参考价值。
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" : 1, "host" : "10.2.40.104:27017"},{"_id" : 2, "host":"10.2.40.104:27016"},]}
rs.initiate(config);
//重新配置参数命令
rs.reconfig(config, {force: true})
MongoDB离线安装包下载地址如下:
https://pan.baidu.com/s/1Zu7DogO-S7ReeJvVcUAAFw,密码:9lfy
以上是关于centos7全离线安装MongoDB3.2.8集群的主要内容,如果未能解决你的问题,请参考以下文章