0

If I am in topologyMode Single-Primary, it's possible to switchover the primary instance between machines in the cluster? I did not find anything in the documentation.

Ie: in my lab I have:

topology": {
            "mysql0:3306": {
                "address": "mysql0:3306",
                "memberRole": "PRIMARY",
                "mode": "R/W",
                "readReplicas": {},
                "role": "HA",
                "status": "ONLINE",
                "version": "5.7.42"
            },
            "mysql1:3306": {
                "address": "mysql1:3306",
                "memberRole": "SECONDARY",
                "mode": "R/O",
                "readReplicas": {},
                "role": "HA",
                "status": "ONLINE",
                "version": "5.7.42"

How to switch mysql1 as primary?

Update:

Seems to have the command cluster.setPrimaryInstance() but it did not work in MySQL 5.7, only 8.0. So, there isn't a way to do it in MySQL 5.7?

Rick James
  • 80,479
  • 5
  • 52
  • 119
Astora
  • 841
  • 5
  • 28
  • 64

1 Answers1

0

First, MySQL 5.7 has been EOL since October 2023, so I highly recommend upgrading to 8.x.

About your specific question:

.setPrimaryInstance() is not supported on MySQL 5.7. That has been introduced in 8.0.13.

To forcefully change the primary in that case, you'd need to trigger auto-failover by shutting down Group Replication on mysql0. Then you can rejoin it when mysql1 takes over as the primary member.

Miguel Araújo
  • 310
  • 1
  • 7