# Setting read\_only on a replication slave cluster gets overwritten

**URL:** <https://forums.percona.com/t/setting-read-only-on-a-replication-slave-cluster-gets-overwritten/19967>\
**Category:** Percona Operator for MySQL\
**Tags:** mysql, percona\
**Created:** [February 7, 2023, 7:01pm UTC](https://forums.percona.com/t/setting-read-only-on-a-replication-slave-cluster-gets-overwritten/19967 "2023-02-07T19:01:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtye](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mtye](https://forums.percona.com/u/mtye)\
**Post date:** [February 7, 2023, 7:01pm UTC](https://forums.percona.com/t/setting-read-only-on-a-replication-slave-cluster-gets-overwritten/19967/1 "2023-02-07T19:01:29Z")

</div>

Hi,  
I’m using the 1.12 XtraDB operator on Openshift 4.10.37.  
I have 2 openshift clusters and I’m replicating happily between the master and the slave.

Ideally, I’d like to have 2 way replication (XtraDB in each cluster is both a master and a slave).

Is this supported ?

What would the YMAL look like ?

Thanks

Malc

---

<div class="post-metadata">

**Author:** ![Slava\_Sarzhan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/slava_sarzhan/32/3196_2.png) [@Slava\_Sarzhan](https://forums.percona.com/u/Slava_Sarzhan)\
**Post date:** [February 7, 2023, 7:34pm UTC](https://forums.percona.com/t/setting-read-only-on-a-replication-slave-cluster-gets-overwritten/19967/2 "2023-02-07T19:34:44Z")

</div>

hi @mtye ,

Do you want to have something like that?

 ![photo_2023-02-07 21.32.40](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/1/18f5bf99820cc9eafafec35a2877ad2a605c3013.jpeg)

---

<div class="post-metadata">

**Author:** ![mtye](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mtye](https://forums.percona.com/u/mtye)\
**Post date:** [February 7, 2023, 8:13pm UTC](https://forums.percona.com/t/setting-read-only-on-a-replication-slave-cluster-gets-overwritten/19967/3 "2023-02-07T20:13:19Z")

</div>

Yes. @Slava_Sarzhan

The 2 way replication is to make GR recovery easier. I’ll be setting 1 side into read\_only.

thanks

Malc

---

<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:** [February 7, 2023, 8:38pm UTC](https://forums.percona.com/t/setting-read-only-on-a-replication-slave-cluster-gets-overwritten/19967/4 "2023-02-07T20:38:03Z")

</div>

@mtye,  
In your original post you said XtraDB cluster, but then just above you said GR (Group replication). These are not the same. Please clarify which you are using.

---

<div class="post-metadata">

**Author:** ![mtye](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mtye](https://forums.percona.com/u/mtye)\
**Post date:** [February 7, 2023, 9:56pm UTC](https://forums.percona.com/t/setting-read-only-on-a-replication-slave-cluster-gets-overwritten/19967/5 "2023-02-07T21:56:48Z")

</div>

Hi @matthewb. The GR I’m referring to is Geographical Redundancy.

---

<div class="post-metadata">

**Author:** ![mtye](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mtye](https://forums.percona.com/u/mtye)\
**Post date:** [February 8, 2023, 6:26pm UTC](https://forums.percona.com/t/setting-read-only-on-a-replication-slave-cluster-gets-overwritten/19967/6 "2023-02-08T18:26:42Z")

</div>

I’ve written the YAML for the 2 way replication.

Site 1 :

```auto
spec:
  pxc:
    replicationChannels:
    - name: pxc1_to_pxc2
      isSource: true
    - name: pxc2_to_pxc1
      isSource: false
      configuration:
        sourceRetryCount: 3
        sourceConnectRetry: 60
        ssl: false
        sslSkipVerify: true
        ca: '/etc/mysql/ssl/ca.crt'
      sourcesList:
      - host: 10.224.77.4
        port: 3306
        weight: 100
      - host: 10.224.77.5
        port: 3306
        weight: 100
      - host: 10.224.77.6
        port: 3306
        weight: 100

```

Site 2 :

```auto
spec:
  pxc:
    replicationChannels:
    - name: pxc1_to_pxc2
      isSource: false
      configuration:
        sourceRetryCount: 3
        sourceConnectRetry: 60
        ssl: false
        sslSkipVerify: true
        ca: '/etc/mysql/ssl/ca.crt'
      sourcesList:
      - host: 10.224.76.2
        port: 3306
        weight: 100
      - host: 10.224.76.3
        port: 3306
        weight: 100
      - host: 10.224.76.5
        port: 3306
        weight: 100
    - name: pxc2_to_pxc1
      isSource: true

```

After applying it on the respective sites, the slave status on both Openshift clusters is only for pxc1\_to\_pxc2.

On site1, I’d expect the Channel\_name to be pxc2\_to\_pxc1 and the Master\_Host to be one of the 10.224.77.X addresses.

Site 1

```auto
mysql> show slave status\G
***************************1. row***************************
               Slave_IO_State:
                  Master_Host: 10.224.76.5
                  Master_User: replication
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000008
          Read_Master_Log_Pos: 2618
               Relay_Log_File: cluster1-pxc-0-relay-bin-pxc1_to_pxc2.000002
                Relay_Log_Pos: 367
        Relay_Master_Log_File: binlog.000008
             Slave_IO_Running: No
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 2618
              Relay_Log_Space: 779
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 0
                  Master_UUID: 4acc0a05-a6d7-11ed-ab20-0a580a8d2873
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State:
           Master_Retry_Count: 3
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set:
            Executed_Gtid_Set: c7162d6f-a6d1-11ed-bc02-0a580a8d2bd6:1-6,
e4dc0ad5-a6d1-11ed-960d-0a5eede1c5a1:1-15
                Auto_Position: 1
         Replicate_Rewrite_DB:
                 Channel_Name: pxc1_to_pxc2
           Master_TLS_Version:
       Master_public_key_path:
        Get_master_public_key: 0
            Network_Namespace:
1 row in set, 1 warning (0.01 sec)

```

Site 2 :

```auto
mysql> show slave status \G
***************************1. row***************************
               Slave_IO_State:
                  Master_Host: 10.224.76.5
                  Master_User: replication
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000008
          Read_Master_Log_Pos: 2618
               Relay_Log_File: cluster1-pxc-0-relay-bin-pxc1_to_pxc2.000002
                Relay_Log_Pos: 411
        Relay_Master_Log_File: binlog.000008
             Slave_IO_Running: No
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 1110
              Relay_Log_Space: 3251
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 0
                  Master_UUID: 4acc0a05-a6d7-11ed-ab20-0a580a8d2873
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State:
           Master_Retry_Count: 3
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set: e4dc0ad5-a6d1-11ed-960d-0a5eede1c5a1:10-14
            Executed_Gtid_Set: b915eec4-a6d9-11ed-bb39-0a580a29288a:1-12,
e10ac66a-a6d9-11ed-9524-c641570b8577:1-20,
e4dc0ad5-a6d1-11ed-960d-0a5eede1c5a1:1-9
                Auto_Position: 1
         Replicate_Rewrite_DB:
                 Channel_Name: pxc1_to_pxc2
           Master_TLS_Version:
       Master_public_key_path:
        Get_master_public_key: 0
            Network_Namespace:
1 row in set, 1 warning (0.01 sec)

```

Any ideas ?

Setting read\_only now seems to persist (the original reason for creating the post), I guess the operator maybe sets read\_only=0 periodically on a slave instance ?

Thanks

---

<div class="post-metadata">

**Author:** ![Slava\_Sarzhan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/slava_sarzhan/32/3196_2.png) [@Slava\_Sarzhan](https://forums.percona.com/u/Slava_Sarzhan)\
**Post date:** [February 23, 2023, 2:56pm UTC](https://forums.percona.com/t/setting-read-only-on-a-replication-slave-cluster-gets-overwritten/19967/7 "2023-02-23T14:56:45Z")

</div>

Hi @mtye ,

Currently we do not support two way replication in PXC operator. You can create JIRA task for us, and we will discuss it and add to our roadmap.

---

<div class="post-metadata">

**Author:** ![mtye](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mtye](https://forums.percona.com/u/mtye)\
**Post date:** [February 24, 2023, 5:10pm UTC](https://forums.percona.com/t/setting-read-only-on-a-replication-slave-cluster-gets-overwritten/19967/8 "2023-02-24T17:10:12Z")

</div>

@Slava_Sarzhan thanks for confirming that. I’ll raise a jira for it
