你好我的MongoDB有问题它工作得很好,我重新启动服务器并废弃了这个显示的内容。
当我运行命令
时$ mongo
以
回复MongoDB shell version: 3.2.13
connecting to: test
2017-05-29T01:11:42.948+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-05-29T01:11:42.948+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6
exception: connect failed
我也运行了这个命令
$ mongod
它有我这个错误信息
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] MongoDB starting : pid=2530 port=27017 dbpath=/data/db 64-bit host=something
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] db version v3.2.13
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] git version: 23899209cad60aaafe114f6aea6cb83025ff51bc
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] allocator: tcmalloc
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] modules: none
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] build environment:
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] distarch: x86_64
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] target_arch: x86_64
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] options: {}
2017-05-29T01:17:58.469+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2017-05-29T01:17:58.469+0000 I - [initandlisten] Fatal Assertion 28578
2017-05-29T01:17:58.469+0000 I - [initandlisten]
***aborting after fassert() failure
然后我试了
sudo service mongod start
sudo service mongod status
它给了我这个失败错误
● mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-05-29 01:24:29 UTC; 1min 29s ago
Docs: https://docs.mongodb.org/manual
Process: 3200 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=100)
Main PID: 3200 (code=exited, status=100)
May 29 01:24:29 something systemd[1]: Started High-performance, schema-free document-oriented database.
May 29 01:24:29 something systemd[1]: mongod.service: Main process exited, code=exited, status=100/n/a
May 29 01:24:29 something systemd[1]: mongod.service: Unit entered failed state.
May 29 01:24:29 something systemd[1]: mongod.service: Failed with result 'exit-code'.
我已尝试删除套接字文件并试一试,但没有成功。 先谢谢你! :)