centos MongoDB无法启动

bybem2ql  于 12个月前  发布在  Go
关注(0)|答案(1)|浏览(167)

我在启动mongodb时遇到了这样一个错误,

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 Fri 2023-12-22 16:36:41 +03; 2s ago
     Docs: https://docs.mongodb.org/manual
  Process: 1525 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=14)
  Process: 1522 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
  Process: 1520 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
  Process: 1518 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)

Dec 22 16:36:40 86233-56428 systemd[1]: Starting MongoDB Database Server...
Dec 22 16:36:41 86233-56428 mongod[1525]: about to fork child process, waiting until server is ready...ons.
Dec 22 16:36:41 86233-56428 mongod[1525]: forked process: 1528
Dec 22 16:36:41 86233-56428 mongod[1525]: ERROR: child process failed, exited with error number 14
Dec 22 16:36:41 86233-56428 mongod[1525]: To see additional information in this output, start withou...ion.
Dec 22 16:36:41 86233-56428 systemd[1]: mongod.service: control process exited, code=exited status=14
Dec 22 16:36:41 86233-56428 systemd[1]: Failed to start MongoDB Database Server.
Dec 22 16:36:41 86233-56428 systemd[1]: Unit mongod.service entered failed state.
Dec 22 16:36:41 86233-56428 systemd[1]: mongod.service failed.


我遇到了这个错误。
我尝试了许多解决方案,但他们不工作。我改变了文件权限,它仍然不工作。我重新安装,仍然是相同的结果。
这些是/var/log/mongod. log记录

2023-12-22T17:17:28.660+0300 I CONTROL  [main] ***** SERVER RESTARTED *****
2023-12-22T17:17:28.678+0300 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2023-12-22T17:17:28.836+0300 I CONTROL  [initandlisten] MongoDB starting : pid=1049 port=27017 dbpath=/var/lib/mongo 64-bit host=86233-56428
2023-12-22T17:17:28.836+0300 I CONTROL  [initandlisten] db version v4.0.28
2023-12-22T17:17:28.836+0300 I CONTROL  [initandlisten] git version: af1a9dc12adcfa83cc19571cb3faba26eeddac92
2023-12-22T17:17:28.836+0300 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
2023-12-22T17:17:28.836+0300 I CONTROL  [initandlisten] allocator: tcmalloc
2023-12-22T17:17:28.836+0300 I CONTROL  [initandlisten] modules: none
2023-12-22T17:17:28.836+0300 I CONTROL  [initandlisten] build environment:
2023-12-22T17:17:28.836+0300 I CONTROL  [initandlisten]     distmod: rhel70
2023-12-22T17:17:28.836+0300 I CONTROL  [initandlisten]     distarch: x86_64
2023-12-22T17:17:28.836+0300 I CONTROL  [initandlisten]     target_arch: x86_64
2023-12-22T17:17:28.837+0300 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid", timeZoneInfo: "/usr/share/zoneinfo" }, security: { authorization: "enabled" }, storage: { dbPath: "/var/lib/mongo", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2023-12-22T17:17:28.848+0300 I STORAGE  [initandlisten] exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /var/lib/mongo, terminating
2023-12-22T17:17:28.848+0300 I CONTROL  [initandlisten] Shutdown started
2023-12-22T17:17:28.848+0300 I REPL     [initandlisten] Stepping down the ReplicationCoordinator for shutdown, waitTime: 10000ms
2023-12-22T17:17:28.848+0300 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2023-12-22T17:17:28.848+0300 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2023-12-22T17:17:28.848+0300 I NETWORK  [initandlisten] Shutting down the global connection pool
2023-12-22T17:17:28.848+0300 I -        [initandlisten] Killing all operations for shutdown
2023-12-22T17:17:28.848+0300 I NETWORK  [initandlisten] Shutting down the ReplicaSetMonitor
2023-12-22T17:17:28.848+0300 I CONTROL  [initandlisten] Shutting down free monitoring
2023-12-22T17:17:28.849+0300 I FTDC     [initandlisten] Shutting down full-time data capture
2023-12-22T17:17:28.849+0300 I STORAGE  [initandlisten] Shutting down the HealthLog
2023-12-22T17:17:28.849+0300 I -        [initandlisten] Dropping the scope cache for shutdown
2023-12-22T17:17:28.849+0300 I CONTROL  [initandlisten] now exiting
2023-12-22T17:17:28.849+0300 I CONTROL  [initandlisten] shutting down with code:100

zpqajqem

zpqajqem1#

This page将帮助您自我诊断您将来看到的退出代码(14和100)。
您的问题中列出了相关的异常。--dbpath目录不存在,无法为尝试运行二进制文件的用户提供正确的权限。
由于您正在systemctl下运行,请查看该服务的配置。默认情况下,它将使用root作为系统服务。请考虑以非root用户身份运行mongod,并确保dbpath目录具有该用户的写入权限。相关MongoDB docs page

相关问题