To enable ltcluster to support a replication cluster, the primary node must
be registered with ltcluster. This installs the ltcluster
extension and metadata objects, and adds a metadata record for the primary server:
$ ltcluster -f /etc/ltcluster.conf primary register INFO: connecting to primary database... NOTICE: attempting to install extension "ltcluster" NOTICE: "ltcluster" extension successfully installed NOTICE: primary node record (id: 1) registered
Verify status of the cluster like this:
$ ltcluster -f /etc/ltcluster.conf cluster show ID | Name | Role | Status | Upstream | Connection string ----+-------+---------+-----------+----------+-------------------------------------------------------- 1 | node1 | primary | * running | | host=node1 dbname=ltcluster user=ltcluster connect_timeout=2
The record in the ltcluster
metadata table will look like this:
ltcluster=# SELECT * FROM ltcluster.nodes; -[ RECORD 1 ]----+------------------------------------------------------- node_id | 1 upstream_node_id | active | t node_name | node1 type | primary location | default priority | 100 conninfo | host=node1 dbname=ltcluster user=ltcluster connect_timeout=2 repluser | ltcluster slot_name | config_file | /etc/ltcluster.conf
Each server in the replication cluster will have its own record. If ltclusterd
is in use, the fields upstream_node_id
, active
and
type
will be updated when the node's status or role changes.