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
) as root
or as mongodb
. I also tried to repair the mongod.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 to mongodb
group. How can I restart mongod
after editing its config file?
My questions:
- How can I run
MongoDB
as a service in Ubuntu? - What I miss or do wrong?
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?sudo chown mongodb /tmp/mongodb-27017.sock
fixed the issue. Please, arrange your comment as an answer in order to mark it as correct.#security:
, it should besecurity: authorization: "enabled"