Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sudo service mongod start : mongod: unrecognized service

I'm testing learning locker which is based on MongoDB it's all inside a ubuntu14.04 docker https://hub.docker.com/r/hadyrashwan/learninglocker-ubuntu14.04/ . I got it to work but I can't start Mongodb automatically tried the repair command and changing the name in start service command to Mongodb or mongo but not working. but running Mongodb just make it start but I want to start it automatically not opening a terminal and leave it open so the system continues to work

root@bd1997365c3a:/# mongodb 
2016-09-06T07:41:51.816+0000 I CONTROL  [initandlisten] MongoDB starting : pid=197 port=27017 dbpath=/data/db 64-bit host=bd1997365c3a
2016-09-06T07:41:51.817+0000 I CONTROL  [initandlisten] db version v3.2.9
2016-09-06T07:41:51.817+0000 I CONTROL  [initandlisten] git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
2016-09-06T07:41:51.817+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2016-09-06T07:41:51.817+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2016-09-06T07:41:51.817+0000 I CONTROL  [initandlisten] modules: none
2016-09-06T07:41:51.817+0000 I CONTROL  [initandlisten] build environment:
2016-09-06T07:41:51.817+0000 I CONTROL  [initandlisten]     distmod: ubuntu1404
2016-09-06T07:41:51.817+0000 I CONTROL  [initandlisten]     distarch: x86_64
2016-09-06T07:41:51.817+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2016-09-06T07:41:51.817+0000 I CONTROL  [initandlisten] options: {}
2016-09-06T07:41:51.823+0000 I -        [initandlisten] Detected data files in /data/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2016-09-06T07:41:51.867+0000 I JOURNAL  [initandlisten] journal dir=/data/db/journal
2016-09-06T07:41:51.867+0000 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2016-09-06T07:41:52.027+0000 I JOURNAL  [durability] Durability thread started
2016-09-06T07:41:52.027+0000 I JOURNAL  [journal writer] Journal writer thread started
2016-09-06T07:41:52.101+0000 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-09-06T07:41:52.101+0000 I CONTROL  [initandlisten] 
2016-09-06T07:41:52.102+0000 I CONTROL  [initandlisten] 
2016-09-06T07:41:52.102+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-09-06T07:41:52.102+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-09-06T07:41:52.102+0000 I CONTROL  [initandlisten] 
2016-09-06T07:41:52.102+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-09-06T07:41:52.102+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-09-06T07:41:52.102+0000 I CONTROL  [initandlisten] 
2016-09-06T07:41:52.111+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2016-09-06T07:41:52.112+0000 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-09-06T07:41:52.112+0000 I NETWORK  [initandlisten] waiting for connections on port 27017
like image 513
Hady Rashwan Avatar asked Sep 06 '16 08:09

Hady Rashwan


2 Answers

If already you install the mongodb just uninstall based on mongodb config

Before going do all stuff first install mongodb server.

sudo apt install mongodb-server  

Then continue to install what mongodb config suggest you.

Once done your mongodb configuration you can go

sudo service mongodb start

Note: Its not mongod its mongodb

like image 149
Sharathi RB Avatar answered Sep 19 '22 02:09

Sharathi RB


I had same problem. It seems there is some mis-configuration if you install via source code.

Re-installing mongoDB using apt-get activated mongod as a service for me.

like image 34
mkkhedawat Avatar answered Sep 22 '22 02:09

mkkhedawat