Following the failure or removal of the replication cluster's existing primary server, ltcluster standby follow can be used to make "orphaned" standbys follow the new primary and catch up to its current state.
To demonstrate this, assuming a replication cluster in the same state as the end of the preceding section (Promoting a standby), execute this:
$ ltcluster -f /etc/ltcluster.conf standby follow INFO: changing node 3's primary to node 2 NOTICE: restarting server using "lt_ctl -l /var/log/lightdb/startup.log -w -D '/var/lib/lightdb/data' restart" waiting for server to shut down......... done server stopped waiting for server to start.... done server started NOTICE: STANDBY FOLLOW successful DETAIL: node 3 is now attached to node 2
The standby is now replicating from the new primary and
ltcluster cluster show
output reflects this:
$ ltcluster -f /etc/ltcluster.conf cluster show ID | Name | Role | Status | Upstream | Location | Connection string ----+-------+---------+-----------+----------+----------+-------------------------------------- 1 | node1 | primary | - failed | | default | host=node1 dbname=ltcluster user=ltcluster 2 | node2 | primary | * running | | default | host=node2 dbname=ltcluster user=ltcluster 3 | node3 | standby | running | node2 | default | host=node3 dbname=ltcluster user=ltcluster
Note that with cascading replication, ltcluster standby follow
can also be
used to detach a standby from its current upstream server and follow the
primary. However it's currently not possible to have it follow another standby;
we hope to improve this in a future release.