0

If I have stolon cluster on let's say 3 hosts what is the right way to apply liquibase changes?
Should I always choose master-node host? And what will happen if I choose replica host instead of master?
What will happen if I try to run the same liquibase script on each node (e.g. I have all three nodes listed in my ansible scripts and don't know yet how to choose master stolon host by ansible scripts and decide run scrips on each host just in case).
Are there examples of ansible playbooks for this task? Which jdbc url should I address?

jdbc:postgresql://{{postgres_host}}:{{stolon_postgres_port}}/{{postgres_database}}

or

jdbc:postgresql://{{postgres_host}}:{{stolon_proxy_port}}/{{postgres_database}}

Or where can I read anything about these issues?

P.S. It seems using proxy's port is the right way
P.S.S. The way is to execute migration on any host - proxy will transfer execution to master node any way. But do it only once - it can be done by run_once ansible key

  • 1
    Looks like you figured it out, right? Use the proxy port so that it's correctly routed to whatever the master is and that liquibase just has to be called once since the changes will propagate to all the psotgresql replicas? Liquibase has a datatabasechangeloglock table that only allows one liquibase instance to run at a time and the others wait. If you try running liquibase without the run_once ansible key, do you hit problems? Or it is just less efficient as liquibase runs only to say "nothing to deploy"? – Nathan Voxland Oct 06 '22 at 14:34
  • Yes, I experimented with cluster a little, scripts' effect propagates. My reasons for running scrips only once are mostly additional risk to ruin data. Well I guess risks of running the same liquibase scripts on the same cluster several times might be low. But I am not too familiar with LB and I suspect there are ways to shoot one's leg with smth like poorly written scripts. And my suspicions even higher with such a complex thing as cluster. – Alexander Kolinchenko Oct 12 '22 at 19:50

0 Answers0