Reputation: 2828
i was playing around on our dev server for a while for a new product and now it's sorta live and i want to move existing data from a single machine (mongod, local) to our 6 server shard setup (2 shards each a 3 replica set) - is there any way to clone the db to a remote shard?
(worst case, a simple dump & insert with shard key example would be very nice!)
thanks!
Upvotes: 3
Views: 1600
Reputation: 2489
You should add your dev server to the sharding environement :
You don't have to shard your database for the migration, however you need to do it if you want to benefit from sharding.
The advantages of this solution is that you have minimum action to take ( everything is automatic) and there is no downtime (the more load you put, however, the slower the operation is) However this is a slow solution (slower than a manual copy).
One more advantage compared to raw files copy : the transfer will also compact (~ defrag) data, which is always good :-)
Upvotes: 1
Reputation: 33732
Add your dev server to a replica-set as the master, and the other 3 servers as slaves. Then remove the dev-server once the data was copied by the other servers.
You can use mongodump
to dump out the database, and then load the db-dump with mongorestore
onto the master of each of your replica-sets
man mongodump
, man mongorestore
See:
http://www.mongodb.org/display/DOCS/Replica+Set+Internals
http://www.mongodb.org/display/DOCS/Sharding+Introduction
http://www.mongodb.org/display/DOCS/Master+Slave
Upvotes: 0