tkroman
tkroman

Reputation: 4798

How to add a node to a running neo4j cluster?

Suppose I have a single running neo4j node configured for HA mode. Relevant config lines are, I believe, are:

"ha.cluster_server" : "hostname:5003",
"ha.initial_hosts" : "hostname:5003",

Is it possible to add another node that will, upon joining, form a 2-node cluster with the currently running one?

I should clarify that I tried doing it by the books, i.e. configuring the second member like this:

"ha.cluster_server" : "hostname:5004",
"ha.initial_hosts" : "hostname:5004,hostname:5003",

But the second member just hangs in an UNKNOWN state (transitionioning to slave, I guess).

Upvotes: 1

Views: 648

Answers (1)

MicTech
MicTech

Reputation: 45043

First one server is not a cluster!

It should be possible. Configuration of second server should look like

ha.server_id=2 #different number then you have on first server

ha.initial_hosts=first_server:5003,second_server:5003

e.g.

first server

neo4j-server.properties

org.neo4j.server.database.mode=HA

neo4j.properties

ha.server_id=1

ha.initial_hosts=first_host:5001

ha.cluster_server=first_host:5001

ha.server=first_host:6001

second server

neo4j-server.properties

org.neo4j.server.database.mode=HA

neo4j.properties

ha.server_id=2 #different number then you have on first server

ha.initial_hosts=first_host:5001,second_host:5001

ha.cluster_server=second_host:5001

ha.server=second_host:6001

Upvotes: 3

Related Questions