1

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).

tkroman
  • 4,811
  • 1
  • 26
  • 46
  • Did you manage to get this to work, in the end? I'm trying a similar thing and the extra instance adds itself to the cluster, but I'm getting repeated `ServerId 3, moving to slave for master ha://127.0.0.1:6001?serverId=1\nCopying store from master` (the instance is a fresh one, with no DB yet) and after interaction in the browser interface (which did come up after a long while), `Timeout waiting for database to become available and allow new transactions. [...] 1 reasons for blocking: High Availability member state not ready. [...]`. – equaeghe Sep 21 '16 at 11:51
  • Never mind, I had forgotten to open some ports. It's working now. – equaeghe Sep 21 '16 at 12:02

1 Answers1

3

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
MicTech
  • 42,457
  • 14
  • 62
  • 79
  • I get `TransactionFailureExceptions` due to timeouts with that config. And you meant `5003, 5004`, by the way ;) – tkroman Oct 27 '15 at 14:47
  • Ports numbers depends on you. If you run HA instances on same machine, then should be different. – MicTech Oct 27 '15 at 14:50
  • Well, they are on the same machine. Anyway, as I said, somehow the second instance isn't available, the timeout causes transactions to fail. Are there any caveats I should know about? – tkroman Oct 27 '15 at 15:20
  • I can confirm that this approach works; I'm using it with a 2-node cluster to which I add a single instance via an ssh tunnel. – equaeghe Sep 21 '16 at 12:04