码迷,mamicode.com
首页 > 数据库 > 详细

centos7全离线安装MongoDB3.2.8集群

时间:2018-11-02 16:36:58      阅读:304      评论:0      收藏:0      [点我收藏+]

标签:member   mongo   for   baidu   配置文件   log   nfs   ofo   安装   

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集群

标签:member   mongo   for   baidu   配置文件   log   nfs   ofo   安装   

原文地址:http://blog.51cto.com/zhaoanan/2312261

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!