# mongod.conf# for documentation of all options, see:# http://docs.mongodb.org/manual/reference/configuration-options/# Where and how to store data.
storage:
dbPath: /var/lib/mongodb-one
journal:
enabled: true# engine:# mmapv1:# wiredTiger:# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod-one.log
# network interfaces
net:
port: 27018
bindIp: 127.0.0.1
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#security:#operationProfiling:#replication:
replication:
replSetName: rs0
#sharding:## Enterprise-Only Options:#auditLog:#snmp:
四、复制启动/etc/init/mongod.conf配置
sudocp /etc/init/mongod.conf /etc/init/mongod-one.conf
# mongod-one.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
limit memlock unlimited unlimited
killtimeout 300 # wait 300s between SIGTERM and SIGKILL.
pre-start script
DAEMONUSER=${DAEMONUSER:-mongodb}if[! -d /var/lib/mongodb-one ];thenmkdir -p /var/lib/mongodb-one &&chown mongodb:mongodb /var/lib/mongodb-one
fiif[! -d /var/log/mongodb ];thenmkdir -p /var/log/mongodb &&chown mongodb:mongodb /var/log/mongodb
fitouch /var/run/mongodb-one.pid
chown$DAEMONUSER /var/run/mongodb-one.pid
end script
start on runlevel [2345]
stop on runlevel [06]
script
ENABLE_MONGOD="yes"
CONF=/etc/mongo/mongod-one.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"ifwhich numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGSls / >/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"}fiif["x$ENABLE_MONGOD"="xyes"]thenexec start-stop-daemon --start \
--chuid $DAEMONUSER:$DAEMONGROUP \
--pidfile /var/run/mongodb-one.pid \
--make-pidfile \
--exec $NUMACTL$DAEMON$DAEMON_OPTSfi
end script