Maintenance, including MySQL admin or schema updates, should not be performed directly on a Primary as this may upset the replication and therefore availability and functionality of the Replicas which are reading from the Primary.
To effectively make the modifications, you should switch the Primary host, then operate on the Primary as if it were Replica, removing it from the replicator service configuration. This helps to minimize any problems or availability that might be cause by performing operations directly on the Primary.
The complete sequence and commands required to perform maintenance on an active Primary are shown in the table below. The table assumes a dataservice with three datasources:
Step | Description | Command | host1 | host2 | host3 |
---|---|---|---|---|---|
1 | Initial state | Primary | Replica | Replica | |
2 |
Switch Primary to host2
| See Section 7.11, “Switching Primary Hosts” | Replica | Primary | Replica |
3 | Put Replica into OFFLINE state | trepctl -host host1 offline | Offline | Primary | Replica |
4 | Perform maintenance | Offline | Primary | Replica | |
5 |
Validate the host1 server
configuration
| tpm validate | Offline | Primary | Replica |
6 | Put the Replica online | trepctl -host host1 online | Replica | Primary | Replica |
7 | Ensure the Replica has caught up | trepctl -host host1 status | Replica | Primary | Replica |
8 |
Switch Primary back to
host1
| See Section 7.11, “Switching Primary Hosts” | Primary | Replica | Replica |