请根据如下进程启动命令行生成mongodb 启动的配置文件 mongod.conf
numactl --interleave=all mongod \
--directoryperdb \
--auth \
--keyFile=/path/to/key_file \
--wiredTigerCacheSizeGB 6 \
--dbpath=/path/to/db \
--port 27017 \
--fork \
--replSet test \
--logpath /path/to/mongd.log \
--logappend \
--maxConns 16000
根据提供的启动参数,以下是对应的 MongoDB 配置文件 mongod.conf 的内容:
net:
port: 27017
maxIncomingConnections: 16000
storage:
dbPath: /path/to/db
directoryPerDB: true
wiredTiger:
engineConfig:
cacheSizeGB: 6
security:
authorization: enabled
keyFile: /path/to/key_file
systemLog:
destination: file
path: /path/to/mongod.log
logAppend: true
replication:
replSetName: test
processManagement:
fork: true
可以看出,这是一个MongoDB复制集的一个节点的配置。
请根据如下进程启动命令行生成mongodb 启动的配置文件 mongod.conf
numactl --interleave=all mongod \
--directoryperdb \
--auth \
--keyFile=/path/to/key_file \
--configsvr \
--dbpath=${datapath} \
--port ${dbport} \
--fork \
--replSet ${replSetName} \
--logpath /path/to/mongod.log \
--logappend \
--maxConns 16000
根据提供的启动参数,以下是对应的 MongoDB 配置文件 mongod.conf 的内容:
net:
port: ${dbport}
maxIncomingConnections: 16000
systemLog:
destination: file
path: /path/to/mongod.log
logAppend: true
storage:
dbPath: ${datapath}
directoryPerDB: true
journal:
enabled: true
processManagement:
fork: true
security:
authorization: enabled
keyFile: /path/to/key_file
replication:
replSetName: ${replSetName}
sharding:
clusterRole: configsvr
可以看出这是MongoDB分片集群中的一个 config server 节点进程。
请根据如下进程启动命令行生成mongodb 启动的配置文件 mongos.conf
numactl --interleave=all mongos \
--keyFile=/path/to/bin/key_file \
--port ${dbport} \
--fork \
--logpath /path/to/mongos.log \
--logappend \
--configdb "XXX/xx.xx.xx.xx:40001,xx.xx.xx.xx:40001,xx.xx.xx.xx:40001"
net:
port: ${dbport}
bindIp: xx.xx.xx.xx
security:
keyFile: /path/to/key_file
processManagement:
fork: true
systemLog:
destination: file
path: /path/to/mongos.log
logAppend: true
sharding:
configDB: "XXX/xx.xx.xx.xx:40001,xx.xx.xx.xx:40001,xx.xx.xx.xx:40001"
可以看出,这是一个MongoDB分片集群中一个mongos节点的配置, configDB: "XXX/xx.xx.xx.xx:40001,xx.xx.xx.xx:40001,xx.xx.xx.xx:40001" 行中的 XXX 为分片集群中config server 副本集的 replSetName。
请根据如下进程启动命令行生成mongodb 启动的配置文件 mongod.conf
numactl --interleave=all mongod \
--directoryperdb \
--auth \
--shardsvr \
--keyFile=/path/to/key_file \
--wiredTigerCacheSizeGB 45 \
--dbpath=${datapath} \
--port ${dbport} \
--fork \
--replSet ${replSetName} \
--logpath /path/to/mongod.log \
--logappend \
--maxConns 16000
net:
port: ${dbport}
bindIp: xx.xx.xx.xx,127.0.0.1
maxIncomingConnections: 16000
systemLog:
destination: file
path: /path/to/mongod.log
logAppend: true
processManagement:
fork: true
storage:
dbPath: /path/to/db
directoryPerDB: true
wiredTiger:
engineConfig:
cacheSizeGB: 45
replication:
replSetName: ${replSetName}
security:
keyFile: "path/to/key_file"
authorization: enabled
sharding:
clusterRole: shardsvr
参考
MongoDB Manual/Replication
https://www.mongodb.com/docs/v4.4/replication/
MongoDB Manual/Sharding
https://www.mongodb.com/docs/v4.4/sharding/
网友评论