0

When I try to check the status of mongodb I get the following:

× mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2024-04-16 16:40:14 EDT; 19s ago
       Docs: https://docs.mongodb.org/manual
    Process: 10689 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
   Main PID: 10689 (code=exited, status=1/FAILURE)
        CPU: 39ms

Apr 16 16:40:14 rime-VirtualBox systemd[1]: Started MongoDB Database Server.
Apr 16 16:40:14 rime-VirtualBox mongod[10689]: {"t":{"$date":"2024-04-16T20:40:14.057Z"},"s":"I",  "c":"CONTROL",  "id":5760901, ">
Apr 16 16:40:14 rime-VirtualBox mongod[10689]: about to fork child process, waiting until server is ready for connections.
Apr 16 16:40:14 rime-VirtualBox mongod[10691]: forked process: 10691
Apr 16 16:40:14 rime-VirtualBox mongod[10689]: ERROR: child process failed, exited with 1
Apr 16 16:40:14 rime-VirtualBox mongod[10689]: To see additional information in this output, start without the "--fork" option.
Apr 16 16:40:14 rime-VirtualBox systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Apr 16 16:40:14 rime-VirtualBox systemd[1]: mongod.service: Failed with result 'exit-code'.
~

Here are some important files:

config

storage:
  dbPath: /var/lib/mongodb
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log
net:
  port: 27017
  bindIp: 127.0.0.1
processManagement:
   fork: true
setParameter:
   enableLocalhostAuthBypass: false

service

[Service]
User=mongodb
Group=mongodb
EnvironmentFile=-/etc/default/mongod
ExecStart=/usr/bin/mongod --config /etc/mongod.conf
RuntimeDirectory=mongodb
# 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

log


{"t":{"$date":"2024-04-16T16:45:41.024-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:42.029-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:43.029-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:44.029-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:45.041-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:46.041-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:47.043-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:48.045-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:49.046-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:50.052-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:51.057-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:52.059-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:53.059-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:54.060-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:55.081-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:55.367-04:00"},"s":"D1", "c":"INDEX",    "id":22533,   "ctx":"TTLMonitor","msg":"running TTL job for index","attr":{"namespace":"config.system.sessions","key":{"lastUse":1},"name":"lsidTTLIndex"}}
{"t":{"$date":"2024-04-16T16:45:55.367-04:00"},"s":"I",  "c":"INDEX",    "id":5479200, "ctx":"TTLMonitor","msg":"Deleted expired documents using index","attr":{"namespace":"config.system.sessions","index":"lsidTTLIndex","numDeleted":0,"durationMillis":0}}
{"t":{"$date":"2024-04-16T16:45:56.087-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:56.838-04:00"},"s":"D1", "c":"WTCHKPT",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":{"ts_sec":1713300356,"ts_usec":838383,"thread":"9327:0x76d97d11b640","session_name":"WT_SESSION.checkpoint","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":6,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"saving checkpoint snapshot min: 69, snapshot max: 69 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 1"}}}
{"t":{"$date":"2024-04-16T16:45:56.864-04:00"},"s":"D1", "c":"STORAGE",  "id":7702900, "ctx":"Checkpointer","msg":"Checkpoint thread sleeping","attr":{"duration":60}}
{"t":{"$date":"2024-04-16T16:45:57.087-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:58.087-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:45:59.088-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:00.088-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:01.089-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:02.092-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:03.092-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:04.094-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:05.094-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:06.094-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:07.094-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:08.094-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:09.094-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:10.097-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:11.097-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:12.097-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:13.097-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:14.098-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:15.105-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:16.106-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:17.106-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:18.127-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:19.128-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:20.132-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:21.149-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:22.156-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:23.176-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:24.194-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:25.194-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:26.200-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:27.202-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
{"t":{"$date":"2024-04-16T16:46:28.204-04:00"},"s":"D1", "c":"STORAGE",  "id":8097401, "ctx":"TimestampMonitor","msg":"No drop-pending idents have expired","attr":{"timestamp":{"$timestamp":{"t":0,"i":0}},"pendingIdentsCount":0}}
rime@rime-VirtualBox:~$ 

Could you please help me solve this issue? it seems to start fine when I start it with --verbose...

I tried changing the execstart parameter in the .service file but there was already no --fork

3
  • Run it without --verbose the logfile should show sufficient information. A common problem is that dbPath does not exist or it lacks write permissions. Commented Apr 17 at 5:21
  • Why did you set enableLocalhostAuthBypass: false? It does not make any sense because you did not enable authentication. Commented Apr 17 at 5:26
  • Have you checked file ownership and permissions in the data directory?
    – Joe
    Commented Apr 17 at 8:13

1 Answer 1

0

A common problem is a missing storage.dbPath.

Apart from that, I suggest to use settings like this:

processManagement:
  fork: true
  pidFilePath: /var/run/mongodb/mongod.pid
  timeZoneInfo: /usr/share/zoneinfo

A reliable way to ensure storage.dbPath is to create the folders in your service file. Would look like this:

[Service]
User=mongodb
Group=mongodb
Environment="OPTIONS=-f /etc/mongod.conf"
EnvironmentFile=-/etc/sysconfig/mongod
ExecStart=/usr/bin/mongod $OPTIONS
ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb
ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb
ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb
ExecStartPre=/usr/bin/mkdir -p /var/lib/mongo
ExecStartPre=/usr/bin/chown mongod:mongod /var/lib/mongo
ExecStartPre=/usr/bin/chmod 0700 /var/lib/mongo
ExecStartPre=/usr/bin/mkdir -p /var/log/mongodb
ExecStartPre=/usr/bin/chown mongod:mongod /var/log/mongodb
ExecStartPre=/usr/bin/chmod 0755 /var/log/mongodb
PermissionsStartOnly=true
PIDFile=/var/run/mongodb/mongod.pid
Type=forking

Note, you should not edit file /lib/systemd/system/mongod.service directly. Your changes may get reverted when you update MongoDB. Better create a copy to /etc/systemd/system/mongod.service and put your custom settings there. See https://unix.stackexchange.com/questions/224992/where-do-i-put-my-systemd-unit-file - and don't forget to run systemctl daemon-reload afterwards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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