Overview
The first 3 blogs about MongoDB's distributed and clustered, where the primary master-slave replication We almost do not have any meaning, the remaining two, regardless of which we use each, will have a corresponding problem, a better solution is that the collection of shards and replica sets to use, so it is more perfect.
deployment Diagram
Here, we need to note that we MONGOs server configured as a cluster, so we need to add the corresponding address on the client, this and in the copy set of the same blog in the content, the Java client program in the specific core code, in that blog also gave you, If this is unclear, you can look at that blog post. configuration of a shard cluster
Shard cluster configuration //start each config mongod--dbpath/data/mongodbtest/config/data--port 27017 //start each MONGOs MONGOs --configdb 192.168.24.201:27017,192.168.24.202:27017,192.168.24.203:27017 --port 27017 //log in each MONGOs add shards ( Omit configuration Replica Set procedure) Use admin db.runcommand ({addshard: "shard1/192.168.24.1:27017, 192.168.24.2:27017, 192.168.24.3:27017 "}); Db.runcommand ({addshard: "shard2/192.168.24.11:27017, 192.168.24.12:27017, 192.168.24.13:27017" });
The above configuration is the core of the configuration, which involves the replica set and other aspects of the specific configuration, you can refer to the previous articles, here will not repeat
SummaryMongoDB learning process, my most difficult stage is not in the learning of distributed cluster this piece of content, but in the simplest environment configuration, that process, I need to download the corresponding server from the official website, download the corresponding client driver, and then do a simple instance, the process is the most difficult, Once through that process, the rest is not a thing.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
MongoDB's distributed cluster (4, shard and replica set combination)