when i write this command
sudo service mongod start
that giving me this error
Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.
i search on the stackoverflow and found it Mongodb not able to start in Ubuntu 15.04
but this doesn't work for me and this problem asked the 5 years ago
and when i write the this command
sudo service mongod status
giving me to
Redirecting to /bin/systemctl status mongod.service
● mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2021-07-24 22:49:47 UTC; 3min 49s ago
Docs: https://docs.mongodb.org/manual
Process: 4126 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=2)
Process: 4123 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 4120 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 4119 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
Jul 24 22:49:47 ip-172-31-46-146.eu-central-1.compute.internal systemd[1]: Starting MongoDB Database Server...
Jul 24 22:49:47 ip-172-31-46-146.eu-central-1.compute.internal mongod[4126]: Error parsing YAML config: duplicate key: replication.rep...Name
Jul 24 22:49:47 ip-172-31-46-146.eu-central-1.compute.internal mongod[4126]: try '/usr/bin/mongod --help' for more information
Jul 24 22:49:47 ip-172-31-46-146.eu-central-1.compute.internal systemd[1]: mongod.service: control process exited, code=exited status=2
Jul 24 22:49:47 ip-172-31-46-146.eu-central-1.compute.internal systemd[1]: Failed to start MongoDB Database Server.
Jul 24 22:49:47 ip-172-31-46-146.eu-central-1.compute.internal systemd[1]: Unit mongod.service entered failed state.
Jul 24 22:49:47 ip-172-31-46-146.eu-central-1.compute.internal systemd[1]: mongod.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
and this command
sudo systemctl disable mongod
giving me
Removed symlink /etc/systemd/system/multi-user.target.wants/mongod.service.
and i doing the enable happen this
sudo systemctl enable mongod
Created symlink from /etc/systemd/system/multi-user.target.wants/mongod.service to /usr/lib/systemd/system/mongod.service.
it's my mongod.conf file
GNU nano 2.9.8 /etc/mongod.conf
# mongod.conf# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage: dbPath: /var/lib/mongo
journal:
enabled: true
# engine:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net: port: 34418
bindIp: 127.0.0.1,172.31.46.146 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll settin$
#security:
#authorization: "enabled"
#operationProfiling:
replication:
replSetName: "rs0"
#sharding:
## Enterprise-Only Options
#auditLog: