Try to start but get failed (Result: exit-code)

system: ubuntu 22.04.1

sudo systemctl restart mongod
sudo systemctl status mongod

× mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2023-10-11 16:47:01 CST; 51s ago
       Docs: https://docs.mongodb.org/manual
    Process: 5370 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
   Main PID: 5370 (code=exited, status=1/FAILURE)
        CPU: 91ms

10月 11 16:47:01 ubuntu mongod[5370]:   Frame: {"a":"5558F6B41F37","b":"5558F49C4000","o":"217DF37","s":">
10月 11 16:47:01 ubuntu mongod[5370]:   Frame: {"a":"5558F971D477","b":"5558F49C4000","o":"4D59477","s":">
10月 11 16:47:01 ubuntu mongod[5370]:   Frame: {"a":"5558F971D8ED","b":"5558F49C4000","o":"4D598ED","s":">
10月 11 16:47:01 ubuntu mongod[5370]:   Frame: {"a":"5558F6AE371D","b":"5558F49C4000","o":"211F71D","s":">
10月 11 16:47:01 ubuntu mongod[5370]:   Frame: {"a":"5558F68D420E","b":"5558F49C4000","o":"1F1020E","s":">
10月 11 16:47:01 ubuntu mongod[5370]:   Frame: {"a":"7FD9A6429D90","b":"7FD9A6400000","o":"29D90","s":"__>
10月 11 16:47:01 ubuntu mongod[5370]:   Frame: {"a":"7FD9A6429E40","b":"7FD9A6400000","o":"29E40","s":"__>
10月 11 16:47:01 ubuntu mongod[5370]:   Frame: {"a":"5558F6ADEA8E","b":"5558F49C4000","o":"211AA8E","s":">
10月 11 16:47:01 ubuntu systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
10月 11 16:47:01 ubuntu systemd[1]: mongod.service: Failed with result 'exit-code'.


here is the service file

cat /lib/systemd/system/mongod.service
[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

here is .conf

root@ubuntu:/var/run# cat /etc/mongod.conf
# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
#  engine:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1


# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo

#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

i’m try to authorize

wangshuxiang@ubuntu:~$ sudo ls -l /var/lib/mongodb/
total 280
-rw------- 1 mongodb mongodb 20480 10月 11 15:42 collection-0-4075949709213312323.wt
-rw------- 1 mongodb mongodb 36864 10月 11 15:42 collection-2-4075949709213312323.wt
-rw------- 1 mongodb mongodb  4096 10月 11 09:43 collection-4-4075949709213312323.wt
drwx------ 2 mongodb mongodb  4096 10月 11 15:42 diagnostic.data
-rw------- 1 mongodb mongodb 20480 10月 11 15:42 index-1-4075949709213312323.wt
-rw------- 1 mongodb mongodb 36864 10月 11 15:42 index-3-4075949709213312323.wt
-rw------- 1 mongodb mongodb  4096 10月 11 09:43 index-5-4075949709213312323.wt
-rw------- 1 mongodb mongodb  4096 10月 11 09:44 index-6-4075949709213312323.wt
drwx------ 2 mongodb mongodb  4096 10月 11 15:42 journal
-rw------- 1 mongodb mongodb 20480 10月 11 15:42 _mdb_catalog.wt
-rw------- 1 mongodb mongodb     5 10月 11 15:42 mongod.lock
-rw------- 1 mongodb mongodb 36864 10月 11 15:42 sizeStorer.wt
-rw------- 1 mongodb mongodb   114 10月 11 09:38 storage.bson
-rw------- 1 mongodb mongodb    50 10月 11 09:38 WiredTiger
-rw------- 1 mongodb mongodb  4096 10月 11 15:42 WiredTigerHS.wt
-rw------- 1 mongodb mongodb    21 10月 11 09:38 WiredTiger.lock
-rw------- 1 mongodb mongodb  1465 10月 11 15:42 WiredTiger.turtle
-rw------- 1 mongodb mongodb 69632 10月 11 15:42 WiredTiger.wt

here is some log

{"t":{"$date":"2023-10-11T15:42:20.139+08:00"},"s":"I",  "c":"STORAGE",  "id":4795906, "ctx":"initandlisten","msg":"WiredTiger opened","attr":{"durationMillis":722}}
{"t":{"$date":"2023-10-11T15:42:20.139+08:00"},"s":"I",  "c":"RECOVERY", "id":23987,   "ctx":"initandlisten","msg":"WiredTiger recoveryTimestamp","attr":{"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}}
{"t":{"$date":"2023-10-11T15:42:20.143+08:00"},"s":"W",  "c":"CONTROL",  "id":22120,   "ctx":"initandlisten","msg":"Access control is not enabled for the database. Read and write access to data and configuration is unrestricted","tags":["startupWarnings"]}
{"t":{"$date":"2023-10-11T15:42:20.143+08:00"},"s":"W",  "c":"CONTROL",  "id":5123300, "ctx":"initandlisten","msg":"vm.max_map_count is too low","attr":{"currentValue":65530,"recommendedMinimum":102400,"maxConns":51200},"tags":["startupWarnings"]}
{"t":{"$date":"2023-10-11T15:42:20.144+08:00"},"s":"I",  "c":"NETWORK",  "id":4915702, "ctx":"initandlisten","msg":"Updated wire specification","attr":{"oldSpec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true},"newSpec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":17,"maxWireVersion":17},"outgoing":{"minWireVersion":17,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2023-10-11T15:42:20.144+08:00"},"s":"I",  "c":"REPL",     "id":5853300, "ctx":"initandlisten","msg":"current featureCompatibilityVersion value","attr":{"featureCompatibilityVersion":"6.0","context":"startup"}}
{"t":{"$date":"2023-10-11T15:42:20.144+08:00"},"s":"I",  "c":"STORAGE",  "id":5071100, "ctx":"initandlisten","msg":"Clearing temp directory"}
{"t":{"$date":"2023-10-11T15:42:20.145+08:00"},"s":"I",  "c":"CONTROL",  "id":20536,   "ctx":"initandlisten","msg":"Flow Control is enabled on this deployment"}
{"t":{"$date":"2023-10-11T15:42:20.145+08:00"},"s":"I",  "c":"FTDC",     "id":20625,   "ctx":"initandlisten","msg":"Initializing full-time diagnostic data capture","attr":{"dataDirectory":"/var/lib/mongodb/diagnostic.data"}}
{"t":{"$date":"2023-10-11T15:42:20.147+08:00"},"s":"I",  "c":"REPL",     "id":6015317, "ctx":"initandlisten","msg":"Setting new configuration state","attr":{"newState":"ConfigReplicationDisabled","oldState":"ConfigPreStart"}}
{"t":{"$date":"2023-10-11T15:42:20.147+08:00"},"s":"I",  "c":"STORAGE",  "id":22262,   "ctx":"initandlisten","msg":"Timestamp monitor starting"}
{"t":{"$date":"2023-10-11T15:42:20.148+08:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"/tmp/mongodb-27017.sock"}}
{"t":{"$date":"2023-10-11T15:42:20.148+08:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"127.0.0.1"}}
{"t":{"$date":"2023-10-11T15:42:20.148+08:00"},"s":"I",  "c":"NETWORK",  "id":23016,   "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}
{"t":{"$date":"2023-10-11T15:42:21.000+08:00"},"s":"F",  "c":"CONTROL",  "id":6384300, "ctx":"ftdc","msg":"Writing fatal message","attr":{"message":"terminate() called. An exception is active; attempting to gather more information\n"}}
{"t":{"$date":"2023-10-11T15:42:21.000+08:00"},"s":"F",  "c":"CONTROL",  "id":6384300, "ctx":"ftdc","msg":"Writing fatal message","attr":{"message":"DBException::toString(): Fil

but still fail to start mongodb…

how to fix this issue?

Check journalctl -u mongod I think all the good information is in there for this issue.