====== Primary and backup configuration ======
How to setup Trisul Hub and Probe in a High Availability configuration. This guide describes how a backup probe and hub can be setup to take over in case of a primary failure.
===== Setup =====
You need an identically sized backup installation of Trisul that can takeover the load in the event of a primary failure.
* Download the replication scripts [[https://trisul.org/download/sync.sh|sync.sh]] and [[https://trisul.org/download/host_alive.sh|host_alive.sh]]
{{:admin:haprimarybackup.png?400|}}
===== Configure SSH between the primary and backup nodes =====
On both the primary and backup node use [[https://www.ssh.com/ssh/copy-id|ssh_copy_id to allow login]] without an interactive password.
===== Data replication =====
The primary hub and probe nodes contains the database and configuration. We use a script based on RSYNC to replicate this database incrementally over to the backup node.
- Download the script sync.sh
- Edit the script to enter the IP Address of the Backup script
- In a SCREEN session run the backup script
**On the primary node**
screen
./rsync.sh
===== Heartbeat check =====
The backup node needs to keep checking the liveness of the primary node using a heartbeat.
**On the backup node**
screen
./host_alive.sh
===== Takeover =====
The keepalive uses a PING to check the reachability of the primary node. When a configured number of PINGs (default 6 PING failures) fail, the backup starts the Trisul HUB ad PROBE processes and this takes over the primary function.
===== Recovery =====
The recovery process is not automatic. After the primary node is restored, you stop the Trisul processes on the backup and start the process on the primary node.