Can't start MongoDB, mongod is always stop/waiting
12,570
This looks like premissions issue, please do:
sudo chown whoami /tmp/mongodb-27017.sock
This will set premissions straight as You need.
Related videos on Youtube
Author by
Mike
Updated on September 18, 2022Comments
-
Mike over 1 year
I try to run
MongoDB
3.2.4 on Ubuntu 14.04:sudo service mongod start
And get the result:
mongod start/running, process 67725
But when I check the status I get:
mongod stop/waiting
I tried to reinstall
MongoDB
or to define the permissions for Mongo's folders (lib
&log
) asroot
or asmongodb
. I also tried to repair themongod.conf
but nothing helps.The content of log:
2016-04-09T23:56:28.349+0300 I CONTROL [main] ***** SERVER RESTARTED ***** 2016-04-09T23:56:28.359+0300 I CONTROL [initandlisten] MongoDB starting : pid=69120 port=27017 dbpath=/var/lib/mongodb 64-bit host=is-infomedia 2016-04-09T23:56:28.360+0300 I CONTROL [initandlisten] db version v3.2.4 2016-04-09T23:56:28.360+0300 I CONTROL [initandlisten] git version: e2ee9ffcf9f5a94fad76802e28cc978718bb7a30 2016-04-09T23:56:28.360+0300 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014 2016-04-09T23:56:28.360+0300 I CONTROL [initandlisten] allocator: tcmalloc 2016-04-09T23:56:28.360+0300 I CONTROL [initandlisten] modules: none 2016-04-09T23:56:28.360+0300 I CONTROL [initandlisten] build environment: 2016-04-09T23:56:28.360+0300 I CONTROL [initandlisten] distmod: ubuntu1404 2016-04-09T23:56:28.360+0300 I CONTROL [initandlisten] distarch: x86_64 2016-04-09T23:56:28.360+0300 I CONTROL [initandlisten] target_arch: x86_64 2016-04-09T23:56:28.360+0300 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } } 2016-04-09T23:56:28.393+0300 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted 2016-04-09T23:56:28.393+0300 I - [initandlisten] Fatal Assertion 28578 2016-04-09T23:56:28.393+0300 I - [initandlisten] ***aborting after fassert() failure
Update:
After editing of
/etc/mongod.conf
:#security: authorization: enabled enableEncryption: true javascriptEnabled: false
and saving the file, and try to restart the
mongod
, I get the same error but MongoDB doesn't write any log file. I checked the permissions of/etc/mongod.conf
, it is assigned tomongodb
group. How can I restartmongod
after editing its config file?My questions:
- How can I run
MongoDB
as a service in Ubuntu? - What I miss or do wrong?
-
Eska about 8 years
sudo systemctl enable servicename
- to run it as service. This issue looks like problems with premissions, try sudo chownwhoami
/tmp/mongodb-27017.sock to get premissions straight. If that wont help, can You remove the socket? -
tsveti_iko over 6 yearsUncomment
#security:
, it should besecurity: authorization: "enabled"
- How can I run
-
Mike about 8 yearsOne more moment, I just edited
/etc/mongod.conf
(added#security: authorization: enabled enableEncryption: true javascriptEnabled: false
) saved the file, and tried to restartmongod
and get the same error but MongoDB doesn't write any log file. I checked, the permissions,/etc/mongod.conf
assigned tomongodb
group. How can I restartmongod
after editing its config file? -
Eska about 8 yearsYou reset service by
sudo systemctl restart servicename
. If You want to check mongo status, dosudo systemctl status servicename
. -
Eska about 8 yearsIf You will hit
tab
after typingsudo systemctl
You will get list of available commands forsystemctl
-
Mike about 8 yearsThank you, the problem is that this package is not installed and in order to use it I have to reboot the system, which is not possible due to already running programs.
-
Eska about 8 yearsPlease try
sudo systemctl daemon-reload
, maybe that will do to avoid reboot. -
Eska about 8 yearsOn the other hand, if system requires to restart for the proper run of the app, i wouldn't recommend to try to avoid/bypass this action. May i ask whats the machine duty? (I mean, is it some kind of server machine connected to production process in facility or something like that?)
-
Mike about 8 yearsIt's a local workstation, which is used by multiple persons and, thus, it's problematical to restart the system.
-
Eska about 8 yearsI don't think there is a safe way to achieve what You need. I may be mistaken, but if linux need a reboot for something, that actually probably means something bigger than just a reload of the config files. I was installing php7-fpm, mariadb, nginx all together 2 days ago on Debian Stretch - there was no need to reboot to get them working straight away as systemctl services.