Deploy MySQL-MGR Without TopoLVM
This guide provides instructions for deploying MySQL Group Replication (MGR) instances on clusters where TopoLVM is not available, such as clusters running MicroOS (SUSE Linux Enterprise Micro) or other environments that use alternative storage provisioners.
TOC
BackgroundThe ChallengeThe SolutionPrerequisitesRequired OperatorsCluster RequirementsStep 1: Create a Local StorageClassStep 2: Provision Local PersistentVolumesCreate Directories on NodesCreate PV ResourcesStep 3 (Optional): Configure ClickHouse Storage Path on Read-Only FilesystemsConfigure hostPath before installing query-analytics-operatorFix an existing deployment with the wrong hostPathStep 4: Create a MySQL-MGR InstanceTroubleshootingPVCs Stuck in PendingMySQL Pods Stuck in CrashLoopBackOffMySQL Pods Fail with "data directory has files in it"PVs Stuck in Released StateInstance Stuck in ErrorReconcileClickHouse Pods Fail with "read-only file system"Background
The Challenge
MySQL-MGR typically relies on TopoLVM for dynamic volume provisioning. However, some environments do not support TopoLVM:
- MicroOS clusters: The root filesystem is read-only, and TopoLVM may not be installed.
- Bare-metal clusters: Some clusters use local storage with manual PV provisioning.
- Test/evaluation environments: Lightweight setups that don't include TopoLVM.
Without proper storage configuration, MySQL pods will fail to start due to PVC binding failures or permission issues.
The Solution
Use a local StorageClass with manually provisioned PersistentVolumes (PVs). This guide covers:
- Dependency installation: Ensure all required operators are installed before deploying MySQL-MGR.
- StorageClass creation: Set up a local StorageClass with
WaitForFirstConsumerbinding. - PV provisioning: Create local PVs with correct paths, permissions, and reclaim policies.
- ClickHouse storage fix (optional): Avoid the
read-only file systemerror caused by the query-analytics plugin's hardcoded host path. - Instance creation: Deploy MySQL-MGR using the local StorageClass.
Prerequisites
Required Operators
Before deploying MySQL-MGR, ensure the following core operators are installed on the cluster:
If you need query analytics features (slow query logging, query analysis), the following operators are also required:
On read-only filesystems (e.g., MicroOS), you must configure the ClickHouse storage path in the RdsInstaller CR before installing the query-analytics-operator. Otherwise, the operator will immediately create a ClickHouse PV at the default /cpaas/ck host path, which will fail with read-only file system. See Step 3 for details.
If your cluster uses TopoLVM, the topolvm-operator is also required. Since this guide covers non-TopoLVM deployments, it is not needed here.
You can verify that the operators are installed by checking their CSVs:
All operators should show Succeeded in the PHASE column.
Cluster Requirements
- At least 3 worker nodes are recommended for production deployments (MySQL-MGR requires 3 members for group replication quorum). Single-member deployments are possible for testing.
- Sufficient CPU and memory resources on each node.
- A writable directory path available on all nodes (e.g.,
/opt/local-pv/on MicroOS).
Step 1: Create a Local StorageClass
If your cluster does not already have a suitable StorageClass, create one:
volumeBindingMode: WaitForFirstConsumer is required so that PVs are bound only after a pod is scheduled to a specific node. This ensures data locality.
The StorageClass name is arbitrary. This guide uses mgr-local-pv to distinguish it from the Rancher local-path dynamic provisioner. You can use any name, but must reference it consistently in subsequent steps.
Step 2: Provision Local PersistentVolumes
Each MySQL-MGR member requires one PV. For a 3-member cluster, create at least 3 PVs, distributed across different nodes.
Create Directories on Nodes
On MicroOS, the root filesystem is read-only. Use /opt/local-pv/ as the base path:
- Path: On MicroOS, do not use
/dataor other root-level paths — they will fail withread-only file system. Use/opt/local-pv/instead. - Permissions:
chmod 777is a convenience workaround because MySQL containers run as a non-root user with a UID/GID that may not match the host. Without write permissions,mysqld --initializewill fail withPermission denied. For production environments, consider setting ownership to the specific UID used by the MySQL container (typically999:999) instead of using777. - Stale data: If reusing PV directories, remove all existing files first with
rm -rf /opt/local-pv/pvN/*. MySQL initialization fails if the data directory is not empty.
Create PV Resources
First, identify your node names:
Then create PVs, mapping each to a specific node. For a 3-member cluster across 3 nodes:
Verify that all PVs are created and available:
All PVs should show Available status before proceeding.
- Use
persistentVolumeReclaimPolicy: Deleteinstead ofRetain. WithRetain, PVs go toReleasedstate after PVC deletion and cannot be reused without manual cleanup. - Note that for manually provisioned local PVs, deleting the PV object does not automatically clean up the data on disk. You may still need to manually clear directories before reuse.
- Create more PVs than the minimum required to accommodate scaling and reprovisioning. However, extra PVs do not help with failover: if a node is lost, the PVs bound to it cannot be migrated. Recovery from node loss requires manual reprovisioning and data resync.
Step 3 (Optional): Configure ClickHouse Storage Path on Read-Only Filesystems
This step is only needed if you plan to use query analytics features (slow query logging, query analysis). If you do not use query analytics, skip this step — MySQL-MGR instances will function normally without it.
The query-analytics plugin deploys ClickHouse using a host directory PV. By default, the host path is /cpaas/ck. On MicroOS or other systems with a read-only root filesystem, this causes ClickHouse pods to fail with:
You must configure the hostPath before installing the query-analytics-operator. Once installed, the operator immediately reconciles and creates the ClickHouse PV with the default /cpaas/ck path, which will fail on read-only filesystems.
Configure hostPath before installing query-analytics-operator
-
Install the rds-operator first (if not already installed). The
RdsInstallerCR is created by the rds-operator during its initialization. -
Find the
RdsInstallerresource: -
Edit the
RdsInstallerto override the ClickHouse host path:Set
spec.slowSQLCK.hostPathto a writable path on the node:INFOOn MicroOS, use a path under
/opt/(e.g.,/opt/local-pv/ck). The directory will be created automatically withDirectoryOrCreatetype. -
Now install the clickhouse-operator and query-analytics-operator. The ClickHouse PV will be created using the configured path instead of the default
/cpaas/ck.
Fix an existing deployment with the wrong hostPath
If the query-analytics-operator was already installed with the default path and ClickHouse pods are failing, update the hostPath as above, then delete the existing PV and recreate the ClickHouse pods:
Step 4: Create a MySQL-MGR Instance
-
Create the password secret:
-
Create the MySQL CR with the local StorageClass:
INFO- The password secret must follow the naming convention
mgr-${instance_name}-password. The operator discovers it automatically by this name. - Set
storageClassName: mgr-local-pv(or your StorageClass name) in thevolumeClaimTemplatesection. This replaces the defaultsc-topolvm. - The
versionfield is required. Use"8.0"for MySQL 8.0.
- The password secret must follow the naming convention
-
Monitor the instance status:
Wait until the
STATEfield showsready. -
Verify PVC binding and pod placement:
Confirm that each PVC is bound to a PV and that pods are distributed across different nodes.
Troubleshooting
PVCs Stuck in Pending
Symptom: PVCs remain in Pending state and pods are not scheduled.
Cause: No available PVs match the StorageClass name or node affinity, or PVs are in Released state.
Fix:
MySQL Pods Stuck in CrashLoopBackOff
Symptom: MySQL pods crash with Permission denied during initialization.
Cause: PV directories do not have write permissions for the non-root MySQL user.
Fix:
MySQL Pods Fail with "data directory has files in it"
Symptom: mysqld --initialize fails because the data directory is not empty.
Cause: PV directory contains stale data from a previous deployment.
Fix:
PVs Stuck in Released State
Symptom: PVs show Released status and cannot be bound to new PVCs.
Cause: PVs were created with persistentVolumeReclaimPolicy: Retain.
Fix: Delete the Released PVs and recreate them with persistentVolumeReclaimPolicy: Delete:
Instance Stuck in ErrorReconcile
Symptom: The MySQL instance shows ErrorReconcile condition and the STATE field shows available instead of ready, even though all pods are running.
Cause: The operator's reconcile loop hit a conflict error updating the CR status.
Fix: Annotate the MySQL CR to trigger a fresh reconciliation:
ClickHouse Pods Fail with "read-only file system"
Symptom: ClickHouse pods fail to start with mkdir /cpaas: read-only file system.
Cause: The query-analytics plugin's default ClickHouse host path (/cpaas/ck) does not exist on read-only filesystems.
Fix: Follow Step 3 to set spec.slowSQLCK.hostPath in the RdsInstaller CR to a writable path.