ubuntuにmongodbをインストール
1.インストールコマンド:
#!/bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mongodb
# Description: mongo db server
### END INIT INFO
export LC_ALL="C"
. /lib/lsb/init-functions
PROGRAM=/opt/mongodb/bin/mongod
MONGOPID=`ps -ef | grep 'mongod’ | grep -v grep | awk '{print $2}’`
test -x $PROGRAM || exit 0
case “$1" in
start)
log_begin_msg “Starting MongoDB server"
#/usr/bin/mongod –fork –quiet –dbpath /data/db –logpath /var/log/mongodb.log
/opt/mongodb/bin/mongod –fork –quiet -journal -maxConns=2400 -rest –dbpath=/opt/mongdb –logpath /usr/local/src/data/mongodb/journal/mongdb.log
log_end_msg 0
;;
stop)
log_begin_msg “Stopping MongoDB server"
if [ ! -z “$MONGOPID" ]; then
kill -15 $MONGOPID
fi
log_end_msg 0
;;
status)
;;
*)
log_success_msg “Usage: /etc/init.d/mongodb {start|stop|status}"
exit 1
esac
exit 0
#
sudo chmod +x /etc/init.d/mongdb
2.ファイルを編集する
vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
#
export LC_ALL="C" ローカル設定を削除