简体   繁体   中英

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.

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

is the main problem. Perhaps you could double check who owns this? also the permission?

It looks like this in my mongo: 在此处输入图片说明

Hopefully it helps

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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