I'm working on updating my Crystal Neo4j connector to the latest protocols and I'm struggling a bit. I've got a 3-node cluster running on Neo4j Aura, and when I send my ROUTE
command, I get back this structure:
{"servers" =>
[{"addresses" =>
["neo4j-core-3c0aa8ce-2.production-orch-0178.neo4j.io:7687"],
"role" => "WRITE"},
{"addresses" =>
["neo4j-core-3c0aa8ce-3.production-orch-0178.neo4j.io:7687",
"neo4j-core-3c0aa8ce-1.production-orch-0178.neo4j.io:7687"],
"role" => "READ"},
{"addresses" =>
["neo4j-core-3c0aa8ce-1.production-orch-0178.neo4j.io:7687",
"neo4j-core-3c0aa8ce-2.production-orch-0178.neo4j.io:7687",
"neo4j-core-3c0aa8ce-3.production-orch-0178.neo4j.io:7687"],
"role" => "ROUTE"}],
"ttl" => 10,
"db" => "neo4j"}
It seems that we need to use server-side routing with Aura because all 3 of those domains resolve to the same IP address (presumably an L4 load balancer) so it isn't possible to do client-side routing at all for this cluster. That seems fine, the documentation says that adding routing: {}
to my HELLO
command will instruct the server to handle routing:
hello Map{
"scheme" => "basic",
"principal" => username,
"credentials" => password,
"user_agent" => "Neo4j.cr/#{VERSION}",
"routing" => Map.new,
}
Except it's not working. I keep getting this error:
[Neo.ClientError.Cluster.NotALeader] No write operations are allowed directly on this database. Writes must pass through the leader. The role of this server is: FOLLOWER
Is there more I need to do to tell the server to handle routing?