Listen tcp 127.0.0.1:8088: bind: address already in use

Hello,

I have a Raspberry Pi with installed influx version 1.7.9
If I call “influxd” and I get " listen tcp 127.0.0.1:8088: bind: address already in use"

But I have write in the file “/etc/influxdb/influxdb.conf” → bind-address = “localhost:8087”

And when I call “influx” this error occured:
Failed to connect to http://localhost:8086: Get http://localhost:8086/ping: dial tcp [::1]:8086: connect: connection refused
Please check your connection settings and ensure ‘influxd’ is running.

What can I do to find the error?
Thanks
Michael

Try ‘grep -r “808[678]” /etc’ and see what config files (for any applications)
you can find which might be trying to bind to those ports.

Alternatively ‘netstat -lptn’.

This will tell you:

  • which application is shown as listening on port 8088
  • whether anything is listening on ports 8086 or 8087
  • which ports influx is listening on

That should get you a good way to understanding what’s happening, I hope.

Antony.

Hello

If I call this command, I get followed:

[14:31:49] root@openHABianPi:/home/openhabian# grep -r “808[678]” /etc
/etc/influxdb/influxdb.conf.dpkg-dist:# bind-address = “127.0.0.1:8088”
/etc/influxdb/influxdb.conf.dpkg-dist: # bind-address = “:8086”
/etc/influxdb/influxdb.conf:# bind-address = “127.0.0.1:8088”
/etc/influxdb/influxdb.conf: bind-address = “localhost:8087”
/etc/openhab2/services/influxdb.cfg:url=http://localhost:8087
/etc/services:omniorb 8088/tcp # OmniORB
/etc/services:omniorb 8088/udp

What does that tell me now?
Thanks
Michael

Hello

If I call this command, I get following:

[14:31:49] root@openHABianPi:/home/openhabian# grep -r “808[678]” /etc
/etc/influxdb/influxdb.conf.dpkg-dist:# bind-address = “127.0.0.1:8088”
/etc/influxdb/influxdb.conf.dpkg-dist: # bind-address = “:8086”

Those two are from the default distribution config file, which isn’t used.

/etc/influxdb/influxdb.conf:# bind-address = “127.0.0.1:8088”
/etc/influxdb/influxdb.conf: bind-address = “localhost:8087”

Those two are from the active InfluxDB config file, which is used, and tell us
that the bind address was “127.0.0.1:8088” but has now been changed to
“localhost:8087”.

So long as you’ve restarted Influx since making that change, it should be
listening on port 8087.

/etc/openhab2/services/influxdb.cfg:url=http://localhost:8087

That presumably is telling Openhab how to connect to Influx.

/etc/services:omniorb 8088/tcp # OmniORB
/etc/services:omniorb 8088/udp

Those don’t matter - the “services” file is just a definition of common names
for commonly-used port numbers.

What does that tell me now?

It suggests to me that there’s a difference between “127.0.0.1” and “localhost”
on this machine. It could be that “localhost” has both IPv4 and IPv6
addresses, or it could be that it’s not defined correctly at all.

Try the other command I suggested (I should have said “do this as well” rather
than “alternatively”…) ‘netstat -lptn’

And see what the output is.

Also check /etc/hosts for the definition of “localhost”.

Was there a particular reason you defined the InfluxDB bind address as
“localhost:8087” instead of “127.0.0.1:8087”?

Antony.

I have change all “localhost” to “127.0.0.1”, so now the output from “grep -r “808[678]” /etc”

/etc/influxdb/influxdb.conf.dpkg-dist:# bind-address = “127.0.0.1:8088”
/etc/influxdb/influxdb.conf.dpkg-dist: # bind-address = “:8086”
/etc/influxdb/influxdb.conf:# bind-address = “127.0.0.1:8088”
/etc/influxdb/influxdb.conf: bind-address = “127.0.0.1:8087”
/etc/openhab2/services/influxdb.cfg:url=http://127.0.0.1:8087
/etc/services:omniorb 8088/tcp # OmniORB
/etc/services:omniorb 8088/udp

Here the output from “netstat -lptn”

[22:32:04] root@openHABianPi:/etc# netstat -lptn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 604/sshd
tcp 0 0 127.0.0.1:8087 0.0.0.0:* LISTEN 9866/influxd
tcp 0 0 127.0.0.1:8088 0.0.0.0:* LISTEN 9866/influxd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 382/mongoose
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 713/smbd
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN 576/node
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 713/smbd
tcp 0 0 0.0.0.0:8084 0.0.0.0:* LISTEN 382/mongoose
tcp6 0 0 :::22 :::* LISTEN 604/sshd
tcp6 0 0 :::3000 :::* LISTEN 582/grafana-server
tcp6 0 0 :::8443 :::* LISTEN 575/java
tcp6 0 0 :::445 :::* LISTEN 713/smbd
tcp6 0 0 127.0.0.1:8101 :::* LISTEN 575/java
tcp6 0 0 :::139 :::* LISTEN 713/smbd
tcp6 0 0 :::5007 :::* LISTEN 575/java
tcp6 0 0 :::8080 :::* LISTEN 575/java
tcp6 0 0 127.0.0.1:38641 :::* LISTEN 575/java

Here the output

[22:32:12] root@openHABianPi:/etc# cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

127.0.1.1 openHABianPi

The OpenHAB application install the influx db automatic, so I have not write “localhost”. But now I have changed all to 127.0.0.1.

But if I call “influx” this output occured:

[22:34:45] root@openHABianPi:/etc# influx
Failed to connect to http://localhost:8086: Get http://localhost:8086/ping: dial tcp [::1]:8086: connect: connection refused
Please check your connection settings and ensure ‘influxd’ is running.

Why “influx” command use the port 8086? I changed the port to 8087?

Thanks
MIchael

This is a message telling that your influxDb service is starting and pulling up the resources…
Just run : influxd -config /etc/influxdb/influxdb.conf
And then wait for sometime - 5 to 10 mins and monitor the logs

Your service should be up and running in sometime.

Hello,

Same issue happened to me, When I upgraded to 1.8 Influxdb.

Now showing Bind address already in use.

How to resolve it.

First check which services occupies your sockets:

netstat -tulpen

$influxd ###Running output like this…How to solve this problem?

2021-04-14T18:52:50.357975Z info InfluxDB starting {“log_id”: “0TWRVyDG000”, “version”: “1.8.4”, “branch”: “1.8”, “commit”: “bc8ec4384eed25436d31045f974bf39f3310fa3c”}
2021-04-14T18:52:50.358100Z info Go runtime {“log_id”: “0TWRVyDG000”, “version”: “go1.13.8”, “maxprocs”: 4}
run: open server: listen: listen tcp 127.0.0.1:8088: bind: address already in use