Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

DataFrame client connection errors when trying to insert dataframes #893

Open
GurvanKervern opened this issue Jun 21, 2021 · 2 comments
Open

Comments

@GurvanKervern
Copy link

  • InfluxDB version: 1.6.4
  • InfluxDB-python version: 5.2.0
  • Python version: e.g. 3.8.5
  • Operating system version: Ubuntu 20.04 & Debian 10

I am trying to insert a fairly small dataframe in Influxdb (9000 rows, 3 columns besides the timestamp) but I am getting connection errors, which seems to come from the library.

Influxdb is accessible on both servers, locally and remotely. There is no problem connecting with the command line, or even with the library to create a new database and switch to it, so the problem seems to be when inserting dataframes only (I have been able to insert data in line protocol format)

Here are exceptions and traceback :

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 57, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.7/http/client.py", line 1260, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1030, in _send_output
self.send(msg)
File "/usr/lib/python3.7/http/client.py", line 970, in send
self.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 181, in connect
conn = self._new_conn()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f0e3aac56a0>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='%3cinfluxdb.client.influxdbclient%20object%20at%200x7f0e3deaa1d0%3e', port=8086): Max retries exceeded with url: /write?db=dataframe2 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f0e3aac56a0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./testInfluxDf.py", line 23, in
df_client.write_points(analyzer.df_dt_indexed_on_time, 'voltages', database='dataframe2')
File "/usr/lib/python3/dist-packages/influxdb/_dataframe_client.py", line 138, in write_points
protocol=protocol)
File "/usr/lib/python3/dist-packages/influxdb/client.py", line 490, in write_points
tags=tags, protocol=protocol)
File "/usr/lib/python3/dist-packages/influxdb/client.py", line 551, in _write_points
protocol=protocol
File "/usr/lib/python3/dist-packages/influxdb/client.py", line 327, in write
headers=headers
File "/usr/lib/python3/dist-packages/influxdb/client.py", line 267, in request
timeout=self._timeout
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='%3cinfluxdb.client.influxdbclient%20object%20at%200x7f0e3deaa1d0%3e', port=8086): Max retries exceeded with url: /write?db=dataframe2 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f0e3aac56a0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

@stephkod
Copy link

Hi @GurvanKervern . I have a very similar problem that arises when trying to push a dataframe from within a docker container. When running the script outside of the container everything works fine. When I curling my host from within the container it responds.

Have you found a solution?

@GurvanKervern
Copy link
Author

hi @stephkod , I had to use a workaround : I generated line protocol files and inserted those

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants