以文件方式启动,推荐配置

最后更新于:2022-04-02 04:00:08

[TOC] ## 启动 `mongod -f /usr/local/mongodb/conf/config.conf` ### linux 自动生成实例
bigant_mongo_root ``` #!/bin/bash #chkconfig:2345 12 90 su - im_user <
config.cfg ``` systemLog: destination: file logAppend: true path: /home/im_user/im_server/im_server/mongodb/log/config1.log storage: dbPath: /home/im_user/im_server/im_server/mongodb/data/data_config1 journal: enabled: true # engine: # wiredTiger: processManagement: fork: true # fork and run in background #pidFilePath: /var/run/mongodb/config1.pid # location of pidfile timeZoneInfo: /usr/share/zoneinfo # network interfaces net: port: 30000 bindIp: 0.0.0.0 #security: #operationProfiling: replication: replSetName: configs sharding: clusterRole: configsvr ## Enterprise-Only Options #auditLog: #snmp: ```

mongos.cfg ``` systemLog: destination: file logAppend: true path: /home/im_user/im_server/im_server/mongodb/log/mongos1.log processManagement: fork: true # fork and run in background #pidFilePath: /var/run/mongodb/mongos1.pid # location of pidfile timeZoneInfo: /usr/share/zoneinfo net: port: 30010 bindIp: 0.0.0.0 #security: #operationProfiling: #eplication: sharding: # 配置哪些ip 需要添加 #configDB: configs/192.168.0.153:30000,192.168.0.216:30000,192.168.0.218:30000 configDB: configs/ # clusterRole: configsvr ## Enterprise-Only Options #auditLog: #snmp: ```

shard.cfg ``` systemLog: destination: file logAppend: true path: /home/im_user/im_server/im_server/mongodb/log/shard1.log storage: dbPath: /home/im_user/im_server/im_server/mongodb/data/data_shard1 journal: enabled: true # engine: # wiredTiger: processManagement: fork: true # fork and run in background #pidFilePath: /var/run/mongodb/shard1.pid # location of pidfile timeZoneInfo: /usr/share/zoneinfo net: port: 27001 bindIp: 0.0.0.0 #security: #operationProfiling: replication: replSetName: #shard# sharding: clusterRole: shardsvr ## Enterprise-Only Options #auditLog: #snmp: ```

描述 ``` ```

';