I followed this document while configuring patroni and I have a problem with patroni.service file like this https://snapshooter.com/learn/postgresql/postgresql-cluster-patroni
[Unit]
Description=Runners to orchestrate a high-availability PostgreSQL
After=syslog.target network.target
[Service]
Type=simple
User=postgres
Group=postgres
ExecStart=/usr/local/bin/patroni /etc/patroni.yml
KillMode=process
TimeoutSec=30
Restart=no
[Install]
WantedBy=multi-user.targ
Here is my patroni.yml
scope: postgres
namespace: /db/
name: etcd1
restapi:
listen: 10.102.196.138:8008
connect_address: 10.102.196.138:8008
etcd:
hosts: 10.102.196.138:2379,10.102.196.139:2379,10.102.196.147:2379
bootstrap:
dcs:
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
postgresql:
use_pg_rewind: true
initdb:
- encoding: UTF8
- data-checksums
pg_hba:
- host replication all 127.0.0.1/32 md5
- host replication all 10.102.196.138/0 md5
- host replication all 10.102.196.139/0 md5
- host all all 0.0.0.0/0 md5
users:
admin:
password: admin
options:
- createrole
- createdb
postgresql:
listen: 10.102.196.138:5432
connect_address: 10.102.196.138:5432
data_dir: /data/patroni
pgpass: /tmp/pgpass
authentication:
replication:
username: replicator
password: password
superuser:
username: postgres
password: password
parameters:
unix_socket_directories: '.'
tags:
nofailover: false
noloadbalance: false
clonefrom: false
nosync: false
And I got this error:
[root@localhost ~]# sudo systemctl status patroni -l
● patroni.service - Runners to orchestrate a high-availability PostgreSQL
Loaded: loaded (/etc/systemd/system/patroni.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2021-05-24 23:24:26 +07; 7s ago
Process: 3307 ExecStart=/usr/local/bin/patroni /etc/patroni.yml (code=exited, status=1/FAILURE)
Main PID: 3307 (code=exited, status=1/FAILURE)
May 24 23:24:26 localhost.localdomain patroni[3307]: self.current_event = self.state()
May 24 23:24:26 localhost.localdomain patroni[3307]: File "/usr/local/lib64/python3.6/site-packages/yaml/parser.py", line 439, in parse_block_mapping_key
May 24 23:24:26 localhost.localdomain patroni[3307]: "expected <block end>, but found %r" % token.id, token.start_mark)
May 24 23:24:26 localhost.localdomain patroni[3307]: yaml.parser.ParserError: while parsing a block mapping
May 24 23:24:26 localhost.localdomain patroni[3307]: in "/etc/patroni.yml", line 1, column 1
May 24 23:24:26 localhost.localdomain patroni[3307]: expected <block end>, but found '<block mapping start>'
May 24 23:24:26 localhost.localdomain patroni[3307]: in "/etc/patroni.yml", line 38, column 2
May 24 23:24:26 localhost.localdomain systemd[1]: patroni.service: main process exited, code=exited, status=1/FAILURE
May 24 23:24:26 localhost.localdomain systemd[1]: Unit patroni.service entered failed state.
May 24 23:24:26 localhost.localdomain systemd[1]: patroni.service failed.
0 Answers