日期:2014-05-16 浏览次数:20402 次
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-1.8.4.tgz
tar -zxvf mongodb-linux-x86_64-1.8.4.tgz mv mongodb-linux-i686-1.8.4 /opt/mongodb/node1/monmongodb-linux-i686-1.8.4
mkdir /data/mongodb/dbs/node1 -p
mkdir /data/mongodb/logs/node1 -p touch /data/mongodb/logs/node1/log
dbpath=/data/mongodb/dbs/node1 fork=true logpath=/data/mongodb/logs/node1/log logappend=true rest=true port=27001 # replSet=replSet/192.168.1.254:27002,replSet/192.168.1.253:27001 # auth=true
/opt/mongodb/node1/mongodb-linux-i686-1.8.4/bin/mongod --config /opt/mongodb/node1/mongodb-linux-i686-1.8.4/config/initConfig
PIDS=$(ps aux | grep mongo | tr -s ' ' '|' | cut -d '|' -f 2) for PID in $PIDS do kill -2 $PID echo shutdown mongodb process done
/opt/mongodb/node1/mongodb-linux-i686-1.8.4/bin/mongod --config /opt/mongodb/node1/mongodb-linux-i686-1.8.4/config/initConfig
sudo vi /etc/sysconfig/iptables sudo /sbin/service iptables restart
/opt/mongodb/node1/mongodb-linux-i686-1.8.4/bin/mongo $host:$port/admin rs.initiate() rs.add("$anotherHost:$port");
use admin db.addUser("root", "xxxx") use appdb db.addUser("admin", "xxxx") db.addUser("readonly", "xxxx", true)