Xenial升级后,Mongo无法启动

时间:2019-02-16 17:52:20

标签: mongodb ubuntu

我刚刚完成了将DigitalOcean Droplet从Ubuntu 14.04升级到16.04的操作,但是现在我在启动mongodb时遇到了麻烦。这是我尝试启动服务时收到的错误:

# systemctl status mongod.service
● mongod.service
   Loaded: loaded (/etc/init.d/mongod; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-02-16 12:49:28 EST; 17s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3800 ExecStart=/etc/init.d/mongod start (code=exited, status=1/FAILURE)

Feb 16 12:49:28 anthony-calandra mongod[3800]: Rather than invoking init scripts through /etc/init.d, use the service(8)
Feb 16 12:49:28 anthony-calandra mongod[3800]: utility, e.g. service mongod start
Feb 16 12:49:28 anthony-calandra mongod[3800]: initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connec
Feb 16 12:49:28 anthony-calandra mongod[3800]: Since the script you are attempting to invoke has been converted to an
Feb 16 12:49:28 anthony-calandra mongod[3800]: Upstart job, you may also use the start(8) utility, e.g. start mongod
Feb 16 12:49:28 anthony-calandra mongod[3800]: start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connecti
Feb 16 12:49:28 anthony-calandra systemd[1]: mongod.service: Control process exited, code=exited status=1
Feb 16 12:49:28 anthony-calandra systemd[1]: Failed to start mongod.service.
Feb 16 12:49:28 anthony-calandra systemd[1]: mongod.service: Unit entered failed state.
Feb 16 12:49:28 anthony-calandra systemd[1]: mongod.service: Failed with result 'exit-code'.

如果您需要更多信息,请告诉我。

1 个答案:

答案 0 :(得分:0)

解决了我的问题。我安装了奇怪的mongo,因此我将其删除:

sudo apt-get purge mongodb-org*

然后,我按照本教程安装最新版本:https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04

然后我遇到错误消息:“无法启动mongod.service:未找到单元mongod.service”。原来该服务已被禁用,因此我遵循了以下指南:https://stackoverflow.com/a/53553652/3229983

服务看起来不错:

# sudo systemctl status mongod
● mongod.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-02-16 13:08:19 EST; 7s ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 5711 (mongod)
   CGroup: /system.slice/mongod.service
           └─5711 /usr/bin/mongod --quiet --config /etc/mongod.conf

Feb 16 13:08:19 anthony-calandra systemd[1]: Started High-performance, schema-free document-oriented database.

现在我的Web应用程序开始运行。