Hi!
I am using the Percona Operator for MySQL 1.10 with the following cr.yaml:
apiVersion: pxc.percona.com/v1
kind: PerconaXtraDBCluster
metadata:
finalizers:
- delete-pxc-pods-in-order
- delete-proxysql-pvc
- delete-pxc-pvc
name: db-cluster
namespace: nicky-test
spec:
allowUnsafeConfigurations: true
crVersion: 1.10.0
haproxy:
enabled: false
logcollector:
enabled: true
image: percona/percona-xtradb-cluster-operator:1.10.0-logcollector
proxysql:
affinity:
antiAffinityTopologyKey: kubernetes.io/hostname
enabled: true
gracePeriod: 30
image: percona/percona-xtradb-cluster-operator:1.10.0-proxysql
podDisruptionBudget:
maxUnavailable: 1
size: 3
volumeSpec:
persistentVolumeClaim:
resources:
requests:
storage: 6G
storageClassName: local-path
pxc:
affinity:
antiAffinityTopologyKey: kubernetes.io/hostname
autoRecovery: true
gracePeriod: 600
image: percona/percona-xtradb-cluster:8.0.26-16.1
podDisruptionBudget:
maxUnavailable: 1
size: 3
volumeSpec:
persistentVolumeClaim:
resources:
requests:
storage: 6G
storageClassName: local-path
secretsName: db-cluster-db-secrets
upgradeOptions:
apply: 8.0-recommended
schedule: 0 4 * * *
versionServiceEndpoint: https://check.percona.com
After waiting until the cluster is up, I manually loaded a database dump I created with mysqldump
from some other database. This works fine.
However, if I then want to dump this database again, I am running into issues.
What I do:
kubectl run --rm -it --image=ubuntu test-pod
mysqldump --opt --skip-lock-tables --skip-add-locks -uroot -psupersecret -hdb-cluster-proxysql mydbhere
The error I am getting:
mysqldump: Error: 'ProxySQL Error: connection is locked to hostgroup 11 but trying to reach hostgroup 10' when trying to dump tablespaces
mysqldump: Couldn't execute 'SELECT engine, table_type FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = DATABASE() AND table_name = 'cake_d_c_users_phinxlog'': ProxySQL Error: connection is locked to hostgroup 11 but trying to reach hostgroup 10 (9006)
This seems to be because the set @
's at the top will lock me to hostgroup 11 (the writer hostgroup), but then mysqldump wants to use hostgroup 10 to select data from the table schema.
I tried searching the internet for solutions, but I don’t know what the best approach is. Of course I could change the query rules to send everything to the writer, but that is clearly not what we want.
I also saw something about setting mysql-set_query_lock_on_hostgroup
, which could work? But how do I set this with the operator? I saw I could set configuration:
in the CR, but if I try:
configuration: |
mysql_variables=
{
set_query_lock_on_hostgroup=0
}
I get errors during startup of the pod. Do I need to specify the whole file? Or should I copy the default mysql_variables
from the pod and add my line? Or do I also need the datadir
line like the example in the documentation? I’m a bit lost and hope anyone can help.
Thanks!