sudo service mongod start : mongod: unrecognized service
我正在测试基于mongoDB的学习储物柜,它全部位于ubuntu14.04 docker https://hub.docker.com/r/hadyrashwan/learninglocker-ubuntu14.04/中。 我使它工作了,但是我无法启动mongodb自动尝试修复命令,并在start service命令中将名称更改为mongodb或mongo,但无法工作。 但是运行mongod只会使其启动,但是我想自动启动它而不是打开终端并保持打开状态,以便系统继续运行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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 |
如果已经安装了mongodb,请根据mongodb config进行卸载
开始之前,请先安装mongodb服务器。
1 | sudo apt install mongodb-server |
然后继续安装mongodb config会建议您的内容。
完成mongodb配置后,您可以开始
1 | sudo service mongodb start |
注意:它不是mongod,而是mongodb
我有同样的问题。 如果通过源代码安装,似乎配置有误。
Re-installing mongoDB using apt-get activated mongod as a service for
me.