MongoDB advanced ---- MongoDB Auto-sharding

Source: Internet
Author: User
Skip the theoretical things and go to the web page to introduce automatic sharding. Insert million pieces of data into a database if the test is not sharded with million pieces of data. Quantity

Skip the theoretical things and go to the web page to introduce automatic sharding. Insert million pieces of data into a database if the test is not sharded with million pieces of data. Quantity

Skip the theory and go to the web page to introduce automatic sharding.

Or test with million data

Insert million pieces of data to a database without sharding.

Data storage:

Perform automatic sharding configuration as follows:

Here we select two servers for testing.

Test Machine IP Address:

10. X. X.163

10. X. X.228

Start the Shardsvr process on the 163,228 server.

  • Pai_^ [root @:/usr/local/mongodb/bin] # cat runServerShard. sh
  • ./Mongod -- shardsvr-dbpath = ../data/mongodb -- logpath = ../data/shardsvr_logs.txt -- logappend -- fork
  • Start the configsvr and mongos routing processes on the 163 server (the following 27019 is the ip address of configsvr, And the ip address of mongos can be viewed in the log)

    Check whether all startup is successful:

    It can be seen that all three services have been started successfully.

    Configure Automatic parts as follows:

    Use mongo to connect to the mongos process (see the log) for configuration management:

    Insert million data into the mongos Process

    Let's see the data size:

    163:

    228: auto-sharding is performed for every 2 GB.

    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.