Starting a Pair of Servers - shesse/h2ha GitHub Wiki

For HA operation you will need two physical Machines. Within this example we will call them machine-a and machine-b, However, you are free to use any name you like.

The setup on both machines is symmetrically, each referencing the other as its HA peer. First you have to decide on a directory where the local copy of the database should be kept. For this example we will use
/var/h2ha-base

For machine-a an interactive start within the console window would be:

mkdir /var/h2ha-base
java -Dstderr.threshold=INFO -jar h2ha-server-*.one-jar.jar server \
  -haBaseDir /var/h2ha-base -haPeerHost machine-b

That's it! The server is now running and accepting database connections on the default H2 port 9092. If you want to change any of the port numbers or other details: look at the command output when you just enter java -jar h2ha-server-*.one-jar.jar server.

For completing the setup you need to start the server on the other machine (machine-b):

mkdir /var/h2ha-base
java -Dstderr.threshold=INFO -jar h2ha-server-*.one-jar.jar server \
  -haBaseDir /var/h2ha-base -haPeerHost machine-a

If you don't want the informational output: just leave the -Dstderr.threshold=INFO away!

⚠️ **GitHub.com Fallback** ⚠️