I have a new server on which i have to copy the old version of the MongoDB already configured. On the old server(3.0.4), there are two shards: one shard has 350GB, and the other has 300GB of data.
I followed the following steps:
- Installed MongoDB 3.0.15 on new server
- Copied the data from two shards to the new server
then ran the following commands
mongod --configsvr --dbpath C:\mongoConfigData/configdb1 --port 27019 mongod --configsvr --dbpath C:\mongoConfigData/configdb2 --port 27020 mongod --configsvr --dbpath C:\mongoConfigData/configdb3 --port 27021 mongos --configdb 127.0.0.1:27019,127.0.0.1:27020,127.0.0.1:27021 --port 27017 mongod --dbpath F:\data --storageEngine wiredTiger --wiredTigerJournalCompressor zlib --wiredTigerCollectionBlockCompressor zlib --port 27010 mongod --dbpath D:\data --storageEngine wiredTiger --wiredTigerJournalCompressor zlib --wiredTigerCollectionBlockCompressor zlib --port 27011
Added the shard and the shard collection details
sh.addShard("localhost:27010") sh.addShard("localhost:27011") sh.shardCollection("log", {"id" : 1, "eventId": 1})
Shard distribution shows both the shards but the total docs and the collection size does not match the one in the initial server. Further the content in the mongodb is not the complete data Why is it so? What am i doing wrong?