搭建一个mongodb集群
主机信息:
192.168.17.189
192.168.17.190
192.168.17.191
192.168.17.189配置文件
# 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: /home/wbird/mongodb/logs/mongod.log # Where and how to store data. storage: dbPath: /home/wbird/mongodb/data journal: enabled: true directoryPerDB: true wiredTiger: engineConfig: cacheSizeGB: 12 directoryForIndexes: true # how the process runs processManagement: fork: true pidFilePath: /home/wbird/mongodb/mongod.pid timeZoneInfo: /usr/share/zoneinfo # network interfaces net: port: 27017 bindIp: 192.168.17.189,127.0.0.1 maxIncomingConnections: 10000 security: keyFile: /home/wbird/mongodb/KeyFile.file authorization: enabled #operationProfiling: replication: replSetName: rs0 enableMajorityReadConcern: false #sharding: ## Enterprise-Only Options #auditLog: #snmp:
192.168.17.190 配置文件
# 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: /home/wbird/mongodb/logs/mongod.log # Where and how to store data. storage: dbPath: /home/wbird/mongodb/data journal: enabled: true directoryPerDB: true wiredTiger: engineConfig: cacheSizeGB: 12 directoryForIndexes: true # how the process runs processManagement: fork: true pidFilePath: /home/wbird/mongodb/mongod.pid timeZoneInfo: /usr/share/zoneinfo # network interfaces net: port: 27017 bindIp: 192.168.17.190,127.0.0.1 maxIncomingConnections: 10000 security: keyFile: /home/wbird/mongodb/KeyFile.file authorization: enabled #operationProfiling: replication: replSetName: rs0 enableMajorityReadConcern: false #sharding: ## Enterprise-Only Options #auditLog: #snmp:
192.168.17.190 配置文件
# 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: /home/wbird/mongodb/logs/mongod.log # Where and how to store data. storage: dbPath: /home/wbird/mongodb/data journal: enabled: true directoryPerDB: true wiredTiger: engineConfig: cacheSizeGB: 12 directoryForIndexes: true # how the process runs processManagement: fork: true pidFilePath: /home/wbird/mongodb/mongod.pid timeZoneInfo: /usr/share/zoneinfo # network interfaces net: port: 27017 bindIp: 192.168.17.191,127.0.0.1 maxIncomingConnections: 10000 security: keyFile: /home/wbird/mongodb/KeyFile.file authorization: enabled #operationProfiling: replication: replSetName: rs0 enableMajorityReadConcern: false #sharding: ## Enterprise-Only Options #auditLog: #snmp:
启动mongo
mongod -f /etc/mongod.conf