Hi Team,
I’ve tried deploying HA(High Availability) for the Percona PostgreSql(14.15) as per the below wiki
In the " Configure Patroni¶: phase, The patroni service failed to start on all the nodes(1,2,3)
sudo systemctl restart patroni
root@node1:/etc/systemd/system# sudo systemctl status patroni
× patroni.service - PostgreSQL high-availability manager
Loaded: loaded (/lib/systemd/system/patroni.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2025-01-20 18:30:33 IST; 7s ago
Process: 3228190 ExecStart=/usr/bin/patroni ${PATRONI_CONFIG_LOCATION} (code=exited, status=1/FAILURE)
Main PID: 3228190 (code=exited, status=1/FAILURE)
CPU: 326ms
1月 20 18:30:33 node2 systemd[1]: patroni.service: Scheduled restart job, restart counter is at 5.
1月 20 18:30:33 node2 systemd[1]: Stopped PostgreSQL high-availability manager.
1月 20 18:30:33 node2 systemd[1]: patroni.service: Start request repeated too quickly.
1月 20 18:30:33 node2 systemd[1]: patroni.service: Failed with result 'exit-code'.
1月 20 18:30:33 node2 systemd[1]: Failed to start PostgreSQL high-availability manager.
And this is the error for “sudo journalctl -fu patroni”
sudo journalctl -fu patroni
1月 20 18:30:32 node2 patroni[3228190]: raise ScannerError(None, None,
1月 20 18:30:32 node2 patroni[3228190]: yaml.scanner.ScannerError: mapping values are not allowed here
1月 20 18:30:32 node2 patroni[3228190]: in "/etc/patroni/patroni.yml", line 2, column 10
1月 20 18:30:32 node2 systemd[1]: patroni.service: Main process exited, code=exited, status=1/FAILURE
1月 20 18:30:32 node2 systemd[1]: patroni.service: Failed with result 'exit-code'.
1月 20 18:30:33 node2 systemd[1]: patroni.service: Scheduled restart job, restart counter is at 5.
1月 20 18:30:33 node2 systemd[1]: Stopped PostgreSQL high-availability manager.
1月 20 18:30:33 node2 systemd[1]: patroni.service: Start request repeated too quickly.
1月 20 18:30:33 node2 systemd[1]: patroni.service: Failed with result 'exit-code'.
1月 20 18:30:33 node2 systemd[1]: Failed to start PostgreSQL high-availability manager
Seems this was an yaml indexing issue,
yamllint /etc/patroni/patroni.yml
/etc/patroni/patroni.yml
2:10 error syntax error: mapping values are not allowed here (syntax)
14:81 error line too long (101 > 80 characters) (line-length)
38:81 error line too long (88 > 80 characters) (line-length)
48:81 error line too long (116 > 80 characters) (line-length)
50:81 error line too long (88 > 80 characters) (line-length)
61:25 error trailing spaces (trailing-spaces)
Have changed /etc/patroni/patroni.yml file as below
---
echo "
namespace:percona_lab
scope:cluster_1
name:node1
restapi:{listen:0.0.0.0:8008,connect_address:127.0.0.1:8008}
etcd3:{host:127.0.0.1:2379}
bootstrap:{dcs:{ttl:30,loop_wait:10,retry_timeout:10,maximum_lag_on_failover:1048576,
postgresql:{use_pg_rewind:true,use_slots:true,parameters:{wal_level:replica,hot_standby:'on',
wal_keep_segments:10,max_wal_senders:5,max_replication_slots:10,wal_log_hints:'on',
logging_collector:'on',max_wal_size:'10GB',archive_mode:'on',archive_timeout:600s,
archive_command:'cp -f %p /home/postgres/archived/%f'}}},
initdb:[{encoding:UTF8},{data-checksums}],
pg_hba:[{host:replication,replicator:'127.0.0.1/32',method:trust},
{host:replication,replicator:'0.0.0.0/0',method:md5},
{host:all,all:'0.0.0.0/0',method:md5},
{host:all,all:'::0/0',method:md5}],
users:{admin:{password:qaz123,options:[createrole,createdb]},
percona:{password:qaz123,options:[createrole,createdb]}}}
postgresql:{cluster_name:cluster_1,listen:0.0.0.0:5432,connect_address:127.0.0.1:5432,
data_dir:${DATA_DIR},bin_dir:${PG_BIN_DIR},pgpass:/tmp/pgpass0,
authentication:{replication:{username:replicator,password:replPasswd},
superuser:{username:postgres,password:qaz123}},
parameters:{unix_socket_directories:'/var/run/postgresql/'},
create_replica_methods:[basebackup],
basebackup:{checkpoint:'fast'}}
tags:{nofailover:false,noloadbalance:false,clonefrom:false,nosync:false}
" | sudo tee /etc/patroni/patroni.yml
Now, I’ve solved the yaml indexing. After this I’m getting this below error while starting the service after re-enabling the service
Kindly help us starting this service