Patroni: how to update patroni cluster?

Created on 8 Apr 2017  路  3Comments  路  Source: zalando/patroni

How I can update patroni cluster which is running in top of kubernetes (provisioned using helm charts)

Lets say that currently i have patroni running with pg 9.6, but in future i need to upgrade that to 9.7. How to do that? I do not see any instructions in this repo

question

Most helpful comment

Hi @zetab,

You can use the pause/resume mode in order to turn off automatic failovers on the cluster, stop the postgres on the master pod, run pg_upgrade there, then start your postgres (with the new version) and then running resume. There will be two things to fix afterwards:

  • in a statefulset generated by the helm chart the PostgreSQL version (bindir inside the environment variable SPILO_CONFIGURATION) should be updated manually. After the statefulset is updated, all pods will reinitialize with the new version. It will have no effect on a master (since you have already updated it and started with the new PostgreSQL version manually), but the replicas won't start because of the mismatch between the old old datadir and the new version of PostgreSQL. Therefore, the next step is
  • reinitialize all replicas (patronictl reinit).

There could be some caveat, namely, postgresql.conf variables that has changed between 9.x and 10, or even names of the directories (pg_wal vs pg_xlog), so we would appreciate your feedback if you actually try to do it.

All 3 comments

Your question is not about Patroni, but about PostgreSQL. Patroni does not upgrade PostgreSQL.
If you need upgrade PostgreSQL you need stop all nodes in cluster. Manual upgrade and run new version.

Hi @zetab,

You can use the pause/resume mode in order to turn off automatic failovers on the cluster, stop the postgres on the master pod, run pg_upgrade there, then start your postgres (with the new version) and then running resume. There will be two things to fix afterwards:

  • in a statefulset generated by the helm chart the PostgreSQL version (bindir inside the environment variable SPILO_CONFIGURATION) should be updated manually. After the statefulset is updated, all pods will reinitialize with the new version. It will have no effect on a master (since you have already updated it and started with the new PostgreSQL version manually), but the replicas won't start because of the mismatch between the old old datadir and the new version of PostgreSQL. Therefore, the next step is
  • reinitialize all replicas (patronictl reinit).

There could be some caveat, namely, postgresql.conf variables that has changed between 9.x and 10, or even names of the directories (pg_wal vs pg_xlog), so we would appreciate your feedback if you actually try to do it.

Ok, thanks for information!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rootqa picture rootqa  路  9Comments

patsevanton picture patsevanton  路  3Comments

phemmer picture phemmer  路  5Comments

kmoppel picture kmoppel  路  8Comments

Tekchanddagar picture Tekchanddagar  路  4Comments