Skip to content

Port 27018: MongoDB sharded cluster

Key idea:

Port 27018 (TCP) is the standard for MongoDB sharded cluster. Port 27018 — default for MongoDB shardsvr (shard member in a sharded cluster). 27017 — mongos router + standalone. 27019 — config server. Sharding is used for horizontal scal

Below: what uses this port, security considerations, online check, FAQ.

Check your host & ports →

What runs on this port

MongoDB sharded cluster

Port 27018 — default for MongoDB shardsvr (shard member in a sharded cluster). 27017 — mongos router + standalone. 27019 — config server. Sharding is used for horizontal scaling of DBs over 2 TB.

Security considerations

MongoDB without auth pre-3.6 — known ransomware target (2017 mass encryption). Enable auth via `security.authorization: enabled`, TLS for member + client, bind private network only.

Check this port online

Check port online →

Enterno.io Ping + Port checker tests TCP reachability of any port from 3 regions (Moscow / Frankfurt / Virginia).

Understanding MongoDB Sharded Clusters and Port 27018 Usage

Port 27018 (TCP) serves a critical function within a MongoDB sharded cluster. Specifically, it is the default port used for shard members, which are the individual components of a sharded setup. In a sharded architecture, data is distributed across multiple servers or shards, allowing for horizontal scaling, improved performance, and enhanced data management.

When deploying a MongoDB sharded cluster, it is essential to understand the role of each port:

  • Port 27017: This is the default port for the mongos router and standalone instances.
  • Port 27018: Utilized by shard members, it ensures that data can be efficiently retrieved and stored across multiple shards.
  • Port 27019: This port is reserved for the config servers, which store metadata and configuration settings for the cluster.

When setting up a sharded cluster, ensure that port 27018 is open and accessible for all shard members to communicate effectively. Misconfigurations or firewalls blocking this port can lead to significant performance issues or even cluster failure.

Security Considerations for Port 27018 in MongoDB

Securing port 27018, like any other port in a database environment, is crucial to protect against unauthorized access and potential data breaches. Here are some best practices to enhance security when using port 27018 for MongoDB sharded clusters:

  • Network Security Groups: Use network security groups (NSGs) or firewalls to restrict access to port 27018. Only allow trusted IP addresses or ranges to connect.
  • Authentication: Enable authentication for MongoDB to ensure that only authorized users can access the database. Use mechanisms like SCRAM or X.509 certificates.
  • Encryption: Implement TLS/SSL encryption for data in transit to protect sensitive information being transmitted over port 27018.
  • Regular Updates: Keep MongoDB and its dependencies updated to the latest stable versions to mitigate vulnerabilities.

Additionally, consider monitoring access logs and setting up alerts for any suspicious activity targeting port 27018. By adhering to these security measures, you can significantly reduce the risk associated with using this port in a MongoDB sharded cluster.

Practical Examples of Configuring MongoDB with Port 27018

When configuring a MongoDB sharded cluster, it is essential to specify the correct ports for each component. Below are some practical examples of how to set up your MongoDB instances to utilize port 27018 effectively.

1. **Starting a Shard Member**: To start a MongoDB shard member on port 27018, use the following command:

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

This command initializes the shard member, indicating it is part of a sharded cluster.

2. **Connecting to a Shard**: When connecting to a shard member from a client application, specify the port as follows:

mongo --host shard1.example.com --port 27018

3. **Configuring a Sharded Cluster**: To add the shard member to your existing sharded cluster, use the following command in the MongoDB shell:

sh.addShard('shard1.example.com:27018')

4. **Checking Shard Status**: To verify that your shard is properly configured and accessible, you can run:

sh.status()

This command provides an overview of the sharded cluster's status, including the connected shard members and their respective ports.

By following these examples, you can ensure that your MongoDB sharded cluster is configured correctly to utilize port 27018, facilitating efficient data distribution and retrieval.

Learn more

Sources

Frequently Asked Questions

Is port 27018 open by default?

No, modern cloud providers (AWS, Google Cloud, Yandex) close all incoming ports by default. You must explicitly allow port 27018 in a Security Group or firewall.

How to check if port 27018 is reachable?

Use <a href="/en/ping">Enterno Ping + Port Checker</a>. Or in shell: <code>nc -vz example.com 27018</code>.

Is port 27018 safe to expose?

Depends on the service. MongoDB sharded cluster should never be exposed publicly without authentication + TLS. See <a href="/en/s/research-open-ports-exposure-2026">our 2026 exposure research</a>.

Try the live tool that powered this guide

Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.