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.

Python neo4j bolt driver 1.7, Cannot resolve replica server address on read_transaction

I have a Neo4j causal cluster deploy on kubernetes. The cluster has 3 cores and 3 replicas. Now I try to use python Neo4j bolt driver to connect. The problem happens when I use bolt+routing driver + read_transaction, it will randomly give me error said that it can't resolve address of the replica. Anyone know why this is happening?

I am use python3.6 with Neo4j Bolt Driver 1.7

Here is my code

import os
from neo4j import GraphDatabase

NEO4J_URL = 'bolt+routing://neo4j-causal-cluster.default.svc.cluster.local:7687'
NEO4J_USER = os.environ['NEO4J_USER']
NEO4J_PASS = os.environ['NEO4J_PASS']
driver = GraphDatabase.driver(NEO4J_URL, auth=(NEO4J_USER, NEO4J_PASS))

with driver.session() as session:
    session.read_transaction(query_new_user, ['123445'])

Here is the error I get

neobolt.addressing.AddressError: Cannot resolve address Address(host='neo4j-causal-cluster-replica-6f65-pdw', port=7687)

The error happens only when I try to run read_transaction. When I run write_tranaction, it's fine. But I feel it deson't make much sense to use write_transaction on read query

2 REPLIES 2

@mc422 , This is how we have done in K8, we need to expose the replica deployment via service and update the advertised address environment variables to the service name.

export NEO4J_dbms_connectors_default__advertised__address=${update_read_replica_service_name_here}

By default, the above env variable set to {hostname -f} , hence it tries to access pod hostname which isn't resolvable within the cluster

Hi @sujiar37
Can you please elaborate a little bit more about the procedure?