MongoDB deployment experiment series of articles, MongoDB as a NoSQL Database, has continued to heat up in recent years, more and more enterprises are trying to replace the original Database with MongoDB
MongoDB deployment experiment series of articles, MongoDB as a NoSQL Database, has continued to heat up in recent years, more and more enterprises are trying to replace the original Database with MongoDB
MongoDB has been continuously increasing in recent years as a NoSQL Database. More and more enterprises are trying to replace the original Database with MongoDB. MongoDB also performs well in clusters, sharding, and replication. I will introduce various MongoDB deployment experiments.
Article 1 MongoDB master-slave replication experiment master/slave, divided into five parts
System Environment Introduction:
Ubuntu 12.04. LTS 64bit Server
Simple MongoDB Installation
Add the 10gen source to the source. list file.
~ Vi/etc/apt/source. list
Deb dist 10gen
~ Sudo apt-get update
~ Sudo apt-get install mongodb-10gen
Initialize the file directory (MongoDB storage)
~ Pwd
/Home/conan/dbs
~ Mkdir master slave
~ Ls-l
Drwxrwxr-x 2 conan 4096 May 31 13:54 master/
Drwxrwxr-x 2 conan 4096 May 31 14:04 slave/
Start master
~ Mongod -- dbpath/home/conan/dbs/master -- port 10000 -- master -- rest -- nojournal -- fork -- logpath/home/conan/dbs/master. log
About to fork child process, waiting until server is ready for connections.
Forked process: 4827
All output going to:/home/conan/dbs/master. log
Child process started successfully, parent exiting
Start slave
~ Mongod -- dbpath/home/conan/dbs/slave -- port 10001 -- slave -- source localhost: 10000 -- rest -- nojournal -- fork -- logpath/home/conan/dbs/slave. log
About to fork child process, waiting until server is ready for connections.
Forked process: 5062
All output going to:/home/conan/dbs/slave. log
Child process started successfully, parent exiting
Insert data to the master for testing
~ Mongo localhost: 10000
MongoDB shell version: 2.4.3
Connecting to: localhost: 10000/test
> Db. master. insert ({uid: 1000 })
> Db. master. find ()
{"_ Id": ObjectId ("51a83e979d113ea810e6ddbd"), "uid": 1000}
Query data in slave
~ Mongo localhost: 10001
MongoDB shell version: 2.4.3
Connecting to: localhost: 10001/test
> Db. master. find ()
{"_ Id": ObjectId ("51a83e979d113ea810e6ddbd"), "uid": 1000}
In slave, we found the data, which was synchronized from the master. The experiment is complete!
The master-slave experiment is the simplest deployment experiment for MongoDB.
MongoDB details: click here
MongoDB: click here
Related reading:
MongoDB backup and recovery
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]