For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

Change database roles

Sometimes it might be necessary to change the roles of the existing database instances, for example, to perform maintenance on the database node. In this case, you need to assign the primary role to another database instance.

To do this, run the following command in the orchestrator's container:

bash

Replace each placeholder with an appropriate value:

  • MYSQL-POD-NAME - MySQL server pod name.
  • MYSQL-CR-NAME - the Custom Resource name of the MySQL cluster. You can find it using the kubectl get perconaservermysqls -n {NAMESPACE} command.
  • NAMESPACE - the Kubernetes namespace where the MySQL instance is running

The command sets the MySQL server running in the MYSQL-POD-NAME as the primary.

Important

After the roles switch, HAProxy continues to hold the old connections. Only the new connections are established to the new primary. The affected application is responsible for reacting to the MySQL 1290Opens in a new tab error code and reconnecting.