# Xtradb operator - mysql multimaster and replica

**URL:** <https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525>\
**Category:** Percona XtraDB Cluster\
**Tags:** percona\
**Created:** [April 8, 2025, 6:12am UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525 "2025-04-08T06:12:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giuseppe\_Miraglia](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/giuseppe_miraglia/32/20681_2.png) [@Giuseppe\_Miraglia](https://forums.percona.com/u/Giuseppe_Miraglia)\
**Post date:** [April 8, 2025, 6:12am UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525/1 "2025-04-08T06:12:11Z")

</div>

Good morning  
Is the procedure in the link below also valid in case of installation of Mysql Multimaster?

> **[Percona Operator for MySQL - Multi-cluster and multi-region deployment](https://docs.percona.com/percona-operator-for-mysql/pxc/replication.html)**
>
> The cross-site replication involves configuring one Percona XtraDB Cluster as Source, and another Percona XtraDB Cluster as Replica to allow an asynchronous replication between them:

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [April 8, 2025, 11:59am UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525/2 "2025-04-08T11:59:08Z")

</div>

Hello @Giuseppe_Miraglia,  
Can you please explain what you mean by ‘Mysql Multimaster’? The docs you linked are for running our Operator for PXC in Kubernetes.

---

<div class="post-metadata">

**Author:** ![Giuseppe\_Miraglia](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/giuseppe_miraglia/32/20681_2.png) [@Giuseppe\_Miraglia](https://forums.percona.com/u/Giuseppe_Miraglia)\
**Post date:** [April 8, 2025, 1:48pm UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525/3 "2025-04-08T13:48:45Z")

</div>

When i follow the guide in the this link

> **[Percona Operator for MySQL - Multi-cluster and multi-region deployment](https://docs.percona.com/percona-operator-for-mysql/pxc/replication.html)**
>
> The cross-site replication involves configuring one Percona XtraDB Cluster as Source, and another Percona XtraDB Cluster as Replica to allow an asynchronous replication between them:

i receive the error at line 331 in this page

> <https://github.com/percona/percona-xtradb-cluster-operator/blob/main/pkg/apis/pxc/v1/pxc_types.go>

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [April 8, 2025, 2:47pm UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525/4 "2025-04-08T14:47:57Z")

</div>

The documentation you are referencing is for ‘multi-cluster’, not ‘multi-master’. In fact, if you look at the same source [code file, just a few lines up](https://github.com/percona/percona-xtradb-cluster-operator/blob/main/pkg/apis/pxc/v1/pxc_types.go#L321), you see we don’t support multi-master.

Can you please explain what your end goal is? Typical PXC has 3 nodes; 1 node is writer, and the other 2 are readers. It is _extremely rare_ to have PXC configured where all 3 nodes are writers.

Additionally, the docs you linked are for configuring a ‘source PXC’ replicating to a ‘replica PXC’. These are not configured in a way that you would write to either cluster. You always write to a single node within a single cluster.

---

<div class="post-metadata">

**Author:** ![Giuseppe\_Miraglia](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/giuseppe_miraglia/32/20681_2.png) [@Giuseppe\_Miraglia](https://forums.percona.com/u/Giuseppe_Miraglia)\
**Post date:** [April 8, 2025, 5:24pm UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525/5 "2025-04-08T17:24:39Z")

</div>

Sorry, I was imprecise in the instructions. I installed following the instructions at this link, using haproxy

> **[Percona Operator for MySQL - Install with Helm](https://docs.percona.com/percona-operator-for-mysql/pxc/helm.html#installation)**
>
> Helm is the package manager for Kubernetes. Percona Helm charts can be found in percona/percona-helm-charts repository on Github.

After I used the directions for multisite replication  
But I received the error indicated in the previous post

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [April 8, 2025, 7:06pm UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525/6 "2025-04-08T19:06:56Z")

</div>

Please share your full cr.yaml so we can examine.

---

<div class="post-metadata">

**Author:** ![Giuseppe\_Miraglia](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/giuseppe_miraglia/32/20681_2.png) [@Giuseppe\_Miraglia](https://forums.percona.com/u/Giuseppe_Miraglia)\
**Post date:** [April 11, 2025, 9:37am UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525/7 "2025-04-11T09:37:21Z")

</div>

Sorry for delay.

My error:

 ![immagine](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/3X/5/b/5b13cd7c2d4437fd68553f5044150b023d921886.png)

Operator values:  
COMPUTED VALUES:  
USER-SUPPLIED VALUES: null

```auto
affinity: {}
containerSecurityContext: {}
disableTelemetry: false
extraEnvVars: []
fullnameOverride: ""
image: ""
imagePullPolicy: IfNotPresent
imagePullSecrets: []
logLevel: INFO
logStructured: false
nameOverride: ""
nodeSelector:
  wrk: apigw-db
operatorImageRepository: percona/percona-xtradb-cluster-operator
podAnnotations: {}
rbac:
  create: true
replicaCount: 1
resources:
  limits:
    cpu: 200m
    memory: 500Mi
  requests:
    cpu: 100m
    memory: 20Mi
serviceAccount:
  create: true
tolerations: []
watchAllNamespaces: false

Db value:
USER-SUPPLIED VALUES:
annotations: {}
crVersion: 1.16.1
enableCRValidationWebhook: false
enableVolumeExpansion: false
finalizers:
- percona.com/delete-pxc-pods-in-order
fullnameOverride: ""
haproxy:
  affinity:
    antiAffinityTopologyKey: kubernetes.io/hostname
  annotations: {}
  enabled: true
  gracePeriod: 30
  image: percona/haproxy:2.8.11
  imagePullPolicy: IfNotPresent
  imagePullSecrets: []
  labels: {}
  livenessDelaySec: 300
  livenessProbes:
    failureThreshold: 4
    initialDelaySeconds: 60
    periodSeconds: 30
    successThreshold: 1
    timeoutSeconds: 5
  nodeSelector:
    wrk: apigw-db
  podDisruptionBudget:
    maxUnavailable: 1
  readinessDelaySec: 15
  readinessProbes:
    failureThreshold: 3
    initialDelaySeconds: 15
    periodSeconds: 5
    successThreshold: 1
    timeoutSeconds: 1
  resources:
    limits: {}
    requests:
      cpu: 600m
      memory: 1G
  sidecarPVCs: []
  sidecarResources:
    limits: {}
    requests: {}
  sidecarVolumes: []
  sidecars: []
  size: 3
  tolerations: []
ignoreAnnotations: []
ignoreLabels: []
logcollector:
  enabled: true
  image: percona/percona-xtradb-cluster-operator:1.16.1-logcollector-fluentbit3.2.2
  imagePullPolicy: IfNotPresent
  imagePullSecrets: []
  resources:
    limits: {}
    requests:
      cpu: 200m
      memory: 100M
nameOverride: ""
operatorImageRepository: percona/percona-xtradb-cluster-operator
pause: false
pxc:
  affinity:
    antiAffinityTopologyKey: kubernetes.io/hostname
  annotations: {}
  autoRecovery: true
  certManager: false
  gracePeriod: 600
  image:
    repository: percona/percona-xtradb-cluster
    tag: 8.4.3-3.1
  imagePullPolicy: IfNotPresent
  imagePullSecrets: []
  labels: {}
  livenessDelaySec: 300
  livenessProbes:
    failureThreshold: 3
    initialDelaySeconds: 300
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
  [spoiler]
***replicationChannels:***
 ***- name: na_to_ba***
 ***isSource: true***
[/spoiler]
  expose:
    enabled: true
    type: LoadBalancer
  nodeSelector:
    wrk: apigw-db
  persistence:
    accessMode: ReadWriteOnce
    enabled: true
    size: 2Gi
  podDisruptionBudget:
    maxUnavailable: 1
  readinessDelaySec: 15
  readinessProbes:
    failureThreshold: 5
    initialDelaySeconds: 15
    periodSeconds: 30
    successThreshold: 1
    timeoutSeconds: 15
  resources:
    limits: {}
    requests:
      cpu: 600m
      memory: 1G
  sidecarPVCs: []
  sidecarResources:
    limits: {}
    requests: {}
  sidecarVolumes: []
  sidecars: []
  size: 3
  tolerations: []
secrets:
  tls: {}
tls:
  enabled: true
updateStrategy: SmartUpdate
upgradeOptions:
  apply: disabled
  schedule: 0 4 * * *
  versionServiceEndpoint: https://check.percona.com

```

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [April 11, 2025, 3:49pm UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525/8 "2025-04-11T15:49:59Z")

</div>

I don’t see the replica configuration in your cr.yaml. If you look at this example, [Multi-cluster and multi-region deployment - Percona Operator for MySQL](https://docs.percona.com/percona-operator-for-mysql/pxc/replication.html#configuring-cross-site-replication-on-replica-instances), you can see two sections for `replicationChannels:` one for the source, and one for replicas. Can you add the replica config into your cr?

---

<div class="post-metadata">

**Author:** ![Giuseppe\_Miraglia](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/giuseppe_miraglia/32/20681_2.png) [@Giuseppe\_Miraglia](https://forums.percona.com/u/Giuseppe_Miraglia)\
**Post date:** [April 11, 2025, 4:58pm UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525/9 "2025-04-11T16:58:37Z")

</div>

I use helm.  
Do I need to insert the source section and the replica section in both the source and replica clusters?  
I understood that in the master cluster I had to set the replicationchannel only once for each installation. Setting it to true on the master and false on the replica  
I only posted the master values, because it’s the one that gives me the error

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [April 11, 2025, 7:19pm UTC](https://forums.percona.com/t/xtradb-operator-mysql-multimaster-and-replica/37525/10 "2025-04-11T19:19:36Z")

</div>

I’m looking at the code, [percona-xtradb-cluster-operator/pkg/apis/pxc/v1/pxc\_types.go at main · percona/percona-xtradb-cluster-operator · GitHub](https://github.com/percona/percona-xtradb-cluster-operator/blob/main/pkg/apis/pxc/v1/pxc_types.go#L320-L332)

if c.PXC.ReplicationChannels \> 0, which you have, then look at first entry, ReplicationChannels[0].IsSource and set isSrc. In your case, that’s “true”. Then, loop over all c.PXC.ReplicationChannels. Check if .Name has issues. Then check if isSrc (set to true just above) is not equal to this same key, which on first iteration of the loop matches ReplicationChannels[0].IsSource.

Seems to me that it should be passing the check since we are comparing the same path.key to itself.

I would open a bug at [https://jira.percona.com/](https://jira.percona.com/) so our developers can investigate this further. Be sure to supply your ENTIRE cr.yaml (without comments)
