I used to use MongoDB, in the evening check the need for the command, about how MongoDB how to use, I do not know
Official website: http://www.mongodb.org/
MongoDB installation, master-slave configuration
One MongoDB installation
Click ( here) to collapse or open
- [[email protected]_server Src]# wget http://fastdl.mongodb. Org/linux/mongodb-linux -x86_64-2.0.0.tgz
- [email protected]_server src]# tar xzvf mongodb-linux-x86_64-2. 0. 0. tgz
- [email protected]_server src]# mv MongoDB-linux-x86_64-2. 0. 0/usr/Local /mongodb
- [email protected]_server src]# mkdir/usr/local/mongodb/data
- [email protected]_server src]# touch/usr/local/mongodb/logs
- [[Email Protected]_server bin]#/usr/local/mongodb/bin/mongod --dbpath =/usr/local/mongodb/data --logpath =/usr/local/mongodb/logs --logappend --port=27017 --fork
- [Email Protected]_server bin]# . /mongo
- MongoDB Shell version: 2. 0. 0
- Connecting to: test
- > Use test;
- Switched to DB test
- > Exit
- Bye
- [Email Protected]_server bin]# netstat -anlpt | grep mongo
- TCP 0 0 0. 0. 0. 0: 27017 0. 0. 0. 0:* LISTEN 11504/mongod
- TCP 0 0 0. 0. 0. 0: 28017 0. 0. 0. 0:* LISTEN 11504/mongod
Note: If an error -bash:/usr/local/mongodb/bin/mongod:cannot Execute binary file description of your server and MongoDB version does not correspond, if the server is 64-bit, download x86_64 MongoDB, if the server is 32-bit, download i686 mongodb/
The installation method references the http://blog.chinaunix.net/uid-24250828-id-3770298.html
Set up your account,
It's best to set it up without--auth.
Use admin
Db.adduser ("name", "passwd")
Db.auth ("name", "passwd") if Output 1 is correct
In the service, then you have to add an account to each library,
Use logs
Db.adduser ("name", "passwd").
And then it's the master and slave.
If you install MongoDB by the method above. Then just need to put the entire MongoDB file, rsync to another server,
And then when you start adding configuration options, that's easy to say.
Due to the addition of accounts, authentication is required to use the--keyfile option for master-slave copy.
Master and slave Two inside of the file to the same, specific crossing Internet cafes http://docs.mongodb.org/manual/core/master-slave/# Configuration-options-for-master-slave-deployments
Note chmod keyfile will not error child process failed, exited with error number 1
And then it's time to start, just fill in the options.
Main/usr/local/mongodb/bin/mongod--auth--master--dbpath=/usr/local/mongodb/data--logpath=/usr/local/mongodb/logs/ Mongodb.log--logappend--port=27017--fork
From--keyfile=/usr/local/mongodb/bin/mongod--auth--slave--source 192.168.10.36:27017--dbpath=/usr/local/mongodb/ Data--logpath=/usr/local/mongodb/logs/mongodb.log--logappend--port=27017--fork--keyfile=/usr/local/mongodb/ Keyfile/usr/local/mongodb/keyfile
192.168.10.37-based IP address
And then it's ready. You can add a data to the Lord and look it up from the top.
There are errors, look at the log
Stop MongoDB is the boot configuration option, fill in the previous--shutdown
MongoDB installation and, set up accounts, master and slave