# InfluxDB OSS error with RuuviBridge

**URL:** https://f.ruuvi.com/t/influxdb-oss-error-with-ruuvibridge/6848
**Category:** 🇬🇧 Development projects with Ruuvi products
**Created:** [15 October 2024 16:35 UTC](https://f.ruuvi.com/t/influxdb-oss-error-with-ruuvibridge/6848 "2024-10-15T16:35:03Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Sephiroth](https://f.ruuvi.com/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@Sephiroth](https://f.ruuvi.com/u/Sephiroth)
#### Post date: [15 October 2024 16:35 UTC](https://f.ruuvi.com/t/influxdb-oss-error-with-ruuvibridge/6848/1 "2024-10-15T16:35:04Z")

</div>

Hello, I have set up a Raspberry Pi 5 as a Ruuvi Bridge and it is working perfectly when I use as sink my cloud InfluxDB instance (InfluxDB Cloud Serverless - Storage Engine Version 3).  
Now I am trying to set up a local InfluxDB instance (version 2.7.10) as sink and I’m getting the following error message:

> [error] Failed to send data to InfluxDB, error: Post “[http://localhost:8086/api/v2/write?bucket=mybucket&org=org&precision=ns](http://localhost:8086/api/v2/write?bucket=mybucket&org=org&precision=ns)”: dial tcp [::1]:8086: connect: connection refused

I am also periodically running some other scripts that successfully send their measurements on my local influxDB instance using the following command:

> curl -i -XPOST “[http://localhost:8086/api/v2/write?org=$INFLUX\_ORG&bucket=$INFLUX\_BUCKET&precision=s](http://localhost:8086/api/v2/write?org=$INFLUX_ORG&bucket=$INFLUX_BUCKET&precision=s)”   
> –header “Authorization: Token $INFLUX\_TOKEN”   
> –header “Content-Type: text/plain; charset=utf-8”   
> –data-binary “$DATA”

Here’s the content of the RuuviBridge config.yml for the configuration of the influxdb sink in both scenarios:

### InfluxDB Cloud - OK

> influxdb\_publisher:  
> enabled: true  
> minimum\_interval: 1m  
> url: [https://eu-central-1-1.aws.cloud2.influxdata.com](https://eu-central-1-1.aws.cloud2.influxdata.com)  
> auth\_token: “MY\_CLOUD\_TOKEN”  
> org: “org”  
> bucket: ruuvi  
> measurement: ruuvi\_measurements

### InfluxDB OSS - NOT working

> influxdb\_publisher:  
> enabled: true  
> minimum\_interval: 1m  
> url: [http://localhost:8086](http://localhost:8086)  
> auth\_token: “MY\_LOCAL\_TOKEN”  
> org: “org”  
> bucket: ruuvi  
> measurement: ruuvi\_measurements

The org name is correct, the bucket is set up correctly.

What might be the cause of this behavior? How can I fix?  
Thank you for your help, I’m clearly missing something here but I haven’t been able to figure it out yet.

---

<div class="post-metadata">

### Author: ![Marko](https://f.ruuvi.com/user_avatar/f.ruuvi.com/marko/32/3071_2.png) [@Marko](https://f.ruuvi.com/u/Marko)
#### Post date: [16 October 2024 00:46 UTC](https://f.ruuvi.com/t/influxdb-oss-error-with-ruuvibridge/6848/2 "2024-10-16T00:46:39Z")

</div>

Hi @Sephiroth , thanks for your message!  
I think @Scrin could possibly help you out with this.

---

<div class="post-metadata">

### Author: ![Scrin](https://f.ruuvi.com/user_avatar/f.ruuvi.com/scrin/32/326_2.png) [@Scrin](https://f.ruuvi.com/u/Scrin)
#### Post date: [16 October 2024 05:15 UTC](https://f.ruuvi.com/t/influxdb-oss-error-with-ruuvibridge/6848/3 "2024-10-16T05:15:49Z")

</div>

`dial tcp [::1]:8086: connect: connection refused` means the other end refused the connection when attempting to port 8086 on localhost over IPv6. As curl seems to work fine, it might be that your InfluxDB is listening only on IPv4, in which case you could try:

```yaml
url: http://127.0.0.1:8086

```

instead of

```yaml
url: http://localhost:8086

```

to force RuuviBridge to use IPv4 instead. If that doesn’t work, could you test your curl script with the -v verbose flag to see where and how it actually connects to troubleshoot further?

---

<div class="post-metadata">

### Author: ![Sephiroth](https://f.ruuvi.com/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@Sephiroth](https://f.ruuvi.com/u/Sephiroth)
#### Post date: [16 October 2024 06:34 UTC](https://f.ruuvi.com/t/influxdb-oss-error-with-ruuvibridge/6848/4 "2024-10-16T06:34:01Z")

</div>

Thank you a lot for your quick answers!  
Sadly, even with the explicit IPv4 url the result remains the same:

> [error] Failed to send data to InfluxDB, error: Post “[http://127.0.0.1:8086/api/v2/write?bucket=mybucket&org=org&precision=ns](http://127.0.0.1:8086/api/v2/write?bucket=mybucket&org=org&precision=ns)”: dial tcp 127.0.0.1:8086: connect: connection refused

With the verbose flag, this is the curl output:

> \* Trying 127.0.0.1:8086…  
> \* Connected to localhost (127.0.0.1) port 8086 (#0)  
> \> POST /api/v2/write?org=org&bucket=mybucket&precision=s HTTP/1.1  
> \> Host: localhost:8086  
> \> User-Agent: curl/7.88.1  
> \> Accept: \*/\*  
> \> Authorization: Token \*mytoken\*  
> \> Content-Type: text/plain; charset=utf-8  
> \> Content-Length: 137  
> \>  
> \< HTTP/1.1 204 No Content  
> HTTP/1.1 204 No Content  
> \< X-Influxdb-Build: OSS  
> X-Influxdb-Build: OSS  
> \< X-Influxdb-Version: v2.7.10  
> X-Influxdb-Version: v2.7.10  
> \< Date: Wed, 16 Oct 2024 06:18:03 GMT  
> Date: Wed, 16 Oct 2024 06:18:03 GMT
> 
> \<  
> \* Connection #0 to host localhost left intact

---

<div class="post-metadata">

### Author: ![Scrin](https://f.ruuvi.com/user_avatar/f.ruuvi.com/scrin/32/326_2.png) [@Scrin](https://f.ruuvi.com/u/Scrin)
#### Post date: [13 November 2024 15:44 UTC](https://f.ruuvi.com/t/influxdb-oss-error-with-ruuvibridge/6848/5 "2024-11-13T15:44:14Z")

</div>

It just occurred me, are you running RuuviBridge in a docker container? In that case localhost is wrong, as it will point to the localhost of the container, not the “localhost” of the host machine, in which case you need to use a different address that properly points to your influxdb

---

<div class="post-metadata">

### Author: ![Sephiroth](https://f.ruuvi.com/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@Sephiroth](https://f.ruuvi.com/u/Sephiroth)
#### Post date: [13 November 2024 16:56 UTC](https://f.ruuvi.com/t/influxdb-oss-error-with-ruuvibridge/6848/6 "2024-11-13T16:56:47Z")

</div>

Thank you for following up on this!

That is indeed the case, I was not aware that docker containers by default map `localhost` to the container itself and not to the host - with the correct mapping I could quickly verify that it works.

To solve the issue, either exchange `localhost` with `172.17.0.1` or follow the instructions on this StackOverflow post:  
[nginx - From inside of a Docker container, how do I connect to the localhost of the machine? - Stack Overflow](https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach)

In the meantime I switched to a different solution, but hopefully this will be helpful in case someone is experiencing the same issue 🙂
