温馨提示×

centos mongodb配置端口几

小樊
33
2026-10-14 15:59:12
栏目: 云计算

在 CentOS 上,MongoDB 默认监听的端口是:

27017

常见配置说明

  1. 默认端口

    • MongoDB:27017
    • MongoDB Shard Server:27018
    • MongoDB Config Server:27019
  2. 配置文件位置(CentOS 常见)

    /etc/mongod.conf
    
  3. 修改端口示例 在 mongod.conf 中:

    net:
      port: 27017
      bindIp: 127.0.0.1
    

    修改后重启服务:

    systemctl restart mongod
    
  4. 防火墙放行(CentOS 7+)

    firewall-cmd --permanent --add-port=27017/tcp
    firewall-cmd --reload
    

如果你是想问 MongoDB 在 CentOS 上要开哪个端口给外部访问,那就是 27017(如修改过以配置文件为准)。

0 踩