1、安装
--------------------------------------------------------------------------------
#添加安装源
#yum 安装
yum install -y mongo-10gen mongo-10gen-server
#添加到开机自动启动
chkconfig mongod on
2、启动,停止,重启命令
--------------------------------------------------------------------------------
service mongod start
service mongod stop
service mongod restart
3、测试
--------------------------------------------------------------------------------
使用mongoperf 查看磁盘IO性能#mongoperf -h
usage:
mongoperf < myjsonconfigfile
{
nThreads:
fileSizeMB:
sleepMicros:
mmf:
r:
w:
recSizeKB:
syncDelay:
}
进行测试:
[root@php1 ~]# cat
nThreads:1,
fileSizeMB:1,
sleepMicros:0,
mmf:'true',
r:'true',
w:'true',
recSizeKB:4,
syncDelay:0
}
#参考Real world MongoDB benchmarks with benchRun
https://blog.serverdensity.com/real-world-mongodb-benchmarks-with-benchrun/
运行mongo
#mongo
>db.foo.insert( { _id : 1 } )
>ops = [{ op :"findOne", ns :"test.foo", query : { _id : 1 } }, { op :"update", ns :"test.foo", query : { _id : 1 } , update : { $inc : { x : 1 } } } ]
[
{
"op":"findOne",
"ns":"test.foo",
"query": {
"_id": 1
}
},
{
"op":"update",
"ns":"test.foo",
"query": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
}
}
]
>for( x = 1; x<=128; x*=2){
... res = benchRun( { parallel : x ,
... seconds : 5 ,
... ops : ops
... } )
... print("threads: "+ x +"\t queries/sec: "+ res.query )
... }
threads: 1 queries/sec: 7886.8
threads: 2 queries/sec: 12786.2
threads: 4 queries/sec: 14891.2
threads: 8 queries/sec: 16361.2
threads: 16 queries/sec: 19811.6
threads: 32 queries/sec: 18343.8
threads: 64 queries/sec: 26470.4
threads: 128 queries/sec: 36110.4
推荐阅读: