M HYPE SPLASH
// general

How to set mongod as a service on my server? Why is error 127 appearing?

By Emma Payne

I am trying to setup mongodb as a service.

service mongod status mongod.service - High-performance, schema-free document-oriented database Loaded: loaded (/etc/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2019-01-21 10:17:13 IST; 2s ago Docs: Process: 13220 ExecStart=/bin/bash /home/idt/bin/mongod --config /etc/mongod.conf (code=exited, status=127) Main PID: 13220 (code=exited, status=127)

The mongod.conf file is as follows

 cat /etc/mongod.conf # mongod.conf # for documentation of all options, see: # # Where and how to store data. systemLog: destination: file path: /var/log/mongodb/mongod.log logAppend: true storage: dbPath: /data/db journal: enabled: true processManagement: fork: true net: bindIp: 127.0.0.1 port: 27017 setParameter: enableLocalhostAuthBypass: false
=======
1

1 Answer

The error 127 in bash means the command is not found. Be sure the package mongod package is installed. Don't be confused as Ubuntu provides mongodb package while official website provides mongod. Here how you can check your system sanity:

List what is now installed on your system

dpkg -l | grep mongod

So check if you are effectively using mongod or mongodb. You should check the package mongod(b)-server which is the server side. In case of you only have mongod(b) or mongod(b)-client package installed, you might try to install the server again.

sudo apt install mongod(b)-server

Then you should able to restart your daemon

sudo service mongod(b) start

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy