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.