problema para sustituir una master con una replica

From: Hellmuth Vargas <hivs77(at)gmail(dot)com>
To: Lista Postgres ES <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: problema para sustituir una master con una replica
Date: 2020-08-20 21:32:31
Message-ID: CAN3Qy4o_HLP_d4MAzEio0uFvfMpARKByhe-qzC6epYLUmwGEZg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola lista tengo un PostgreSQL 9.5.9 y monte el siguiente escenario, que
se motiva porque tengo un postgres en producción con varias
maquinas replicas y la idea es cambiar la master a una
máquina fisica nueva, por lo tanto queremos promover una replica en la
maquina nueva y que el resto de las replicas apunte a esta nueva master::

master--replica1--replica2

antes de simular una caida de la master verifique

bash-4.2$ /opt/PostgreSQL/9.5/bin/pg_controldata /opt/test/master/ | grep
'Latest checkpoint location'
Latest checkpoint location: F/7F000098
bash-4.2$ /opt/PostgreSQL/9.5/bin/pg_controldata /opt/test/replica2/ | grep
'Latest checkpoint location'
Latest checkpoint location: F/7F000098
bash-4.2$ /opt/PostgreSQL/9.5/bin/pg_controldata /opt/test/replica1/ | grep
'Latest checkpoint location'
Latest checkpoint location: F/7E000060

procedi a simular una caida (apague la master) y promovi la replica1 a
master:

bash-4.2$ /opt/PostgreSQL/9.5/bin/pg_ctl -D /opt/test/master/ stop -m fast
waiting for server to shut down.... done
server stopped

bash-4.2$ /opt/PostgreSQL/9.5/bin/pg_ctl -D /opt/test/replica1/ promote
server promoting

apenas hice eso, la réplica2 (que estaba apuntando a la replica1) empezo a
generar el siguiente error:

LOG: consistent recovery state reached at F/7F000338
LOG: invalid record length at F/7F000338
LOG: database system is ready to accept read only connections
LOG: started streaming WAL from primary at F/7F000000 on timeline 1
LOG: replication terminated by primary server
DETAIL: End of WAL reached on timeline 1 at F/7F000338.
LOG: restarted WAL streaming at F/7F000000 on timeline 1
LOG: replication terminated by primary server
DETAIL: End of WAL reached on timeline 1 at F/7F000338.
LOG: restarted WAL streaming at F/7F000000 on timeline 1
LOG: replication terminated by primary server
DETAIL: End of WAL reached on timeline 1 at F/7F000338.
LOG: restarted WAL streaming at F/7F000000 on timeline 1
LOG: replication terminated by primary server
DETAIL: End of WAL reached on timeline 1 at F/7F000338.
LOG: restarted WAL streaming at F/7F000000 on timeline 1
LOG: replication terminated by primary server
DETAIL: End of WAL reached on timeline 1 at F/7F000338.
LOG: restarted WAL streaming at F/7F000000 on timeline 1
LOG: replication terminated by primary server

solo cuando levante nuevamente la master y reapunte la replica2 a la
master pudo volver a sincronizar

DETAIL: End of WAL reached on timeline 1 at F/7F000338.
LOG: received fast shutdown request
LOG: aborting any active transactions
FATAL: terminating walreceiver process due to administrator command
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down in recovery at 2020-08-20 15:18:36 -05
LOG: entering standby mode
LOG: consistent recovery state reached at F/7F000338
LOG: invalid record length at F/7F000338
LOG: database system is ready to accept read only connections
LOG: started streaming WAL from primary at F/7F000000 on timeline 1
LOG: redo starts at F/7F000338

que estoy haciendo mal??
--
Cordialmente,

Ing. Hellmuth I. Vargas S.

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2020-08-20 21:39:12 Re: problema para sustituir una master con una replica
Previous Message Guillermo E. Villanueva 2020-08-19 15:27:45 Re: Sobre postgres barman y backup incremental