Managing MySQL Configurations with the PXC KubernetesIn part one of this series, we introduced the different ways to manage MySQL configurations. In this post, we will walk through different possibilities and the changes happening while modifying MySQL configurations with the operator.

Percona Distribution for MySQL Operator based on Percona XtraDB Cluster (PXC) provides three ways for managing MySQL, but the question is, what is the precedence among options? We will walk through several cases of using MySQL configs. For the sake of simplicity, we will play with the values of the Galera cache to see the effects.

CASE-1: Modify Percona XtraDB Cluster object

If PXC object is not yet present, configurations can be edited in the cr.yaml and applied with kubectl apply -f cr.yaml. Configuration will then be placed in .spec.pxc.configuration :

After applying the changes and verifying the configuration:

An interesting observation is when we add MySQL configuration into the PXC object, the ConfigMap named cluster1-pxc (cluster1-pxc in this case) is automatically created. This could be observed in the following snippet where the loop instruction was started before the kubectl apply command:

If we check the content of ConfigMap, we can see that MySQL configuration from PXC object is written.

Now let’s change the gcache size from 64M to 128M in cr.yaml and apply the changes with kubectl apply -f cr.yaml :

PXC object got changed and also the ConfigMap values will be changed:

ConfigMap cluster1-pxc  is automatically reconciled by the operator to reflect the values of PXC object.

CASE-2: When MySQL configuration is present in both PXC object and ConfigMap and ConfigMap is modified

Following up on CASE-1, let’s try to edit the ConfigMap and see the behavior.

Configmap changes of gcache size from 128M to 256M (changed with kubectl edit cm cluster1-pxc):

As it can be seen from the below output, the operator reconciles the ConfigMap and reverts the setting of the PXC object to ConfigMap.Configuration in PXC object takes precedence over ConfigMap if both are present.

Added comments to make explain the transition:

CASE-3: Modifying the ConfigMap cluster1-pxc when there is no MySQL configuration in PXC object

Let’s clean up the MySQL configuration in PXC object. This is done by removing the configuration section of PXC in cr.yaml and applying changes with kubectl apply -f cr.yaml.

After applying the changes, PXC object can be verified:

Now let’s create a ConfigMap cluster1-pxc with MySQL configurations:

An interesting point to observe is PXC object is not updated:

However, the changes are reflected in DB after pods are recycled and updated with the new configuration:

In part three of this series, we see the precedence when secrets are used for MySQL configurations in PXC Operator. Check it out!

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments