Replica sets (replica set) is a new feature that starts with the mongodDB1.6 version number. It can realize fault self-switchover and self-active repair function member node function, the data between each db is identical, greatly reduces the risk of single point of failure.
【】
This is the replica set schema for three nodes. The figure is from the book "The Essentials of MongoDB Management and development" written by Red pill. From being able to see, the structure resembles a cluster. In fact, it can be a cluster altogether. Because it does have the same effect as the cluster implementation.
First, deploy replica sets.
Next shows how to demonstrate the deployment of the 3-node replica on a single server sets
Second, start replica service
Open three command forms separately, and then run the following three sentences, respectively.
Mongod.exe --replset rs1--keyfile "D:\Program files\mongodb\data\replica\key\r0"--port 28010--dbpath "D:\ Program Files\mongodb\data\replica\data\r0 "--logpath" D:\Program files\mongodb\data\replica\log\r0.log "-- Logappendmongod.exe --replset rs1--keyfile "D:\Program files\mongodb\data\replica\key\r1"--port 28011--dbpath " D:\Program files\mongodb\data\replica\data\r1 "--logpath" D:\Program files\mongodb\data\replica\log\r1.log "-- logappendcd/d D:\Program files\mongodb\binmongod.exe --replset rs1--keyfile "D:\Program files\mongodb\data\ Replica\key\r2 "--port 28012--dbpath" D:\Program files\mongodb\data\replica\data\r2 "--logpath" D:\Program Files\ Mongodb\data\replica\log\r2.log "--logappend
Third, login client, initialize replica sets environment
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc3himdg0mtkwmtexng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/center ">
"MongoDB" Windows platform build MONGO database replica set (similar cluster) (i)