# yum install -y openssl-devel openssl
# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.2.1.tgz
# tar xzvf mongodb-linux-x86_64-rhel62-3.2.1.tgz -C /home/nosql
# mv /home/nosql/mongodb-linux-x86_64-rhel62-3.2.1 /home/nosql/mongodb
设置ulimit -n和ulimit -u的值大于20000。如果ulimit的值设置过低的话,当MongoDB处于 频繁访问的状态下,将会产生错误,最终导致无法连接到MongoDB实例。
# ulimit -n 25000
# ulimit -u 25000
# cd /home/nosql/mongodb/bin/
# vi mongodb.conf
port=27017 #端口
dbpath=/home/nosql/data/mongodb #数据文件存放目录
logpath=/home/nosql/data/logs/mongodb.log #日志文件
logappend=true #使用追加的方式写日志
fork=true #以守护程序的方式启用,即在后台运行
bind_ip=127.0.0.1,192.168.137.1 #绑定本机ip
noauth=true #不启用验证
nohttpinterface=true
rest=false
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT
/etc/init.d/iptables restart
# /home/nosql/mongodb/bin/mongod --config /home/nosql/mongodb/bin/mongodb.conf
或
# /home/nosql/mongodb/bin/mongod -f /home/nosql/mongodb/bin/mongodb.conf
# ps aux | grep mongod
# kill -2 PID
或
# /home/nosql/mongodb/bin/mongo
> use admin
> db.shutdownServer();
2015-03-19T00:43:27.760+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-03-19T00:43:27.760+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
# vi /etc/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
# vi /etc/rc.d/rc.local
rm -rf /home/nosql/mongodb/mongod.lock
/home/nosql/mongodb/bin/mongod -f /home/nosql/mongodb/bin/mongodb.conf
mongodb的NUMA问题 NUMA是什么?为什么使用NUMA? mongodb日志显示如下: WARNING: You are running on a NUMA machine. We suggest launching mongod like this to avoid performance problems: numactl –interleave=all mongod [other options] * 解决方案:
http://www.mongodb.org/display/DOCS/NUMA
linux版本: wget https://cdn.3t.io/mongochef/linux/3.3.0.1717/mongochef-linux-x86-dist.tar.gz
喜欢 (0)or分享 (0)