Running mongodb on ubuntu 16.04 LTS

前端 未结 5 714
无人共我
无人共我 2021-01-30 02:21

How can I run Mongodb, as a service, on Ubuntu 16.04 LTS? A few days ago I had upgrade my server to Ubuntu 16.04. I have noticed the my MongoDB service does not start when I reb

5条回答
  •  伪装坚强ぢ
    2021-01-30 03:06

    The latest version of MongoDB does most of things except one thing for now. After installing the MongoDB on Ubuntu 16.04.x , run the commands as follows:

    $ sudo systemctl enable mongod.service
    $ sudo systemctl daemon-reload
    

    Now most likely mongod starts on every boot automatically.


    This solution also works in case of getting this error:

    Failed to start mongod.service: Unit mongod.service not found.

    After run the commands above, the commands below start to work:

    $ sudo service mongod start
    $ mongo
    

    Similarly, the all services installed must be enabled to run. For instance, after installation of Ops Manager (a.k.a MMS) the documentation says to run the commend below.

    $ sudo systemctl start mongodb-mms.service

    Most likely Ubuntu does not start the service. Because it is not enabled yet. To enable it just run the command below:

    $ sudo systemctl enable mongodb-mms.service
    $ sudo systemctl daemon-reload
    

    Then try to start the service:

    $ sudo systemctl enable mongodb-mms.service
    

    That's all...

提交回复
热议问题