一、安装PCRE库 yum install pcre-devel 或者到ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/下载合适的pcre源码包,然后configure/make/make install 二、安装Spider Monkey库 export CFLAGS=”-DJS_C_STRINGS_ARE_UTF8″ make -f Makefile.ref JS_DIST=/usr make -f Makefile.ref export 三、安装SCons python setup.py install 四、安装MongoDB scons all scons –prefix=/usr/local/mongodb install 如果想要头文件和lib包,执行 scons –prefix=/usr/local/mongodb –full install 五,让MongoDB跑起来 vim /usr/local/mongodb/config/mongodb #Directory and relavent set dbpath = /usr/local/mongodb/data logpath = /usr/local/mongodb/log/mongodb.log repairpath = /usr/local/mongodb/repair pidfilepath = /usr/local/mongodb/mongodb.pid directoryperdb = true #sysinfo = true #verbose = true logappend = true #cpu = true #Network and security set noauth = true port = 8888 maxConns = 1024 fork = true #Management #nohttpinterface = true rest = true quota = true quotaFiles = 1024 nssize = 16 #syncdelay = 5 值得注意的是,类似 nohttpinterface = false 的配置是无效的。因为这些选项默认为false,不需要配置。 运行MongDB: mongod –config /usr/local/mongodb/config/mongodb 启动脚本 mongodb-start.sh #!/bin/sh /usr/local/mongodb/bin/mongod --config /usr/local/mongodb/config/mongodb ## --upgrade \ ##runs a database upgrade option if needed \ 关闭脚本 mongodb-stop.sh #!/bin/bash pid=`ps -o pid,command ax | grep mongod | awk '!/awk/ && !/grep/ {print $1}'`; if [ "${pid}" != "" ]; then kill -2 ${pid}; fi 六,做服务 启动脚本init-rpm.sh #! /bin/sh # # mongodb – this script starts and stops the mongodb daemon # # chkconfig: - 85 15 # description: MongoDB is a non-relational database storage system. # processname: mongodb # config: /opt/config/mongodb # pidfile: /opt/mongodb/mongo.pid PATH=/opt/mongodb/bin:/sbin:/bin:/usr/sbin:/usr/bin NAME=mongodb test -x $DAEMON || exit 0 set -e case "$1" in start) echo -n "Starting MongoDB... " su - mongodb -c "/opt/bin/mongodb-start" ;; stop) echo -n "Stopping MongoDB" /opt/bin/mongodb-stop ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop}" >&2 exit 1 ;; esac exit 0 把以上启动脚本做成服务 #mv init-rpm.sh /etc/init.d/mongodb #chmod +x /etc/init.d/mongodb #chkconfig --add mongodb #chkconfig -–level 345 mongodb on
MongoDB与sql语句对照表
http://www./?p=849 |
|