Configure MongoDB cluster shards

Source: Internet
Author: User

At present, many tutorials on the internet talk about MongoDB sharding configuration, but most of them have not gone through practical practices and are reproduced randomly. In addition, the different configurations of MongoDB versions are messy, making the users confused.

Recently I have also made MongoDB sharding and pasted my configuration. In addition, let's talk to everyone about the issues that need attention. I hope you can correct them if they are inappropriate. We also hope that later users can bypass these problems.

To ensure data security, the formal environment must be backed up. For details about multipart copy, see alibaba Tutorial:

The cluster I configured is used for testing and has not been copied. It is just a simple test of multipart storage data. During the test, it is difficult to split and copy multiple machines. Many examples on the Internet are incorrect, so it took me a lot of time.

The structure after configuration is complete is:

My Mongo version is: mongodb-linux-x86_64-2.0.8, the computer is normal Pc.

Here I would like to note:

1. In Big Data scenarios, it is best to use a 64-bit machine. A 32-bit machine cannot create a single file larger than 2 GB. Small Data size does not matter

2. The system of each computer in the cluster should be the same. Do not use 32-bit or 64-bit pairs.

-- This is what I did when I started the test. There are 2 sets of 64, 2 sets of 32. when the data of about million data is injected and the index is greater than 3-4 GB, a 32-bit machine error occurs. A single file larger than 2 GB cannot be created on a 32-bit system. The whole cluster is paralyzed. I have been looking for reasons for this for a long time.

Let's get started!

The unzipped mongo directory structure is as follows: the installation directory is $ {MONGO_INSTALL}

Run the following commands on $ {cmd_install} on the first computer:

Mkdir-p/data/shard11

Bin/mongod-shardsvr-port 27017-dbpath =/data/shard11/-logpath =/data/shard11.log -- fork

  • 1
  • 2
  • Next Page

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.