Search code examples
influxdbrhel7

InfluxDB port already in use


I need to install InfluxDB 2.0 in RHEL7. I followed the installation guide from the InfluxDB website.

The influxd service gets running. However when I re-run influxd, it throws the following error.

Error: listen tcp :8086: bind: address already in use

However, netstat -a | grep 8086 returns nothing.

When I change the port to 8087 by adding an argument to /etc/default/influxdb2 and /lib/systemd/system/influxdb.service, influxd command works fine.

However, influx setup command throws an error now (this worked fine when the port was 8086).

I uninstalled and retried, but get the same error.


Solution

  • By default, netstat will attempt to determine and display host and port names rather than displaying their numerical value. You can disable port resolution and display numerical port values by including the flag --numeric-ports (or --numeric/-n to disable the resolution of ports AND hosts.)

    For the purposes of debugging, it may also be helpful to only return listening sockets and include the PID of the process that is listening.

    You may want to try running netstat -anlpt.

    • -a: all interfaces
    • -n: show numerical addresses
    • -l: only listening sockets
    • -p: show the PID and program the socket belongs to
    • -t: TCP only

    You might also want to look at using lsof, which allows you to supply a port or list of ports along with the protocol: lsof -P -itcp:8086

    It seems very likely that the InfluxDB service is already running and that you don't need to run influxd again.