How Should I Diagnose a Port Already in Use?

If you see Address already in use, bind: address already in use, or the service exits immediately after start, treat it as a port-planning conflict first.

Common default ports:

  • MySQL: 3306
  • ClickHouse TCP / HTTP: 9000 / 8123
  • Prometheus / Grafana: 9090 / 3000
  • node_exporter: 9100

Check the real listeners on the target host first:

ss -lntp

Focus on these checks:

  1. Whether an old instance, old exporter, or another middleware process is still listening on the same port.
  2. Whether a multi-instance layout reused the same mysql_port or instance_id.
  3. Whether monitoring-side values such as prometheus_port, grafana_port, node_exporter_port, or mysqld_exporter_port were assigned to ports already in use.

Common adjustment points:

  • MySQL: mysql_port
  • ClickHouse: clickhouse_tcp_port, or clickhouse_*_port_base / instance_id
  • Prometheus / Grafana: prometheus_port / grafana_port
  • Exporters: node_exporter_port / mysqld_exporter_port

Additional notes:

  • When MySQL keeps failing due to a port collision, systemd may later report start request repeated too quickly. Check the real root cause in the logs first, then follow start request repeated too quickly to reset the failed state.
  • In ClickHouse multi-instance scenarios, instance_id also affects several derived ports. Changing only the main port may still leave a collision on derived ports.

Related docs: