简体   繁体   English

无法使用mongod和mongo启动MongoDB服务

[英]Can't start MongoDB service with either mongod & mongo

Hello I have a problem with my MongoDB it was working just fine and after I restart the server and scrapping something this show up. 您好,我的MongoDB存在问题,它工作正常,并且在我重新启动服务器并显示了一些错误之后。

When I ran command 当我执行命令

$ mongo

It respond with 它回应

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

I also ran this command 我也跑了这个命令

$ mongod

and it have me this error message 它有我这个错误信息

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

Then I tried 然后我尝试

sudo service mongod start
sudo service mongod status

and it give me this fail error 它给我这个失败错误

● 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'.

I've tried deleted the socket file and give it a try but didn't work. 我尝试删除套接字文件并尝试一下,但是没有用。 Thank you in advanced! 谢谢高级! :) :)

I am not sure if this is the correct answer or not. 我不确定这是否是正确的答案。 However, it appears to me that 但是,在我看来

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 E NETWORK [initandlisten]无法解除套接字文件/tmp/mongodb-27017.sock errno的链接:1 不允许操作

is the main problem. 是主要问题。 Perhaps you could double check who owns this? 也许您可以仔细检查谁拥有这个? also the permission? 还可以吗?

It looks like this in my mongo: 在我的mongo中看起来像这样: 在此处输入图片说明

Hopefully it helps 希望能有所帮助

rm /var/lib/mongodb/mongod.lock
systemctl restart mongod
systemctl status mongod

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM