# mongod.conf# for documentation of all options, see:# http://docs.mongodb.org/manual/reference/configuration-options/# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /opt/mongodb/cluster/config/logs/mongod.log
# Where and how to store data.
storage:
dbPath: /opt/mongodb/cluster/config/data
# how the process runs
processManagement:
fork: true
pidFilePath: /opt/mongodb/cluster/config/mongod.pid
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27018
bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.#security:#operationProfiling:
replication:
replSetName: config
sharding:
clusterRole: configsvr
设置shard1,2,3 分片的配置文件,分配设置各自的路径和端口号
# mongod.conf# for documentation of all options, see:# http://docs.mongodb.org/manual/reference/configuration-options/# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /opt/mongodb/cluster/shard1/logs/mongod.log # shard1的地址# Where and how to store data.
storage:
dbPath: /opt/mongodb/cluster/shard1/data # shard1的地址# how the process runs
processManagement:
fork: true
pidFilePath: /opt/mongodb/cluster/shard1/mongod.pid # shard1的地址
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27019# shard1的监听端口号
bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.#security:#operationProfiling:
replication:
replSetName: shard1 # 设置复制集的名字
sharding:
clusterRole: shardsvr # 设置分片的名字
设置mongos的配置
# mongod.conf# for documentation of all options, see:# http://docs.mongodb.org/manual/reference/configuration-options/# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /opt/mongodb/cluster/mongos/logs/mongod.log
# how the process runs
processManagement:
fork: true
pidFilePath: /opt/mongodb/cluster/mongos/mongod.pid
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.#security:#operationProfiling:#replication:
sharding:
configDB: config/0.0.0.0:27018,0.0.0.0:27018,0.0.0.0:27018 # 设置分片的config文件
rs.initiate(config) “errmsg” : “replSetInitiate quorum check failed because not all proposed set members responded affirmatively: 192.168.25.130:27018 failed with Error connecting to 192.168.25.130:27018 :: caused by :: No route to host” 错误
启动share1的时候 ,报错了,报错信息是: about to fork child process, waiting until server is ready for connections. forked process: 9738 ERROR: child process failed, exited with 100 To see additional information in this output, start without the “–fork” option。