gremo
gremo

Reputation: 48899

MongoDB shardsvr option?

As per documentation, the default value for shardsvr option is false:

Set this value to true to configure this mongod instance as a shard in a partitioned cluster. The default port for these instances is 27018. The only affect of shardsvr is to change the port number.

It seems that shardsvr is required to configure an instance as a shard. But then it says that the only affect is to change the port number.

Why I need to change the port this way? There is already the port option...

mongod --port 27019 --dbpath /data/shard1
mongod --shardsvr --port 27019 --dbpath /data/shard1

Upvotes: 2

Views: 4721

Answers (1)

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230326

This answer is no longer valid

See comments.


No, you don't need to change the port through --shardsvr option. Also you don't need to change port at all. You can assemble a cluster of mongod instances with their default ports.

The purpose of port changing, as I understand it, is to lower chances of you connecting to a shard directly. In a cluster setup, you're supposed to be working through a mongos router.

Upvotes: 1

Related Questions