Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-08-2020 03:05 AM
We have a Python project connecting to Neo4j, running inside Kubernetes. Previously we used the neo4j
package. Then we used the py2neo
package (which uses the neobolt
driver) with a neo4j sidecar (resulting in a localhost address). But now we connect from the Python container to a Neo4j database in the cluster. This results in an error that seems to be related to an ipv6 issue. An excerpt of the exception:
File "/venv/lib/python3.6/site-packages/py2neo/database.py", line 533, in run
return self.begin(autocommit=True).run(cypher, parameters, **kwparameters)
File "/venv/lib/python3.6/site-packages/py2neo/database.py", line 828, in run
entities=entities))
File "/venv/lib/python3.6/site-packages/py2neo/internal/connectors.py", line 292, in run
return self._run_1(statement, parameters, graph, keys, entities)
File "/venv/lib/python3.6/site-packages/py2neo/internal/connectors.py", line 241, in _run_1
cx = self.pool.acquire()
File "/venv/lib/python3.6/site-packages/neobolt/direct.py", line 719, in acquire
return self.acquire_direct(self.address)
File "/venv/lib/python3.6/site-packages/neobolt/direct.py", line 612, in acquire_direct
connection = self.connector(address, error_handler=self.connection_error_handler)
File "/venv/lib/python3.6/site-packages/py2neo/internal/connectors.py", line 227, in connector
encrypted=cx_data["secure"], **kwargs)
File "/venv/lib/python3.6/site-packages/neobolt/direct.py", line 976, in connect
raise last_error
File "/venv/lib/python3.6/site-packages/neobolt/direct.py", line 966, in connect
s = _connect(resolved_address, **config)
File "/venv/lib/python3.6/site-packages/neobolt/direct.py", line 847, in _connect
raise ServiceUnavailable("Failed to establish connection to {!r} (reason {})".format(resolved_address, error))
neobolt.exceptions.ServiceUnavailable: Failed to establish connection to ('::1', 7687, 0, 0) (reason [Errno 99] Cannot assign requested address)
The provided URI is something like: bolt://neo4j-service.namespace.svc.cluster.local:7687
It can be resolved to an ipv4 IP-address as it worked in the past with the neo4j
package, and I verified using dig
in a container in the cluster.
Is there a way to disable the ipv6 behavior of the neobolt driver? I couldn't find such a feature.
Used packages:
py2neo 4.3.0
neobolt 1.7.15
It might be related to Connection issue via py2neo not working @technige ?
I hope somebody can provide me with some insights. In the mean time I'll work on a workaround.
All the sessions of the conference are now available online