我对这里的patroni有意见
[postgres@localhost ~]$ patroni /etc/patroni.yml
2021-05-25 11:39:56,767 INFO: Selected new etcd server http://10.102.196.138:2379
2021-05-25 11:39:56,772 INFO: No PostgreSQL configuration items changed, nothing to reload.
2021-05-25 11:39:56,831 INFO: Lock owner: None; I am etcd1
2021-05-25 11:39:56,836 INFO: trying to bootstrap a new cluster
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".
Data page checksums are enabled.
creating directory /data/patroni ... initdb: error: could not create directory "/data/patroni": Permission denied
pg_ctl: database system initialization failed
2021-05-25 11:39:56,877 INFO: removing initialize key after failed attempt to bootstrap the cluster
Traceback (most recent call last):
File "/usr/local/bin/patroni", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/site-packages/patroni/__init__.py", line 170, in main
return patroni_main()
File "/usr/local/lib/python3.6/site-packages/patroni/__init__.py", line 138, in patroni_main
abstract_main(Patroni, schema)
File "/usr/local/lib/python3.6/site-packages/patroni/daemon.py", line 100, in abstract_main
controller.run()
File "/usr/local/lib/python3.6/site-packages/patroni/__init__.py", line 108, in run
super(Patroni, self).run()
File "/usr/local/lib/python3.6/site-packages/patroni/daemon.py", line 59, in run
self._run_cycle()
File "/usr/local/lib/python3.6/site-packages/patroni/__init__.py", line 111, in _run_cycle
logger.info(self.ha.run_cycle())
File "/usr/local/lib/python3.6/site-packages/patroni/ha.py", line 1457, in run_cycle
info = self._run_cycle()
File "/usr/local/lib/python3.6/site-packages/patroni/ha.py", line 1351, in _run_cycle
return self.post_bootstrap()
File "/usr/local/lib/python3.6/site-packages/patroni/ha.py", line 1247, in post_bootstrap
self.cancel_initialization()
File "/usr/local/lib/python3.6/site-packages/patroni/ha.py", line 1240, in cancel_initialization
raise PatroniFatalException('Failed to bootstrap cluster')
patroni.exceptions.PatroniFatalException: 'Failed to bootstrap cluster'
这是我的 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
[postgres@localhost ~]$ ls /data/
patroni_2021-05-25-11-03-59
有人可以帮忙吗?
答案1
看起来这可能是一件简单的事情?
could not create directory "/data/patroni": Permission denied
您能否验证 /data 目录是否具有创建目录的正确权限?尝试转到 /data 目录并手动运行:
$ mkdir patroni