mongodb复制集配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mongodb复制集配置相关的知识,希望对你有一定的参考价值。

#more /opt/mongodb3.0/mongodb_im_conf_47020/mongodb3.0_im_47020.cnf

dbpath = /opt/mongodb3.0/mongodb_im_data_47020/ # 指定数据库路径
logpath = /opt/mongodb3.0/mongodb_im_log_47020/mongodb.log # 日志路径
logappend = true # 以追加的方式写日志
port = 47020 # 指定端口号,默认47020
fork = true # 以子进程方式运行
quiet = true # disables all but the most critical entries in output/log file.
auth = true # 增加验证选项
#bind_ip = 127.0.0.1,172.18.12.2,172.18.12.3
keyFile=/opt/mongodb3.0/keyFile
directoryperdb = true # 每个db 存放在单独的目录中
wiredTigerDirectoryForIndexes = true
maxConns = 1000000
nohttpinterface = true
rest = false
profile=1
slowms=1000
storageEngine=wiredTiger
###Replication Options
replSet = im
oplogSize = 4096

 

#more /opt/mongodb3.0/mongodb_im_conf_47018/mongodb3.0_im_47018.cnf
dbpath = /opt/mongodb3.0/mongodb_im_data_47018/ # 指定数据库路径
logpath = /opt/mongodb3.0/mongodb_im_log_47018/mongodb.log # 日志路径
logappend = true # 以追加的方式写日志
port = 47018 # 指定端口号,默认47018
fork = true # 以子进程方式运行
quiet = true # disables all but the most critical entries in output/log file.
auth = true # 增加验证选项
#bind_ip = 127.0.0.1,172.18.12.2,172.18.12.3
keyFile=/opt/mongodb3.0/keyFile
directoryperdb = true # 每个db 存放在单独的目录中
wiredTigerDirectoryForIndexes = true
maxConns = 1000000
nohttpinterface = true
rest = false
profile=1
slowms=1000
storageEngine=wiredTiger
###Replication Options
replSet = im
oplogSize = 4096

 

#more /opt/mongodb3.0/mongodb_im_conf_47019/mongodb3.0_im_arbiter_47019.cnf
dbpath = /opt/mongodb3.0/mongodb_im_data_arbiter_47019/ # 指定数据库路径
logpath = /opt/mongodb3.0/mongodb_im_log_arbiter_47019/mongodb.log # 日志路径
logappend = true # 以追加的方式写日志
port = 47019 # 指定端口号,默认47019
fork = true # 以子进程方式运行
quiet = true # disables all but the most critical entries in output/log file.
auth = true # 增加验证选项
#bind_ip = 127.0.0.1,172.18.12.2,172.18.12.3
keyFile=/opt/mongodb3.0/keyFile
directoryperdb = true # 每个db 存放在单独的目录中
wiredTigerDirectoryForIndexes = true
maxConns = 1000000
nohttpinterface = true
rest = false
profile=1
slowms=1000
storageEngine=wiredTiger
###Replication Options
replSet = im
oplogSize = 4096

 

#more keyFile
this is a key file created by zhangyb used to auth by replica set members each OTHER

 

#ps -ef | grep mongodb
root 1601 1 0 2015 ? 1-15:45:22 /var/mongodb3.0/bin/mongod --config /opt/mongodb3.0/mongodb_im_conf_47018/mongodb3.0_im_47018.cnf
root 1622 1 0 2015 ? 21:02:42 /var/mongodb3.0/bin/mongod --config /opt/mongodb3.0/mongodb_im_conf_47019/mongodb3.0_im_arbiter_47019.cnf
root 1709 1 0 2015 ? 1-13:18:03 /var/mongodb3.0/bin/mongod --config /opt/mongodb3.0/mongodb_im_conf_47020/mongodb3.0_im_47020.cnf

ohu 4309 1 0 2015 ? 20:58:04 /opt/mongodb_one/mongodb/bin/mongod --port 27027 --dbpath /opt/mongodb_one/data/27027 --logpath /opt/mongodb_one/data/logs/27027.log --logappend --fork --nojournal --maxConns 20000

 

以上是关于mongodb复制集配置的主要内容,如果未能解决你的问题,请参考以下文章

MongoDB配置复制集

Mongodb复制集配置

spring mongodb 复制集配置(实现读写分离)

mongodb 3.4分片复制集配置

MongoDB复制集管理优化

MongoDB复制集配置步骤