[MongoDB] building a Mongo database replica set (similar to a cluster) on the windows platform (II), mongodbmongo
In the previous blog, we mainly explained how to build a mongodb replica set on the windows platform. Detailed blog address:
Due to limited space, the results are not verified in the previous article. In this blog, we will mainly test:
Through the rs. status () command, we can query that each node runs normally.
I. Data synchronization test
Insert on ports 28011 and 28012:
View reason: Find the answer online
First, this is normal, because SECONDARY does not allow read/write. In applications with multiple reads and fewer reads, Replica Sets are used for read/write splitting. By specifying slaveOk during connection or in the master database, Secondary shares the read pressure. Primary only performs write operations. Secondary nodes in the replica set are unreadable by default.
See: http://stackoverflow.com/questions/8990158/mongdodb-replicates-and-error-err-not-master-and-slaveok-false-code for details
Ii. Fault Adaptive Test
When the heartbeat of the master database stops, 28012 will elect itself as the master database, as shown below:
28012 the above can be inserted:
28011 the above cannot be inserted now
Why does the spring‑config class fail to be obtained when annotations are used in Spring + mongoDB?
First, change the version. Go to the java version and try again.
Spring is rarely used, but generally the objects cannot be obtained because the configuration file does not contain the specified reflection object.
How can I save the mongodb cluster after it is configured? Can it be used after it is started up next time? Windows Environment
It could have been.
In replica set mode, cluster parameters are written inside each node.
For the sharding mode, the Cluster Parameters are written in the configuration server.