mongod.service:步骤USER产生失败/ usr / bin / mkdir:没有这样的过程

时间:2018-03-05 05:53:40

标签: mongodb ubuntu-16.04

我正在运行os Ubuntu 16.04的ec2实例。

我最近尝试将我的mongodb从3.2升级到3.6。

我试图运行sudo service mongod start并且mongod服务无法启动。

以下是错误消息。

mongod.service - High-performance, schema-free document-oriented 

database
   Loaded: loaded (/etc/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2018-03-05 05:48:12 UTC; 11s ago
     Docs: https://docs.mongodb.org/manual
  Process: 18587 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=217/USER)
 Main PID: 16567 (code=exited, status=100)

Mar 05 05:48:12 ip-172-31-18-34 systemd[1]: Starting High-performance, schema-free document-oriented database...
Mar 05 05:48:12 ip-172-31-18-34 systemd[18587]: mongod.service: Failed at step USER spawning /usr/bin/mkdir: No such proc
Mar 05 05:48:12 ip-172-31-18-34 systemd[1]: mongod.service: Control process exited, code=exited status=217
Mar 05 05:48:12 ip-172-31-18-34 systemd[1]: Failed to start High-performance, schema-free document-oriented database.
Mar 05 05:48:12 ip-172-31-18-34 systemd[1]: mongod.service: Unit entered failed state.
Mar 05 05:48:12 ip-172-31-18-34 systemd[1]: mongod.service: Failed with result 'exit-code'.

我从未编辑过一行默认的mongod.service文件。

如何解决此问题?

4 个答案:

答案 0 :(得分:1)

如果您刚刚从某处复制了mongod.service文件,则应在User部分中编辑[Service]

答案 1 :(得分:0)

Changing ownership of "/var/lib/mongodb" directory worked for me
Command to change ownership:
"sudo chown -R mongodb:mongodb /var/lib/mongodb"

**Old response:**
$ sudo systemctl status mongodb
● mongodb.service - MongoDB Database
   Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-07-31 18:52:49 IST; 17h ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 13728 (code=exited, status=217/USER)

Jul 31 18:52:49 LAP-LIN-712 systemd[1]: Started MongoDB Database.
Jul 31 18:52:49 LAP-LIN-712 systemd[13728]: mongodb.service: Failed to determine user credentials: No such process
Jul 31 18:52:49 LAP-LIN-712 systemd[13728]: mongodb.service: Failed at step USER spawning /usr/bin/mongod: No such process
Jul 31 18:52:49 LAP-LIN-712 systemd[1]: mongodb.service: Main process exited, code=exited, status=217/USER
Jul 31 18:52:49 LAP-LIN-712 systemd[1]: mongodb.service: Failed with result 'exit-code'.

**New Response:**
$ sudo systemctl status mongodb
● mongodb.service - MongoDB Database
   Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-08-01 11:54:10 IST; 8s ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 8143 (mongod)
    Tasks: 20 (limit: 4915)
   CGroup: /system.slice/mongodb.service
           └─8143 /usr/bin/mongod --quiet --config /etc/mongod.conf

答案 2 :(得分:0)

/usr/bin/mongod - No such process. --->此错误表示您已将mongod二进制文件放置在其他路径中,而不是默认路径中。尝试更改mongod.service文件中的路径,然后使用service start mongodb

重新尝试

答案 3 :(得分:0)

对我来说,它通过注释服务文件中的“用户”和“组”指令来解决,如here所述。 我希望它能对某人有所帮助。