How to automatically start replication on the cluster1-pxc-0 pod only

We are planning to eventually upgrade to a Percona XtraDB cluster for our primary databases. However, we are currently using the Percona XtraDB Cluster for our read replicas. One of the pods (cluster1-pxc-0) is configured to be a slave of our primary MySQL database and that takes care of synching with the other pods. We’ve setup our pxc configuration to have skip-slave-start so that it does not start replication on the other 2 pods. However, we want replication to be automatically started on cluster1-pxc-0 because if the pod restarts, replication stops.

Any ideas on how to automatically start replication on only one pod?

1 Like

That sounds tricky and the only way I can think about is using side car containers.
We do not have it yet, but they will be supported in the next Operator release, see

Then by exposing POD name you can run a custom script in a side car container, for example using:

I did not test it, just an idea I would try

1 Like