# InfluxDB on Raspberry

**URL:** <https://community.influxdata.com/t/influxdb-on-raspberry/22772>\
**Category:** InfluxDB 1\
**Tags:** raspberry\
**Created:** [December 1, 2021, 3:01pm UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772 "2021-12-01T15:01:40Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichielBbal](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/michielbbal/32/8871_2.png) [@MichielBbal](https://community.influxdata.com/u/MichielBbal)\
**Post date:** [December 1, 2021, 3:01pm UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/1 "2021-12-01T15:01:40Z")

</div>

Hi,  
I’ve installed InfluxDB on my raspberry.  
I have a wonderful script running that stores data from my sound sensor in my influxdb Database.

Now, I want to connect my laptop to the database on my Raspberry, where I want to use a python script to get the data.  
How should I configure influx on the Raspberry so I can get my data out?

---

<div class="post-metadata">

**Author:** ![Jay\_Clifford](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jay_clifford/32/8287_2.png) [@Jay\_Clifford](https://community.influxdata.com/u/Jay_Clifford)\
**Post date:** [December 2, 2021, 11:24am UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/2 "2021-12-02T11:24:30Z")

</div>

Hi @MichielBbal,  
Nice to meet you digitally and welcome to the community. Have you tried our Python client?

You can use this to query InfluxDB and pull out the data in a variety of forms:

> **[GitHub - influxdata/influxdb-client-python: InfluxDB 2.0 python client](https://github.com/influxdata/influxdb-client-python)**
>
> InfluxDB 2.0 python client. Contribute to influxdata/influxdb-client-python development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Jay\_Clifford](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jay_clifford/32/8287_2.png) [@Jay\_Clifford](https://community.influxdata.com/u/Jay_Clifford)\
**Post date:** [December 2, 2021, 11:27am UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/3 "2021-12-02T11:27:32Z")

</div>

Here is an example of where I used the client to pull data into a flask server that I am hosting:

> **[GitHub - InfluxCommunity/plant\_buddy: Demonstration project using the...](https://github.com/InfluxCommunity/plant_buddy)**
>
> Demonstration project using the InfluxDB platform as the backend for a Flask web service. - GitHub - InfluxCommunity/plant\_buddy: Demonstration project using the InfluxDB platform as the backend fo...

Check out, my influx\_helper class. There are also really great examples located here: [influxdb-client-python/examples at master · influxdata/influxdb-client-python · GitHub](https://github.com/influxdata/influxdb-client-python/tree/master/examples)

---

<div class="post-metadata">

**Author:** ![MichielBbal](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/michielbbal/32/8871_2.png) [@MichielBbal](https://community.influxdata.com/u/MichielBbal)\
**Post date:** [December 2, 2021, 9:24pm UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/4 "2021-12-02T21:24:14Z")

</div>

So I created this script:  
from influxdb import InfluxDBClient, DataFrameClient

client=InfluxDBClient(host=“raspberry-ip”,port=“8086”)  
client.create\_database(“TEST”)  
client.get\_list\_database()

reesulting in the following error:  
ConnectionError: HTTPConnectionPool(host=‘http’, port=80): Max retries exceeded with url: // raspberry-ip:8086/query?q=CREATE+DATABASE+%22TEST%22 (Caused by NewConnectionError(’\<urllib3.connection.HTTPConnection object at 0x00000231CD7466A0\>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed’))

Hope you can help me out! Thanks a lot.

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/franky1/32/6666_2.png) [@Franky1](https://community.influxdata.com/u/Franky1)\
**Post date:** [December 2, 2021, 10:26pm UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/5 "2021-12-02T22:26:17Z")

</div>

First of all, we should clarify which version you have installed on the Raspberry:  
InfluxDB Version 1.x or Version 2.x ?

---

<div class="post-metadata">

**Author:** ![MichielBbal](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/michielbbal/32/8871_2.png) [@MichielBbal](https://community.influxdata.com/u/MichielBbal)\
**Post date:** [December 4, 2021, 10:47am UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/6 "2021-12-04T10:47:51Z")

</div>

Hi Franky1,

pi@raspberrypi:~ $ influx --version  
InfluxDB shell version: 1.8.10

---

<div class="post-metadata">

**Author:** ![Jay\_Clifford](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jay_clifford/32/8287_2.png) [@Jay\_Clifford](https://community.influxdata.com/u/Jay_Clifford)\
**Post date:** [December 7, 2021, 11:19am UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/7 "2021-12-07T11:19:28Z")

</div>

ah sorry, @MichielBbal I did not realise you were using 1.8. Could you try this library instead?

> **[GitHub - influxdata/influxdb-python: Python client for InfluxDB](https://github.com/influxdata/influxdb-python)**
>
> Python client for InfluxDB. Contribute to influxdata/influxdb-python development by creating an account on GitHub.

Also, could you try using the exact IP of the Pi, to begin with before trying the hostname? Let’s see if we can get you connected.

---

<div class="post-metadata">

**Author:** ![MichielBbal](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/michielbbal/32/8871_2.png) [@MichielBbal](https://community.influxdata.com/u/MichielBbal)\
**Post date:** [December 12, 2021, 10:37am UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/8 "2021-12-12T10:37:22Z")

</div>

Hi, my hostname is [http://192.168.178.50:8086](http://192.168.178.50:8086) and I’ve also tried this library, however still without success. Hope to hear from you.

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/franky1/32/6666_2.png) [@Franky1](https://community.influxdata.com/u/Franky1)\
**Post date:** [December 12, 2021, 11:48am UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/9 "2021-12-12T11:48:17Z")

</div>

We don’t get anywhere with such imprecise information.  
What exactly is not working? Error messages?  
I assume both devices are on the same internal network? Can you ping the Raspberry from the Laptop?  
Before I would start with a Python script - which itself can contain errors - I would first check the basics!?

---

<div class="post-metadata">

**Author:** ![MichielBbal](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/michielbbal/32/8871_2.png) [@MichielBbal](https://community.influxdata.com/u/MichielBbal)\
**Post date:** [December 12, 2021, 6:30pm UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/10 "2021-12-12T18:30:48Z")

</div>

Off course, I always ssh into my RPi. I can ping it as well, no worries. And yes, they are on the same internal network.  
I even have Grafana installed on [hass.io](http://hass.io) that can connect to my Raspberry to retrieve all the data from the RPi.

Hope to get some good suggestions on how to connect to the InfluxDB on my RPi remotely.

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/franky1/32/6666_2.png) [@Franky1](https://community.influxdata.com/u/Franky1)\
**Post date:** [December 12, 2021, 7:33pm UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/11 "2021-12-12T19:33:50Z")

</div>

What do you get if you call the url in the browser of your laptop?

```nohighlight
http://192.168.178.50:8086

```

Do you get a

```auto
404 page not found

```

response?

If yes, start with a very simple python client example:

```auto
from influxdb import InfluxDBClient

client = InfluxDBClient(host='192.168.178.50', port=8086)
pong = client.ping()
print(pong)

```

You should you get something like

```auto
1.8.10

```

---

<div class="post-metadata">

**Author:** ![MichielBbal](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/michielbbal/32/8871_2.png) [@MichielBbal](https://community.influxdata.com/u/MichielBbal)\
**Post date:** [December 12, 2021, 8:02pm UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/12 "2021-12-12T20:02:45Z")

</div>

Thank you, indeed my response was: 1.8.10 !  
Look forward to your next suggestion.

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/franky1/32/6666_2.png) [@Franky1](https://community.influxdata.com/u/Franky1)\
**Post date:** [December 12, 2021, 8:08pm UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/13 "2021-12-12T20:08:32Z")

</div>

Then the connection works.  
I don’t know what you have in mind, so I don’t know what the next steps would be.  
Read the documentation and expand this simple script bit by bit:

[https://influxdb-python.readthedocs.io/en/latest/](https://influxdb-python.readthedocs.io/en/latest/)

---

<div class="post-metadata">

**Author:** ![MichielBbal](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/michielbbal/32/8871_2.png) [@MichielBbal](https://community.influxdata.com/u/MichielBbal)\
**Post date:** [December 13, 2021, 5:06pm UTC](https://community.influxdata.com/t/influxdb-on-raspberry/22772/14 "2021-12-13T17:06:29Z")

</div>

I’ve got everything working now.  
I can retrieve data using the python library.  
Thank you again, Franky1 and Jay\_Clifford!
