mongodb 安装:
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.8.tgz
tar zxf mongodb-linux-x86_64-2.4.8.tgz
cd mongodb-linux-x86_64-2.4.8/bin
cp -a * /usr/local/bin/
/usr/bin/numactl --interleave=all /usr/local/bin/mongod --dbpath /data/mongodb --logpath /data/mongodb/logs/mongod.log --logappend
异常处理:
WARNING: You are running on a NUMA machine.
We suggest launching mongod like this to avoid performance problems:
numactl –interleave=all mongod [other options]
解决方案:
1.在原启动命令前面加numactl –interleave=all
如# /usr/bin/numactl --interleave=all /usr/local/bin/mongod --dbpath /data/mongodb --logpath /data/mongodb/logs/mongod.log --logappend
2.修改内核参数
echo 0 > /proc/sys/vm/zone_reclaim_mode
# mongo localhost:27017
MongoDB shell version: 2.4.8
connecting to: localhost:27017/test
> show dbs;
admin 0.203125GB
local 0.078125GB
test (empty)
> use testdb
switched to db testdb
> db.addUser("testuser","123456")
{
"user" : "3testuser",
"readOnly" : false,
"pwd" : "311dc983e8712fdcba549253671d70",
"_id" : ObjectId("528235f4d74071d0aefe15ab")
}
> show dbs
admin 0.203125GB
testdb 0.203125GB
local 0.078125GB
test (empty)
> exit
bye
nginx-gridfs 安装:
yun -y install git
git clone git://github.com/mdirolf/nginx-gridfs.git
cd nginx-gridfs
git checkout v0.8
git submodule init
git submodule update
重新编译nginx :
https://github.com/agentzh/headers-more-nginx-module/tree/v0.23
隐藏web服务器版本:--add-module=/opt/software/headers-more-nginx-module-0.23
./configure --user=nginx --group=app --prefix=/app/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_concat_module --with-http_upstream_check_module --with-http_sub_module --with-http_realip_module--add-module=/opt/software/headers-more-nginx-module-0.23 --add-module=/opt/software/nginx-gridfs
make
make install