반응형
[Getting ready]
# curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
# tar zxvf js-1.7.0.tar.gz
# cd js/src
# export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"
# make -f Makefile.ref
# JS_DIST=/usr make -f Makefile.ref export
* install scons, pcre-devel
# zypper in scons
# zypper in pcre-devel
* Packages needed for building mongo
<Fedora 8, 10, ...Opensuse 11, ...>
git, tcsh, scons, gcc-c++, glibc-devel
boost-devel pcre-devel js-devel readline-devel
boost-devel-static, readline-static ncurses-static
<Ubuntu 9.x>
tcsh git-core scons g++
libpcre++-dev libboost-dev libreadline-dev xulrunner-1.9.1-dev
libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev libboost-date-time-dev
[Building & installing]
* js와 mongodb-src-r1.x.x 가 동일한 directory에 위치하도록(mongo build시 ../js 를 참조함)
# scons all
# scons --prefix=/user/service/mongo install
* Enjoy huMONGOus document database
[Run mongo as an auto-start daemon]
* Make data & log directory for mongo
# mkdir /user/service/mongo/data
# mkdir /user/service/mongo/log
vi mongo
-----------------------------------------------------------------------------
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mongoDB
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the mongo database server daemon
# Description: Controls the main mongo database server daemon "mongod"
### END INIT INFO
#
# Copy this file to /etc/init.d & run commands below
# 1. Make symbolic link to /etc/rc[0-6].d/S??mongo
# 2. ln -s /etc/init.d/mongo /etc/rc[2345].d/S30mongo ==> start on boot(as to run level 2, 3, 4, 5
# 3. ln -s /etc/init.d/mongo /etc/rc[012].d/K30mongo ==> start on boot(as to run level 2, 3, 4, 5
#
export MONGO_HOME=/user/service/mongo
# Test if the file is executable, exits if not
test -x $MONGO_HOME/bin/mongod || exit 0
#
# main()
#
case "${1:-''}" in
'start')
# Start daemon
$MONGO_HOME/bin/mongod --auth --port 28017 --dbpath $MONGO_HOME/data/ --fork --logpath $MONGO_HOME/log/mongodb.log
;;
'stop')
pid=`ps -o pid,command ax | grep mongod | awk '!/awk/ && !/grep/ {print $1}'`
if [ "${pid}" != "" ]; then
echo "About to kill mongod ...";
echo "Pid: $pid";
sudo kill -2 ${pid};
fi
;;
'restart'|'reload'|'force-reload')
pid=`ps -o pid,command ax | grep mongod | awk '!/awk/ && !/grep/ {print $1}'`
if [ "${pid}" != "" ]; then
echo "About to kill '$1'...";
echo $pid;
sudo kill -2 ${pid};
fi
sleep 5
$MONGO_HOME/bin/mongod --auth --port 28017 --dbpath $MONGO_HOME/data/ --fork --logpath $MONGO_HOME/log/mongodb.log
;;
'status')
$MONGO_HOME/bin/mongod --sysinfo
;;
*)
echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
exit 1
;;
esac
-----------------------------------------------------------------------------
# chmod +x mongo
# cp mongo /etc/init.d
# chkconfig --add mongo
# chkconfig mongo ON
* Start by "/etc/init.d/mongo start" & have fun.
반응형
'Technical > DBMS' 카테고리의 다른 글
MySQL replication 수동 복구(Slave 동기화) #2 (0) | 2010.07.29 |
---|---|
MySQL 5.5.5m3 configure bug(Building MySQL 5.5.5m3) (0) | 2010.07.24 |
MySQL innotop 설치 & 사용(OpenSUSE 11.2 or Fedora 14, MySQL 5.1.44~5.5.4m3) (0) | 2010.07.22 |
MySQL ndbcluster & Replicator 설정 - help text (0) | 2010.06.25 |
MySQL 5.5.4m3 Source build & Installation on OpenSUSE 11.2 (0) | 2010.06.22 |