Default MongoDB Port

The following table lists the default TCP ports used by MongoDB:

Default PortDescription
27017The default port for mongod and mongosinstances. You can change this port with port or—port.
27018The default port for mongod when running with—shardsvr command-line option orthe shardsvr value for the clusterRolesetting in a configuration file.
27019The default port for mongod when running with—configsvr command-line option orthe configsvr value for the clusterRolesetting in a configuration file.