Mongodb distributed cluster (4. Integration of shards and replica sets) and mongodb Cluster

Source: Internet
Author: User

Mongodb distributed cluster (4. Integration of shards and replica sets) and mongodb Cluster
Overview

The previous three blogs talked about mongodb's distribution and clusters. The first type of master-slave replication is almost useless, which makes no sense. The remaining two types, no matter which one we use separately, there will be corresponding problems. A better solution is to use the set of shards and replica sets, which is perfect.


Deployment Diagram

Here, we need to note that the mongos server is configured as a cluster, so we need to add the corresponding addresses on the client separately, this is the same as the content of the blog in the replica set. The specific core code of the java client program is also provided to you in that blog. If this is unclear, let's take a look at the blog. Shard cluster configuration
Shard cluster configuration // start each Config mongod -- dbpath/data/mongodbtest/config/data -- port 27017 // start each mongos -- configdb 192.168.24.201: 27017,192.168 .24.202: 27017,192.168 .24.203: 27017 -- port 27017 // log on to each mongos to add shards (the replica set configuration process is omitted) 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 a core configuration, which involves the specific configuration of replica sets. You can refer to the previous articles and will not go into details here.

To sum up the learning process of mongodb, the most difficult stage is not to learn the content of distributed clusters, but to configure the simplest environment. In this process, I need to go to the official website, download the corresponding server, download the corresponding client driver, and then make the simplest instance. The process is the most difficult. Once you go through that process, nothing else will happen.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.