下载mongodb-linux-x86_64-2.6.4.tgz
# tar zxvf mongodb-linux-x86_64-2.6.4.tgz
# mv mongodb-linux-x86_64-2.6.4 /mongodb
# chown -R root.root /mongodb
# mkdir -p /mdb /mdb/log
# ln -s /mongodb/bin/* /usr/bin/
# vi /mongodb/mongod.conf
-
dbpath = /mdb
-
logpath = /mdb/log/mongod.log
# vi /etc/init.d/mongodb
-
#!/bin/bash
-
#
-
#chkconfig: 2345 80 90
-
#description
-
start(){
-
/mongodb/bin/mongod --config /mongodb/mongod.conf &
-
}
-
-
-
stop(){
-
/mongodb/bin/mongod --config /mongodb/mongod.conf --shutdown;rm -rf /mdb/mongod.lock
-
}
-
-
-
case "$1" in
-
start)
-
start
-
;;
-
-
-
stop)
-
stop
-
;;
-
-
-
restart)
-
stop
-
start
-
;;
-
*)
-
echo
-
$"Usage: $0 {start|stop|restart}"
-
exit 1
-
esac
# chmod +x /etc/init.d/mongodb
# chkconfig --add mongodb
# chkconfig mongodb on
#service mongodb start
阅读(3335) | 评论(0) | 转发(0) |