[MongoDB] building a Mongo database replica set (similar to a cluster) on the windows platform (II), mongodbmongo

Source: Internet
Author: User

[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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.