sudo service mongod start:mongod:无法识别的服务

时间:2016-09-06 08:04:13

标签: mongodb docker ubuntu-14.04 upstart learning-locker

我正在测试基于mongoDB的学习柜,它位于ubuntu14.04 docker https://hub.docker.com/r/hadyrashwan/learninglocker-ubuntu14.04/内。我得到它的工作,但我无法启动mongodb自动尝试修复命令并将启动服务命令中的名称更改为mongodb或mongo但不工作。但是运行mongod只是让它启动但是我想自动启动它而不是打开终端并让它打开以便系统继续工作

root@bd1997365c3a:/# mongod 
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

2 个答案:

答案 0 :(得分:4)

如果已安装mongodb,只需根据mongodb config

卸载

在开始做所有事情之前先安装mongodb服务器。

sudo apt install mongodb-server  

然后继续安装mongodb config建议您的内容。

完成你的mongodb配置后,你可以去

sudo service mongodb start

注意:它不是mongod的mongodb

答案 1 :(得分:1)

我有同样的问题。如果你通过源代码安装,似乎有一些错误的配置。

  

使用 apt-get 激活的mongod作为服务重新安装mongoDB   我