sh.enableSharding("test-db")
When I run staus I get this output
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/debaa6e5-07da-47c3-9855-506f24021844%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CABk9snqeXzauh%3DTZ%2B1kvo5aE7CRY%3DzWQ-p%3DMdMgEw%3DTkbo2P-Q%40mail.gmail.com.
Hi Sachin
I understood that every shard server should have its own unique replica set name and if that shard server needs to be replicated then we can add members to it.
Yes this is correct. Please note that it is recommended for production deployments for each shard to be a replica set, unless you are running the sharded cluster in development.
I have another question that when we start other members of that replica set then do we need to run rs.initiate on those members too?
No, you only run rs.initiate() to initiate a replica set on the first member only. The rs.initiate() command creates and initiates a replica set. After the first member is initialized as a replica set, you can use the rs.add() command to add subsequent members of the replica set. Please see Deploy a Replica Set and Add Members to a Replica Set for more details.
Alternatively, you can call rs.initiate() by supplying the replica set configuration which contains all the intended members of the replica set (please see the example here: https://docs.mongodb.com/manual/reference/method/rs.initiate/#example).
On the same lines I have question for config server replica set too. Since in production we have three member config server then I suppose that would be called as a replica set.
So we need a unique name for that config server set too. Is that correct.
This depends on your MongoDB version. In MongoDB 3.0 and earlier, the three config servers are in a mirrored configuration. However, starting from MongoDB 3.2, you can have config servers as a replica set as an option (with mirrored configuration still available for backward compatibility). Starting from MongoDB 3.4, config servers are strictly to be a replica set, with mirrored option no longer available.
Also do we need to start all three config servers first and then call rs.initiate by connecting to one?
Or call the same config on all three after starting each one by one?
For best results, you may want to follow the step-by-step procedure outlined in the Deploy a Sharded Cluster page. Please note that the page is for the current MongoDB version (3.4), which mandates the use of a replica set config server. A couple of things worth mentioning:
The procedure above is a basic illustration on how to deploy a sharded cluster, and does not include enabling security on the deployment. Please follow the procedure outlined in the Deploy Sharded Cluster with Keyfile Access Control page on how to enable basic authentication. For production deployments, it is strongly recommended to use x.509 instead.
For best results, please use a Fully Qualified Domain Name for each member of the cluster, and avoid hard-coding static IP addresses.
Best regards,
Kevin