Replication #
Amelie supports Asynchronous Replication, which allows fault-tolerant Primary-Replica setups to be created. Replication is logical and based on WAL streaming.
Replica servers can be defined on the Primary server using the CREATE REPLICA statement.
The replica server must be created initially from the primary server backup, have a unique instance UUID
and be up-to-date
with Primary WAL. Replica servers must be SUBSCRIBED to the Primary ID to accept the
Primary server connection. The UNSUBSCRIBE command can be used to unsubscribe from the
primary server and become the primary server itself.
The Primary server connects to replica servers identified by the created replica object and continuously streams WAL changes. The connection must be direct without using a proxy server.
The replica server can become outdated if its WAL LSN
is no longer available on the Primary server
(because of CHECKPOINT operation). To prevent this, the primary server creates replication
slots to identify replica positions. Replication slots are continuously advanced and synced with replica states.
They are used to keep older WAL files until all replicas are in sync.
START/STOP REPLICATION commands can enable or disable replication on a server.