0

I'm trying to run mongodb server :

sudo systemctl start mongod

this gives me no error, but when I try to check the status, I get error saying :

mua@mua  ~  sudo systemctl status mongod               ✔  2916  14:07:16 

● mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: e
   Active: failed (Result: exit-code) since Tue 2021-04-27 14:07:16 +06; 5s ago
     Docs: https://docs.mongodb.org/manual
  Process: 13625 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exite
 Main PID: 13625 (code=exited, status=1/FAILURE)

এপ্রিল 27 14:07:16 mua systemd[1]: Started MongoDB Database Server.
এপ্রিল 27 14:07:16 mua mongod[13625]: {"t":{"$date":"2021-04-27T08:07:16.650Z"},"
এপ্রিল 27 14:07:16 mua systemd[1]: mongod.service: Main process exited, code=exit
এপ্রিল 27 14:07:16 mua systemd[1]: mongod.service: Failed with result 'exit-code'
lines 1-11/11 (END)...skipping...
● mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2021-04-27 14:07:16 +06; 5s ago
     Docs: https://docs.mongodb.org/manual
  Process: 13625 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
 Main PID: 13625 (code=exited, status=1/FAILURE)

এপ্রিল 27 14:07:16 mua systemd[1]: Started MongoDB Database Server.
এপ্রিল 27 14:07:16 mua mongod[13625]: {"t":{"$date":"2021-04-27T08:07:16.650Z"},"s":"F",  "c":"CONTROL",  "id":20574,   "ctx":"main","msg":"Err
এপ্রিল 27 14:07:16 mua systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
এপ্রিল 27 14:07:16 mua systemd[1]: mongod.service: Failed with result 'exit-code'.
~
~

Here is some details :

MongoDB shell version v4.4.5
Build Info: {
    "version": "4.4.5",
    "gitVersion": "ff5cb77101b052fa02da43b8538093486cf9b3f7",
    "openSSLVersion": "OpenSSL 1.1.1  11 Sep 2018",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "ubuntu1804",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

Can anyone help me solving this problem ?

Here is the service

 mua@mua  /lib/systemd/system  cat mongod.service   127 ↵  3002  13:28:11 
[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network-online.target
Wants=network-online.target

[Service]
User=mongodb
Group=mongodb
EnvironmentFile=-/etc/default/mongod
ExecStart=/usr/bin/mongod --config /etc/mongod.conf
PIDFile=/var/run/mongodb/mongod.pid
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false

# Recommended limits for mongod as specified in
# https://docs.mongodb.com/manual/reference/ulimit/#recommended-ulimit-settings

[Install]
WantedBy=multi-user.target

5
0

Looks familiar... If you check your mongod.service file (/lib/systemd/system/mongod.service), there should be line what tells where mongod.pid file is located (PIDFile=/tmp/mongod.pid). That same file (with path) should be found from your /etc/mongod.conf file.

processManagement:
  pidFilePath: /tmp/mongod.pid

Problem is that, after 5 second when you have said 'sudo systemctl start mongod.service', system will check "is there mongod.pid" and because it cannot find it, it will KILL that running mongod-process.

1
  • I've added the whole service, will you please check ? there is no sign of temp regarding process-management Apr 28 at 7:34

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.