cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Hi, I am running neo4j in kubernetes. I expose it via nginx ingress
one url for port 7474 - neo4j-url:443
one url for port 7687 - neo4bolt-url:443

everything was working fine I am able to open neo4j-url/browser and connect to neo4j+s://neo4bolt-url:443

But I was trying to connect from my local machine via python script

from neo4j import GraphDatabase


driver = GraphDatabase.driver("neo4j+s://neo4bolt-url:443", auth=("neo4j","password"))
session = driver.session()

query = """ MATCH (ee:Person) WHERE ee.from  = "Sweden" RETURN ee.name as name """

results = session.run(query)
print(results["name"])

I am getting this error

Unable to retrieve routing information
Traceback (most recent call last):
  File "db.py", line 14, in <module>
    results = session.run(query)
  File "C:\anaconda\lib\site-packages\neo4j\work\simple.py", line 221, in run
    self._connect(self._config.default_access_mode, database=self._config.database)
  File "C:\anaconda\lib\site-packages\neo4j\work\simple.py", line 122, in _connect
    bookmarks=self._bookmarks
  File "C:\anaconda\lib\site-packages\neo4j\io\__init__.py", line 1118, in acquire
    bookmarks=bookmarks
  File "C:\anaconda\lib\site-packages\neo4j\io\__init__.py", line 1087, in _select_address
    access_mode=access_mode, database=database, bookmarks=bookmarks
  File "C:\anaconda\lib\site-packages\neo4j\io\__init__.py", line 1069, in ensure_routing_table_is_fresh
    self.update_routing_table(database=database, bookmarks=bookmarks)
  File "C:\anaconda\lib\site-packages\neo4j\io\__init__.py", line 1041, in update_routing_table
    raise ServiceUnavailable("Unable to retrieve routing information")
neo4j.exceptions.ServiceUnavailable: Unable to retrieve routing information

Not sure what is the problem, any tip ?
Thank you

Comments
david_allen
Neo4j
Neo4j

Where is the python app deployed? Is it dockerized and running in the same namespace as the neo4j deployment? If not -- this probably won't work as you've constructed it.

There are some documentation dealing with this situation you can find here: External Exposure of Neo4j Clusters - Neo4j-Helm User Guide

Note, this area of Neo4j is undergoing some change, and Neo4j 4.3 will obviate the guidance at the link above (the picture will become simpler as of Neo4j 4.3). If you're using 4.0 <= Neo4j <= 4.2 though, you should have a look at the page above.

If your python app is dockerized and running in k8s, you should use the discovery address published by the helm install process, and not the simple local DNS name ("neo4bolt-url") as you are doing now. Neo4j should not be fronted by nginx ingress when you're using <= 4.2. This will not work because of the Neo4j smart-client routing protocol.

For full details on how smart client routing works and why you are seeing the error you are seeing, you can consult this page: Querying Neo4j Clusters. How Neo4j clusters and smart query… | by David Allen | Neo4j Developer Blog...

Version history
Last update:
‎06-01-2021 04:44 AM
Updated by:
Contributors