Hello, Everyone
Currently i have a 3 nodes for Postgresql cluster with HAProxy, Patroni and Etcd.
For example:
node1, node2, node3.
i want to configure only switch between node1 <> node2 servers. node3 only for replication purpose. Means node3 no need Leader.
Thanks,
Hi,
Set nofailover tag to true for node3
@kostiantyn-nemchenko Thank you for your quick reply. It is working as i wish.
One more question.
So what is your suggestion about that? Should we use different data dir for patroni or can be same? Because I am new of patroni technology.
So when i reboot my OS, after patroni not work. Because postgresql started first. Should i disable postgresql from startup? What is the best way? I'm not sure, i guess if patroni and postgresql use same data dir, it should be work right?
Thank you.
Is it possible use same data directory patroni and postgres? Means: When i stop patroni and start only postgresql server, it different configuration.
Yes, you can do that. Patroni is not replacing postgres, it is just managing it.
So when i reboot my OS, after patroni not work. Because postgresql started first. Should i disable postgresql from startup
Yes, postgres autostart should be disabled. Otherwise, if postgres was running as master before shutdown or crash, there is a chance to get a split-brain.
If you need autostart, just do do it with Patroni: https://github.com/zalando/patroni/tree/master/extras/startup-scripts
Yes, postgres autostart should be disabled. Otherwise, if postgres was running as master before shutdown or crash, there is a chance to get a split-brain.
If you need autostart, just do do it with Patroni: https://github.com/zalando/patroni/tree/master/extras/startup-scripts
This is working well.
I have disable postgresql and enable patroni.
.
Yes, you can do that. Patroni is not replacing postgres, it is just managing it.
Currently i couldn't solve this problem. This is my configuration follows:
Same data_dir = '/data/patroni' config in /etc/patroni.yml and /etc/postgresql/9.5/main/postgresql.conf
Start postgresql without patroni. It could not start (postgres@postgres FATAL: the database system is starting up)
Also i tried to start different way like: /usr/sbin/pg_ctl -D /data/patroni -l /tmp/pgsql.log start
I got following error:
FATAL: could not start WAL streaming: ERROR: replication slot "postsqlmaster04" does not exist
recovery.conf file /data/patroni
primary_slot_name = 'postsqlmaster04'
standby_mode = 'on'
recovery_target_timeline = 'latest'
primary_conninfo = 'user=replicator password=post host=192.168.15.205 port=5432 sslmode=prefer sslcompression=1 application_name=postsqlmaster04'
So how can i start it? or how to move patroni data to postgresql data?
Please provide me some tutorial. Because i guess, in come case i will start postgres without patroni.
Thanks
Most helpful comment
Hi,
Set nofailover tag to
truefor node3