日期:2014-05-16 浏览次数:20409 次
cd /tmp/soft/ wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-1.8.2.tgz tar zxvf mongodb-linux-x86_64-1.8.2.tgz sudo mkdir -p /data/mongodb/ sudo chown `id -u` /data/mongodb sudo mv /tmp/soft/mongodb-linux-x86_64-1.8.2/* /opt/mongodb
#!/bin/bash if [ $# != 0 ];then port=$1; else port=27017 fi mkdir -p /opt/mongodb/data_$port /opt/mongodb/bin/mongod --dbpath=/opt/mongodb/data_$port --logpath=/opt/mongodb/mongodb_$port.log --logappend --port=$port > /dev/null 2>&1 & echo "start mongodb port:$port"
#!/bin/bash if [ $# != 0 ];then port=$1; else port=27017 fi pid=`ps -o pid,command ax | grep mongod | grep $port | awk '!/awk/ && !/grep/ {print $1}'`; if [ "${pid}" != "" ]; then kill -2 ${pid}; fi echo "stop mongodb port:$port"