Closed vitabaks closed 10 months ago
ansible-playbook deploy_pgcluster.yml --tags point_in_time_recovery
Result:
PLAY [Deploy PostgreSQL HA Cluster (based on "Patroni")] **********************************************************************************************************************************************************
TASK [Gathering Facts] ********************************************************************************************************************************************************************************************
ok: [192.168.62.187]
ok: [192.168.62.186]
ok: [192.168.62.185]
ok: [192.168.62.165]
TASK [Include main variables] *************************************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
ok: [192.168.62.165]
TASK [Include system variables] ***********************************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
ok: [192.168.62.165]
TASK [Include OS-specific variables] ******************************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
ok: [192.168.62.165]
TASK [System information] *****************************************************************************************************************************************************************************************
ok: [192.168.62.186] => {
"system_info": {
"Architecture": "x86_64",
"CPU model": "Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz, count: 1, cores: 1",
"Disk space total": "18.58 GB",
"Kernel": "5.10.0-26-amd64",
"Memory": "0.91 GB",
"OS": "Debian 11.8",
"Product name": "VMware Virtual Platform",
"Virtualization type": "VMware"
}
}
ok: [192.168.62.187] => {
"system_info": {
"Architecture": "x86_64",
"CPU model": "Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz, count: 1, cores: 1",
"Disk space total": "18.58 GB",
"Kernel": "5.10.0-26-amd64",
"Memory": "0.91 GB",
"OS": "Debian 11.8",
"Product name": "VMware Virtual Platform",
"Virtualization type": "VMware"
}
}
ok: [192.168.62.185] => {
"system_info": {
"Architecture": "x86_64",
"CPU model": "Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz, count: 1, cores: 1",
"Disk space total": "18.58 GB",
"Kernel": "5.10.0-26-amd64",
"Memory": "0.91 GB",
"OS": "Debian 11.8",
"Product name": "VMware Virtual Platform",
"Virtualization type": "VMware"
}
}
ok: [192.168.62.165] => {
"system_info": {
"Architecture": "x86_64",
"CPU model": "Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz, count: 1, cores: 1",
"Disk space total": "18.58 GB",
"Kernel": "5.10.0-26-amd64",
"Memory": "0.91 GB",
"OS": "Debian 11.8",
"Product name": "VMware Virtual Platform",
"Virtualization type": "VMware"
}
}
TASK [pre-checks : Set max_connections from vars or use default] **************************************************************************************************************************************************
ok: [192.168.62.186] => (item={'option': 'max_connections', 'value': '500'})
TASK [pre-checks : PgBouncer | Calculate pool_size] ***************************************************************************************************************************************************************
ok: [192.168.62.186] => (item={'name': 'postgres', 'dbname': 'postgres', 'pool_parameters': ''})
TASK [pre-checks : PgBouncer | Calculate total pool_size] *********************************************************************************************************************************************************
ok: [192.168.62.186]
TASK [pre-checks : PgBouncer | Show total pool_size] **************************************************************************************************************************************************************
ok: [192.168.62.186] => {
"pgbouncer_total_pool_size": "20"
}
TASK [pre-checks : PostgreSQL | check that data directory "/var/lib/postgresql/16/main" is initialized] ***********************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [Update apt cache] *******************************************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
ok: [192.168.62.165]
TASK [Make sure the gnupg and apt-transport-https packages are present] *******************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
ok: [192.168.62.165]
TASK [Make sure that the iproute is installed] ********************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
ok: [192.168.62.165]
PLAY [etcd_cluster.yml | Deploy etcd Cluster] *********************************************************************************************************************************************************************
TASK [Include main variables] *************************************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
TASK [Include system variables] ***********************************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
TASK [Include OS-specific variables] ******************************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
PLAY [consul.yml | Configure Consul instances] ********************************************************************************************************************************************************************
skipping: no hosts matched
PLAY [deploy_pgcluster.yml | Postgres Cluster Configuration] ******************************************************************************************************************************************************
TASK [Gathering Facts] ********************************************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [Include main variables] *************************************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [Include system variables] ***********************************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [Include OS-specific variables] ******************************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
PLAY [balancers.yml | Configure HAProxy load balancers] ***********************************************************************************************************************************************************
TASK [Include main variables] *************************************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
TASK [Include system variables] ***********************************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
TASK [Include OS-specific variables] ******************************************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.185]
PLAY [deploy_pgcluster.yml | Install and configure pgBackRest] ****************************************************************************************************************************************************
TASK [Gathering Facts] ********************************************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
ok: [192.168.62.165]
TASK [Include main variables] *************************************************************************************************************************************************************************************
ok: [192.168.62.165]
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [Include OS-specific variables] ******************************************************************************************************************************************************************************
ok: [192.168.62.165]
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
PLAY [deploy_pgcluster.yml | PostgreSQL Cluster Deployment] *******************************************************************************************************************************************************
TASK [Gathering Facts] ********************************************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [Include main variables] *************************************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [Include system variables] ***********************************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [Include OS-specific variables] ******************************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [patroni : Prepare PostgreSQL | make sure PostgreSQL data directory "/var/lib/postgresql/16/main" exists] ****************************************************************************************************
ok: [192.168.62.187]
ok: [192.168.62.185]
ok: [192.168.62.186]
TASK [patroni : Prepare PostgreSQL | make sure the postgresql config files exists] ********************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [patroni : Prepare | Make sure the ansible required python library is exist] *********************************************************************************************************************************
ok: [192.168.62.187] => (item=pexpect==4.9.0)
ok: [192.168.62.185] => (item=pexpect==4.9.0)
ok: [192.168.62.186] => (item=pexpect==4.9.0)
changed: [192.168.62.187] => (item=ruamel.yaml==0.17.40)
changed: [192.168.62.185] => (item=ruamel.yaml==0.17.40)
changed: [192.168.62.186] => (item=ruamel.yaml==0.17.40)
TASK [patroni : Stop patroni service on the Replica servers (if running)] *****************************************************************************************************************************************
changed: [192.168.62.187]
changed: [192.168.62.186]
TASK [patroni : Stop patroni service on the Master server (if running)] *******************************************************************************************************************************************
changed: [192.168.62.185]
TASK [patroni : Remove patroni cluster "pg-cluster" from DCS (if exist)] ******************************************************************************************************************************************
changed: [192.168.62.185]
TASK [patroni : Run "/usr/bin/pgbackrest --stanza=pg-cluster --delta restore" on Master] **************************************************************************************************************************
changed: [192.168.62.185]
TASK [patroni : Run "/usr/bin/pgbackrest --stanza=pg-cluster --delta restore" on Replica] *************************************************************************************************************************
changed: [192.168.62.187]
changed: [192.168.62.186]
FAILED - RETRYING: [192.168.62.187]: Waiting for restore from backup (2880 retries left).
FAILED - RETRYING: [192.168.62.186]: Waiting for restore from backup (2880 retries left).
FAILED - RETRYING: [192.168.62.185]: Waiting for restore from backup (2880 retries left).
TASK [patroni : Waiting for restore from backup] ******************************************************************************************************************************************************************
changed: [192.168.62.187] => (item=True)
changed: [192.168.62.186] => (item=True)
changed: [192.168.62.185] => (item=True)
TASK [patroni : Start PostgreSQL for Recovery] ********************************************************************************************************************************************************************
changed: [192.168.62.185]
changed: [192.168.62.187]
changed: [192.168.62.186]
TASK [patroni : Waiting for PostgreSQL Recovery to complete (WAL apply)] ******************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [patroni : Check that PostgreSQL is stopped] *****************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [patroni : Stop PostgreSQL] **********************************************************************************************************************************************************************************
changed: [192.168.62.185]
changed: [192.168.62.186]
changed: [192.168.62.187]
TASK [patroni : Check the patroni.dynamic.json exists] ************************************************************************************************************************************************************
ok: [192.168.62.185]
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [patroni : Edit patroni.dynamic.json | disable archive_command (if enabled)] *********************************************************************************************************************************
changed: [192.168.62.186]
changed: [192.168.62.187]
changed: [192.168.62.185]
TASK [patroni : Edit patroni.yml | disable archive_command (if enabled)] ******************************************************************************************************************************************
changed: [192.168.62.185]
changed: [192.168.62.186]
changed: [192.168.62.187]
TASK [patroni : Start patroni service on the Master server] *******************************************************************************************************************************************************
changed: [192.168.62.185]
TASK [patroni : Wait for port 8008 to become open on the host] ****************************************************************************************************************************************************
ok: [192.168.62.185]
TASK [patroni : Check PostgreSQL is started and accepting connections on Master] **********************************************************************************************************************************
ok: [192.168.62.185]
TASK [patroni : Wait for the cluster to initialize (master is the leader with the lock)] **************************************************************************************************************************
ok: [192.168.62.185]
TASK [patroni : Make sure the Master is not in recovery mode] *****************************************************************************************************************************************************
ok: [192.168.62.185]
TASK [patroni : Make sure the superuser and replication users are present, and password does not differ from the specified] ***************************************************************************************
ok: [192.168.62.185] => (item=postgres)
ok: [192.168.62.185] => (item=replicator)
TASK [patroni : Make sure the postgresql users are present, and password does not differ from the specified] ******************************************************************************************************
ok: [192.168.62.185] => (item=pgbouncer)
TASK [patroni : Start patroni service on Replica servers] *********************************************************************************************************************************************************
changed: [192.168.62.186]
changed: [192.168.62.187]
TASK [patroni : Wait for port 8008 to become open on the host] ****************************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [patroni : Check that the patroni is healthy on the replica server] ******************************************************************************************************************************************
ok: [192.168.62.186]
ok: [192.168.62.187]
TASK [deploy-finish : Get postgresql users list] ******************************************************************************************************************************************************************
ok: [192.168.62.185]
TASK [deploy-finish : PostgreSQL list of users] *******************************************************************************************************************************************************************
ok: [192.168.62.185] => {
"users_result.stdout_lines": [
" List of roles",
" Role name | Attributes ",
"------------+------------------------------------------------------------",
" pgbouncer | ",
" postgres | Superuser, Create role, Create DB, Replication, Bypass RLS",
" replicator | Replication"
]
}
TASK [deploy-finish : Get postgresql database list] ***************************************************************************************************************************************************************
ok: [192.168.62.185]
TASK [deploy-finish : PostgreSQL list of databases] ***************************************************************************************************************************************************************
ok: [192.168.62.185] => {
"dbs_result.stdout_lines": [
" name | owner | encoding | collate | ctype | size | tablespace ",
"----------+----------+----------+-------------+-------------+---------+------------",
" postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | 7524 kB | pg_default",
"(1 row)"
]
}
TASK [deploy-finish : Check postgresql cluster health] ************************************************************************************************************************************************************
ok: [192.168.62.185]
TASK [deploy-finish : PostgreSQL Cluster health] ******************************************************************************************************************************************************************
ok: [192.168.62.185] => {
"patronictl_result.stdout_lines": [
"+ Cluster: pg-cluster (7312001105180283839) ----------------+----+-----------+",
"| Member | Host | Role | State | TL | Lag in MB |",
"+----------+----------------+---------+---------------------+----+-----------+",
"| pgnode01 | 192.168.62.186 | Replica | in archive recovery | 7 | 48 |",
"| pgnode02 | 192.168.62.187 | Replica | in archive recovery | 7 | 48 |",
"| pgnode03 | 192.168.62.185 | Leader | running | 10 | |",
"+----------+----------------+---------+---------------------+----+-----------+"
]
}
PLAY RECAP ********************************************************************************************************************************************************************************************************
192.168.62.165 : ok=11 changed=0 unreachable=0 failed=0 skipped=14 rescued=0 ignored=0
192.168.62.185 : ok=53 changed=10 unreachable=0 failed=0 skipped=45 rescued=0 ignored=0
192.168.62.186 : ok=46 changed=9 unreachable=0 failed=0 skipped=53 rescued=0 ignored=0
192.168.62.187 : ok=42 changed=9 unreachable=0 failed=0 skipped=50 rescued=0 ignored=0
passed
Issue: https://github.com/vitabaks/postgresql_cluster/issues/496
New versions of
ruamel.yaml
(0.18.x) are incompatible with the current version of the "yedit" module, which may lead to a PITR error during an attempt to edit thepatroni.yml
orpatroni.dynamic.json
parameter files.We set the dependencies version on earlier versions to avoid errors.
Fixed:
We will monitor the progress of fixing compatibility with more recent versions on the yedit project. If the module is no longer maintained, then perhaps in subsequent releases of postgresql_cluster we will abandon its use.