1. Installation
--------------------------------------------------------------------------------
# Add an installation Source
[Mongodb]
Name = MongoDB Repository
Base url = http://downloads-distro.mongodb.org/repo/RedHat/ OS /x86_64/
Gpgcheck = 0
Enabled = 1
# Yum Installation
Yum install-y mongo-10gen mongo-10gen-server
# Add to auto start upon startup
Chkconfig mongod on
2. start, stop, and restart the command
--------------------------------------------------------------------------------
Service Producer d start
Service producer D stop
Service producer D restart
3. Test
--------------------------------------------------------------------------------
Use mongoperf to view disk I/O performance # mongoperf-h
Usage:
Mongoperf <myjsonconfigfile
{
NThreads: <n>, // number of threads (default 1)
FileSizeMB: <n>, // test file size (default 1 MB)
SleepMicros: <n>, // pause for sleepMicros/nThreads between each operation (default 0)
Mmf: <bool>, // if true do I/o's via memory mapped files (default false)
R: <bool>, // do reads (default false)
W: <bool>, // do writes (default false)
RecSizeKB: <n>, // size of each write (default 4KB)
SyncDelay: <n> // secs between fsyncs, like -- syncdelay in synchronized D. (default 0/never)
}
Test:
[Root @ php1 ~] # Cat <jsonfile
{
NThreads: 1,
FileSizeMB: 1,
SleepMicros: 0,
Mmf: 'true ',
R: 'true ',
W: 'true ',
RecSizeKB: 4,
SyncDelay: 0
}
# Refer to Real world MongoDB benchmarks with benchRun
Https://blog.serverdensity.com/real-world-mongodb-benchmarks-with-benchrun/
Run 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
For more details, please continue to read the highlights on the next page:
MongoDB details: click here
MongoDB: click here
Recommended reading:
Java-based self-growth field in MongoDB
CentOS compilation and installation of MongoDB
CentOS compilation and installation of php extensions for MongoDB and mongoDB
CentOS 6 install MongoDB and server configuration using yum
Install MongoDB2.4.3 in Ubuntu 13.04
How to create a new database and set in MongoDB
MongoDB beginners must read (both concepts and practices)
MongoDB authoritative Guide (The Definitive Guide) in English [PDF]