我需要帮助找到我在最近的升级中搞砸了什么。Ubuntu 14.04上的MongoDB 3.2似乎没有读取/etc/mongod.conf
在我的Ubuntu 14.04系统,我最近肃清所有的mongod,组织
# apt-get purge mongod-org
# apt-get autoremove
然后安装,通过蒙戈的指示,(得到了新的键添加3.2源)
# apt-get update
# apt-get mongodb-org
一切出现安装好。因此,让我们启动它:
# service mongod start
mongod start/running, process 18811
# ps -ef | grep 18811
#
换句话说,将不会启动。没有写入mongod.log所以让我们尝试命令行!
# mongod
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] MongoDB starting : pid=18816 port=27017 dbpath=/data/db 64-bit host=as3001snllx
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] db version v3.2.3
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] allocator: tcmalloc
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] modules: none
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] build environment:
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] distmod: ubuntu1404
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] distarch: x86_64
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] target_arch: x86_64
2016-03-03T09:46:42.104-0700 I CONTROL [initandlisten] options: {}
2016-03-03T09:46:42.145-0700 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2016-03-03T09:46:42.145-0700 I CONTROL [initandlisten] dbexit: rc: 100
AH HAH!没有/ data/db目录!但是,我有/etc/mongod.conf据说指向“/ var/lib/mongodb”。
这里的/etc/mongod.conf
$ cat /etc/mongod.conf
storage:
dbPath: "/var/lib/mongodb"
engine: "wiredTiger"
journal:
enabled: true
systemLog:
destination: file
path: "/var/log/mongodb/mongod.log"
logAppend: true
net:
bindIp: 127.0.0.1
port: 27017
所以,也许我的新贵配置不读这个配置文件,因为/数据/ db是默认设置。但是,我的/etc/init/mongod.conf有一个指令,可以读取/etc/mongod.conf。
我/etc/init/mongod.conf文件
# Ubuntu upstart file at /etc/init/mongod.conf
# Recommended ulimit values for mongod or mongos
# See http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
#
limit fsize unlimited unlimited
limit cpu unlimited unlimited
limit as unlimited unlimited
limit nofile 64000 64000
limit rss unlimited unlimited
limit nproc 64000 64000
kill timeout 300 # wait 300s between SIGTERM and SIGKILL.
pre-start script
DAEMONUSER=${DAEMONUSER:-mongodb}
if [ ! -d /var/lib/mongodb ]; then
mkdir -p /var/lib/mongodb && chown mongodb:mongodb /var/lib/mongodb
fi
if [ ! -d /var/log/mongodb ]; then
mkdir -p /var/log/mongodb && chown mongodb:mongodb /var/log/mongodb
fi
touch /var/run/mongodb.pid
chown $DAEMONUSER /var/run/mongodb.pid
end script
start on runlevel [2345]
stop on runlevel [06]
script
ENABLE_MONGOD="yes"
CONF=/etc/mongod.conf
DAEMON=/usr/bin/mongod
DAEMONUSER=${DAEMONUSER:-mongodb}
DAEMONGROUP=${DAEMONGROUP:-mongodb}
if [ -f /etc/default/mongod ]; then . /etc/default/mongod; fi
# Handle NUMA access to CPUs (SERVER-3574)
# This verifies the existence of numactl as well as testing that the command works
NUMACTL_ARGS="--interleave=all"
if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls/>/dev/null 2>/dev/null
then
NUMACTL="$(which numactl) -- $NUMACTL_ARGS"
DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}
else
NUMACTL=""
DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}
fi
if [ "x$ENABLE_MONGOD" = "xyes" ]
then
exec start-stop-daemon --start \
--chuid $DAEMONUSER:$DAEMONGROUP \
--pidfile /var/run/mongodb.pid \
--make-pidfile \
--exec $NUMACTL $DAEMON $DAEMON_OPTS --setParameter failIndexKeyTooLong=false
fi
end script
所以,让我们试着从从命令行启动的mongod --config与/etc/init.d中
# mongod --config /etc/mongod.conf
这工作。但是,我需要这个通过暴发户工作!有任何想法吗?