Online GTID deployment
source link: https://www.percona.com/doc/percona-server/5.6/flexibility/online_gtid_deployment.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Online GTID deployment¶
Percona Server for MySQL now supports Online GTID deployment. This enables GTID to be deployed on existing replication setups without making the master read-only and stopping all the slaves. This feature was ported from the Facebook branch. Before this feature was implemented deploying the GTID replication on already existing replication setups required making a master read_only
, shutting down all MySQL instances in the replica set simultaneously at the same position, enabling the gtid_mode
variable in my.cnf
, and then starting all of the instances. NOTE: This feature does not provide means to disable GTIDs online. Disabling GTIDs online is available in Percona Server for MySQL 5.7.
With gtid_deployment_step
enabled, a host cannot generate GTID values on its own, but if GTID logged events are received through replication stream from master, they will be logged.
Performing the online GTID deployment¶
The online GTID deployment procedure can be done with the following steps:
replicas:
gtid_mode
=ON
andgtid_deployment_step
=ON
master:
gtid_mode
=OFF
andgtid_deployment_step
=OFF
On each replica, one at a time, restart the MySQL server to enable gtid_mode
and gtid_deployment_step
. Afterward, we are in a state where every replica has gtid_mode
set to ON
and gtid_deployment_step
set to ON
, but the master still has gtid_mode
set to OFF
and gtid_deployment_step
set to OFF
. NOTE: in order to successfully restart the slaves enforce-gtid-consistency
needs to be enabled as well.
new master:
gtid_mode
=ON
andgtid_deployment_step
=OFF
rest of the replicas:
gtid_mode
=ON
andgtid_deployment_step
=ON
old master:
gtid_mode
=OFF
andgtid_deployment_step
=OFF
Perform a master promotion as normal, i.e. set the gtid_mode
to ON
and gtid_deployment_step
to OFF
, re-pointing the replicas and original master to the new master. The original master’s replication will intentionally break when started, since it still has the variable gtid_mode
set to OFF
and gtid_deployment_step
to OFF
.
new master:
gtid_mode
=ON
andgtid_deployment_step
=OFF
rest of the replicas:
gtid_mode
=ON
old master:
gtid_mode
=ON
Restart the original master to enable gtid_mode
. It will now be able to replicate from the new master, and the entire replica set now has gtid_mode
set to ON
. You can now set the gtid_deployment_step
to OFF
.
Version Specific Information¶
5.6.22-72.0
: Feature ported from the Facebook branch
System Variables¶
variablegtid_deployment_step
¶
Version Info: |
|
---|---|
Command Line: | |
Config File: | |
Scope: | Global |
Dynamic: | |
Default Value: |
When this variable is enabled, a host cannot generate GTIDs on its own, but if GTID logged events are received through replication stream from the master, they will be logged.
The conditions for dynamic switching the gtid_deployment_step
off are the same as for read_only variable:
- If you attempt to enable
gtid_deployment_step
while you have any explicit locks (acquired withLOCK TABLES
) or have a pending transaction, an error occurs.- If you attempt to enable
gtid_deployment_step
while other clients hold explicit table locks or have pending transactions, the attempt blocks until the locks are released and the transactions end. While the attempt to enablegtid_deployment_step
is pending, requests by other clients for table locks or to begin transactions also block untilgtid_deployment_step
has been set.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK