MongoDB convert standalone mongod to sharded replica set cluster

mongodbsharding

I have a single replica set having 3 mongod instance, collection in this instance has data already.

I want to convert this instance to sharded cluster. I followed Convert a Replica Set to a Sharded Cluster but when I access my mongod at the end of the setup it doesn't show the existing data.

Any suggestions?

Best Answer

  1. You have config server replica set installed?
  2. You are running at least one mongoS -service
  3. You are connecting (with mongo) to mongoS when you are working with cluster
  4. You have added your replica set(s) to the cluster with sh.addShard() -command
  5. You have added (at least one) your databases to cluster with command sh.enableSharding("yourDBname")

This point your collection is still there, sitting on original location with all data. You still need to shard your collections, which data is needed to "spread" to other shards (nodes).