centos7 启动MongoDB 4.0 失败问题

1. 首先检查文件  /etc/systemd/system/mongodb.service  是否存在,不存在则创建。

2. 查看内容:

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=root
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

重点是在 User=root(因为我登录的用户是root)。网贴上好多是  User=mongodb,导致启动失败。应该修改为相应用户。

3. 启动时遇到的错误信息:

systemctl status mongodb
● mongodb.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2018-09-11 14:33:14 CST; 18s ago
  Process: 65076 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=217/USER)
 Main PID: 65076 (code=exited, status=217/USER)

Sep 11 14:33:14 localhost.localdomain systemd[1]: Started High-performance, schema-free document-oriented database.
Sep 11 14:33:14 localhost.localdomain systemd[1]: Starting High-performance, schema-free document-oriented database...
Sep 11 14:33:14 localhost.localdomain systemd[1]: mongodb.service: main process exited, code=exited, status=217/USER
Sep 11 14:33:14 localhost.localdomain systemd[1]: Unit mongodb.service entered failed state.
Sep 11 14:33:14 localhost.localdomain systemd[1]: mongodb.service failed.

4. 修改 文件后,执行 

systemctl daemon-reload

systemctl start mongodb

systemctl status mongodb

 

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值