快速业务通道

mongodb安装配置

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-04-05

3.启动mongod

# /usr/local/mongodb-linux-x86_64-1.8.1/bin/mongod -f /usr/local/mongodb-linux-x86_64-1.8.1/etc/mongod.conf

4.自启动脚本

# vim /etc/init.d/mongod

#!/bin/bash

# mongod - Startup script for mongod

# chkconfig: 35 85 15

# description: Mongo is a scalable, document-oriented database.

# processname: mongod

. /etc/rc.d/init.d/functions

# things from mongod.conf get there by mongod reading it

OPTIONS=" -f /usr/local/mongodb-linux-x86_64-1.8.1/etc/mongod.conf"

SYSCONFIG="/etc/sysconfig/mongod"

mongod="/usr/local/mongodb-linux-x86_64-1.8.1/bin/mongod"

MONGO_USER=mongod

MONGO_GROUP=mongod

. "$SYSCONFIG" || true

start()

{

echo -n contentquot;Starting mongod: "

daemon --user "$MONGO_USER" $mongod $OPTIONS

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mongod

}

stop()

{

echo -n contentquot;Stopping mongod: "

killproc -p /www/data/mongo/mongod.lock -t30 -TERM $mongod

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/mongod

}

restart () {

stop

start

}

ulimit -n 12000

RETVAL=0

case "$1" in

start)

start

;;

stop)

stop

;;

restart|reload|force-reload)

restart

;;

condrestart)

[ -f /var/lock/subsys/mongod ] && restart || :

;;

status)

status $mongod

RETVAL=$?

;;

*)

echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"

RETVAL=1

esac

exit $RETVAL

# chmod x /etc/init.d/mongod

# chkconfig –add mongod

# chkconfig mongod on

# service mongod restart

日志信息如下:

Sat May 7 14:40:55 got kill or ctrl c or hup signal 15 (Terminated), will terminate after current cmd ends

Sat May 7 14:40:55 [interruptThread] now exiting

Sat May 7 14:40:55 dbexit:

Sat May 7 14:40:55 [interruptThread] shutdown: going to close listening sockets...

Sat May 7 14:40:55 [interruptThread] closing listening socket: 5

Sat May 7 14:40:55 [interruptThread] closing listening socket: 6

Sat May 7 14:40:55 [interruptThread] closing listening socket: 7

Sat May 7 14:40:55 [interruptThread] closing listening socket: 8

Sat May 7 14:40:55 [interruptThread] removing socket file: /tmp/mongodb-27017.sock

Sat May 7 14:40:55 [interruptThread] removing socket file: /tmp/mongodb-28017.sock

Sat May 7 14:40:55 [interruptThread] shutdown: going to flush diaglog...

Sat May 7 14:40:55 [interruptThread] shutdown: going to close sockets...

Sat May 7 14:40:55 [interruptThread] shutdown: waiting for fs preallocator...

Sat May 7 14:40:55 [interruptThread] shutdown: closing all files...

Sat May 7 14:40:55 closeAllFiles() finished

Sat May 7 14:40:55 [interruptThread] shutdown: removing fs lock...

Sat May 7 14:40:55 dbexit: really exiting now

Sat May 7 14:40:55 [initandlisten] MongoDB starting : pid=20495 port=27017 dbpath=/www/data/mongo 64-bit

Sat May 7 14:40:55 [initandlisten] db version v1.8.1, pdfile version 4.5

Sat May 7 14:40:55 [initandlisten] git version: a429cd4f535b2499cc4130b06ff7c26f41c00f04

Sat May 7 14:40:55 [initandlisten] build sys info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41

Sat May 7 14:40:55 [initandlisten] waiting for connections on port 27017

Sat May 7 14:40:55 [websvr] web admin interface listening on port 28017

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号