Mongodb 安装错误汇总

  1. Failed to restart mongod.service: Unit mongod.service not found.

解决方法:

Most probably unit mongodb.service is masked. Use following command to unmask it.

sudo systemctl unmask mongodb

and re-run

sudo service mongod start

 

 1 vagrant@homestead:~$ sudo service mongod restart
 2 Failed to restart mongod.service: Unit mongod.service not found.
 3 vagrant@homestead:~$ ^C
 4 vagrant@homestead:~$ sudo systemctl unmask mongodb
 5 Removed symlink /etc/systemd/system/mongodb.service.
 6 vagrant@homestead:~$ sudo service mongod start
 7 vagrant@homestead:~$ sudo service mongod status
 8 ● mongod.service - MongoDB Database Server
 9    Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
10    Active: active (running) since Thu 2018-10-25 03:50:52 UTC; 5s ago
11      Docs: https://docs.mongodb.org/manual
12  Main PID: 6669 (mongod)
13     Tasks: 19
14    Memory: 37.9M
15       CPU: 85ms
16    CGroup: /system.slice/mongod.service
17            └─6669 /usr/bin/mongod --config /etc/mongod.conf
18 
19 Oct 25 03:50:52 homestead systemd[1]: Started MongoDB Database Server.
20 Oct 25 03:50:52 homestead mongod[6669]: 2018-10-25T03:50:52.045+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 spe
21 lines 1-13/13 (END)

 

相关知识点:

屏蔽和取消屏蔽单位

我们的服务管理部分如何停止或禁用服务所看到的,但systemd还具有自动或手动标记机作为完全无法启动,通过其链接到的能力/dev/null 。 这就是所谓的掩蔽单元,并且可能用mask命令:

sudo systemctl mask nginx.service

这将防止Nginx服务自动或手动启动,只要它被屏蔽。

如果选中list-unit-files ,你会看到该服务现已被列为蒙面:

systemctl list-unit-files
. . . kmod-static-nodes.service static ldconfig.service static mandb.service static messagebus.service static nginx.service masked quotaon.service static rc-local.service static rdisc.service disabled rescue.service static . . .

如果您尝试启动服务,您将看到如下所示的消息:

sudo systemctl start nginx.service
Failed to start nginx.service: Unit nginx.service is masked.

要再次揭露一个单元,使其可以使用,只要使用unmask命令:

sudo systemctl unmask nginx.service

这将使单元返回到先前的状态,允许它被启动或启用。

转载于:https://www.cnblogs.com/smallyi/p/9848995.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值