Active/passive
Two identical VMs on the same network: the active one carries a floating IP and provides the service, the passive one keeps an up-to-date copy and takes over if the active one fails. Service comes back in under 2 minutes; live calls are lost.
What is copied
- The database, whole, continuously (PostgreSQL replication): a few seconds behind at most. Phone registrations are part of it: after a failover, phones do not have to register again.
- The files (voicemail, announcements, music, recordings) and the keyring: every minute. A failover may lose the last minute of voicemail.
- The configuration: copied when pairing.
The floating IP is the service address: SIP, audio, portal, API and trunks. DNS, phones and providers only see it.
Setting up
Two VMs installed from the image, each with its fixed address, plus a free address for the floating IP. Between them: VRRP (IP protocol 112), PostgreSQL (5432) and SSH (22). As root:
# Active 192.0.2.11, passive 192.0.2.12, floating IP 192.0.2.10.
kanadr bascule cle # on the passive: prints its public SSH key
kanadr bascule preparer --ip-flottante 192.0.2.10/24 --autre 192.0.2.12 \
--cle-autre "ssh-ed25519 …" # on the active
kanadr bascule rejoindre --actif 192.0.2.11 --cle-actif "ssh-ed25519 …" # on the passive
preparer prints the full rejoindre command. Options: --temoin (address each VM must reach
to keep or take the IP; the gateway by default) and --routeur (VRRP identifier, 51 by default,
unique on the network).
PostgreSQL replication between the two VMs is not encrypted: link them through a private network.
Failover
- The active announces itself every second; after 3 seconds of silence, the passive takes the IP.
- A health check (PostgreSQL, telephony engine, Kanadr) runs on the active; three failures in a row, and it gives up the IP.
- A VM that can no longer reach the witness gives up the IP and stops: an isolated VM never promotes itself.
- A former active that comes back stays passive: no automatic failback.
Operating
| Command | For |
|---|---|
kanadr bascule etat | Role of the VM, state of both databases, witness, services, replication lag, last file copy. |
kanadr bascule ceder | On the active: the passive takes over (maintenance, update). |
- Log:
/var/log/kanadr-bascule.log. - Update: the passive first, then
cederon the active, then the former active (Updates). The passive receives from the active, with the file copy, what it presents to the vendor’s repository (Access to the repository). - Monitoring: on the active,
kanadr_bascule_passives_connectees(1 in steady state) andkanadr_replication_retard_secondes(Monitoring).