ubuntu 15.04上的mongodb 3每次重启后都必须手动启动mongod服务

时间:2015-06-06 09:01:35

标签: mongodb ubuntu-15.04

我曾经拥有mongodb 2.6.3并且mongod服务一直在工作。昨天我更新到mongodb 3.0.3,如果我在终端输入mongo,我得到这个:

2015-06-06T10:24:51.679+0200 W NETWORK  Failed to connect to     127.0.0.1:27017, reason: errno:111 Connection refused
2015-06-06T10:24:51.682+0200 E QUERY    Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
    at connect (src/mongo/shell/mongo.js:179:14)
    at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed

每次重启后我都必须service mongod start。有办法解决这个问题吗?

P.S。我被问到initctl list的输出,这里是:

gnome-keyring-gpg stop/waiting
indicator-application stop/waiting
unicast-local-avahi stop/waiting
update-notifier-crash stop/waiting
upstart-udev-bridge start/running, process 1766
jayatana stop/waiting
update-notifier-hp-firmware stop/waiting
xsession-init stop/waiting
dbus start/running, process 1775
update-notifier-cds stop/waiting
gnome-keyring-ssh stop/waiting
gnome-session (Unity) start/running, process 1852
ssh-agent stop/waiting
unity7 start/running, process 1857
unity-voice-service stop/waiting
upstart-dbus-session-bridge start/running, process 1810
indicator-messages start/running, process 2007
logrotate stop/waiting
indicator-bluetooth start/running, process 2008
unity-panel-service start/running, process 1859
hud start/running, process 1846
im-config start/running
notify-cgmanager stop/waiting
unity-gtk-module stop/waiting
session-migration stop/waiting
upstart-dbus-system-bridge start/running, process 1827
at-spi2-registryd start/running, process 1850
indicator-power start/running, process 2009
update-notifier-release stop/waiting
indicator-datetime start/running, process 2010
indicator-keyboard start/running, process 2011
unity-settings-daemon start/running, process 1848
indicator-sound start/running, process 2012
upstart-file-bridge start/running, process 1828
gnome-keyring stop/waiting
gnome-settings-daemon stop/waiting
window-stack-bridge start/running, process 1787
indicator-printers start/running, process 2014
re-exec stop/waiting
upstart-event-bridge stop/waiting
unity-panel-service-lockscreen stop/waiting
indicator-session start/running, process 2016

1 个答案:

答案 0 :(得分:0)

您的mongodb服务器未配置为自动启动。

在使用systemd的ubuntu上,你必须使用: systemctl enable mongodb

Here是一些官方文档