在尝试启动mongod.service时重新配置mongod.conf后,我收到错误消息。
我试图运行命令“ mongod -f / path-to-configuration-file /
但是一切正常,所以我尝试允许db和log文件夹运行命令:
1-chmod 777 /文件路径
2-chown mongod:mongod /文件路径-R
这样做之后,我尝试允许端口40017进入,但仍然出现错误。
我的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: /bin/rsmongo/log/mongod.log # Where and how to store data. storage: dbPath: /bin/rsmongo/data/db journal: enabled: true # engine: # mmapv1: # 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: 40017
Systemctl状态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 Ter 2018-12-18 14:02:01 BRST; 9s ago
Docs: https://docs.mongodb.org/manual
Process: 3880 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=1/FAILURE)
Process: 3877 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 3874 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 3872 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
Dez 18 14:02:01 bon-lap-srv01 systemd[1]: Starting MongoDB Database Server...
Dez 18 14:02:01 bon-lap-srv01 mongod[3880]: 2018-12-18T14:02:01.128-0200 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
Dez 18 14:02:01 bon-lap-srv01 mongod[3880]: about to fork child process, waiting until server is ready for connections.
Dez 18 14:02:01 bon-lap-srv01 mongod[3880]: forked process: 3883
Dez 18 14:02:01 bon-lap-srv01 mongod[3880]: ERROR: child process failed, exited with error number 1
Dez 18 14:02:01 bon-lap-srv01 mongod[3880]: To see additional information in this output, start without the "--fork" option.
Dez 18 14:02:01 bon-lap-srv01 systemd[1]: mongod.service: control process exited, code=exited status=1
Dez 18 14:02:01 bon-lap-srv01 systemd[1]: Failed to start MongoDB Database Server.
Dez 18 14:02:01 bon-lap-srv01 systemd[1]: Unit mongod.service entered failed state.
Dez 18 14:02:01 bon-lap-srv01 systemd[1]: mongod.service failed.
Journalctl -xe结果:
Dez 18 14:01:01 bon-lap-srv01 CROND[3850]: (root) CMD (run-parts /etc/cron.hourly)
Dez 18 14:01:01 bon-lap-srv01 run-parts(/etc/cron.hourly)[3853]: starting 0anacron
Dez 18 14:01:01 bon-lap-srv01 run-parts(/etc/cron.hourly)[3859]: finished 0anacron
Dez 18 14:01:01 bon-lap-srv01 run-parts(/etc/cron.hourly)[3861]: starting 0yum-hourly.cron
Dez 18 14:01:01 bon-lap-srv01 run-parts(/etc/cron.hourly)[3865]: finished 0yum-hourly.cron
Dez 18 14:02:01 bon-lap-srv01 polkitd[1006]: Registered Authentication Agent for unix-process:3867:1091339 (system bus name :1.51 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/fr
Dez 18 14:02:01 bon-lap-srv01 systemd[1]: Starting MongoDB Database Server...
-- Subject: Unidade mongod.service sendo iniciado
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- A unidade mongod.service está sendo iniciada.
Dez 18 14:02:01 bon-lap-srv01 mongod[3880]: 2018-12-18T14:02:01.128-0200 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
Dez 18 14:02:01 bon-lap-srv01 mongod[3880]: about to fork child process, waiting until server is ready for connections.
Dez 18 14:02:01 bon-lap-srv01 mongod[3880]: forked process: 3883
Dez 18 14:02:01 bon-lap-srv01 mongod[3880]: ERROR: child process failed, exited with error number 1
Dez 18 14:02:01 bon-lap-srv01 mongod[3880]: To see additional information in this output, start without the "--fork" option.
Dez 18 14:02:01 bon-lap-srv01 systemd[1]: mongod.service: control process exited, code=exited status=1
Dez 18 14:02:01 bon-lap-srv01 systemd[1]: Failed to start MongoDB Database Server.
-- Subject: A unidade mongod.service falhou
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- A unidade mongod.service falhou.
--
-- O resultado é failed.
Dez 18 14:02:01 bon-lap-srv01 systemd[1]: Unit mongod.service entered failed state.
Dez 18 14:02:01 bon-lap-srv01 systemd[1]: mongod.service failed.
Dez 18 14:02:01 bon-lap-srv01 polkitd[1006]: Unregistered Authentication Agent for unix-process:3867:1091339 (system bus name :1.51, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, loc
答案 0 :(得分:-1)
已解决
我在/ tmp文件夹中删除了一个名为“ mongodb-40017.sock”的文件,然后按预期工作。