配置文件如下:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1,116.xxx.xxx.xxx
#processManagement:
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
启动后的错误日志如下:
2015-12-11T14:51:43.451+0800 I CONTROL [initandlisten] db version v3.0.7
2015-12-11T14:51:43.451+0800 I CONTROL [initandlisten] git version: 6ce7cbe8c6b899552dadd907604559806aa2e9bd
2015-12-11T14:51:43.451+0800 I CONTROL [initandlisten] build info: Linux ip-10-229-88-125 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2015-12-11T14:51:43.451+0800 I CONTROL [initandlisten] allocator: tcmalloc
2015-12-11T14:51:43.451+0800 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1,116.xxx.xxx.xxx", port: 27017 }, processManagement: { fork: true }, security: { authorization: "enabled" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2015-12-11T14:51:43.532+0800 I CONTROL [initandlisten] now exiting
2015-12-11T14:51:43.532+0800 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2015-12-11T14:51:43.532+0800 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2015-12-11T14:51:43.532+0800 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2015-12-11T14:51:43.532+0800 I NETWORK [initandlisten] shutdown: going to close sockets...
2015-12-11T14:51:43.532+0800 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2015-12-11T14:51:43.532+0800 I STORAGE [initandlisten] shutdown: final commit...
2015-12-11T14:51:43.534+0800 I JOURNAL [initandlisten] journalCleanup...
2015-12-11T14:51:43.534+0800 I JOURNAL [initandlisten] removeJournalFiles
2015-12-11T14:51:43.534+0800 I JOURNAL [initandlisten] Terminating durability thread ...
2015-12-11T14:51:43.634+0800 I JOURNAL [journal writer] Journal writer thread stopped
2015-12-11T14:51:43.635+0800 I JOURNAL [durability] Durability thread stopped
2015-12-11T14:51:43.635+0800 I STORAGE [initandlisten] shutdown: closing all files...
2015-12-11T14:51:43.637+0800 I STORAGE [initandlisten] closeAllFiles() finished
2015-12-11T14:51:43.637+0800 I STORAGE [initandlisten] shutdown: removing fs lock...
2015-12-11T14:51:43.637+0800 I CONTROL [initandlisten] dbexit: rc: 48
求大师指点。
Gali kubur.
Saya juga menghadapi masalah ini hari ini, ia sangat menjengkelkan! Blog di Internet semuanya salah, menyalin dan menampal apa yang orang lain katakan.
Saya meraba-raba dan menukarnya beberapa kali, dan akhirnya menukarnya kepada: bindIp: [127.0.0.1, 116.xxx.xxx.xxx] Itu sahaja