Background
In a database system, the primary-secondary switch is one of the important means for ensuring the high availability of a database. Primary-secondary switch allows a secondary node to take over the work of a primary node to ensure system continuity and stability upon failure of the primary node. Tencent Smart Advisor-Chaotic Fault Generator provides a fault action for simulating a scene of TDSQL for MySQL primary-secondary switch. You can verify the overall high availability of your business TDSQL for MySQL through this fault action.
Primary-secondary switch experiments are intended to help developers in system tests and experiments in a more complex and realistic environment so that possible problems and risks can be identified. Through experiments and tests in chaos engineering, developers can have a more comprehensive understanding of system operating modes and performance characteristics so that they can develop countermeasures and policies for different fault scenes to improving system stability and availability.
Note:
Primary-secondary switch will switch the primary node of the instance to another secondary node. It can be used to simulate a switch upon occurrence of an availability zone or node fault. Disconnection may occur during the switch.
There are two ways of fault injection:
1. Prioritize injection in the same availability zone: Secondary node in the same availability zone will be selected as the target node for switch. If there is no node satisfying the condition, switchable secondary node will be searched in other availability zones.
2. Prioritize cross-availability zone injection: Cross-availability zone secondary node across will be preferentially selected as the target node for switch. If there is no node satisfying the condition, switchable secondary node will be searched in the same availability zone.
Experiment Implementation
Step 1: Experiment Preparation
A TencentDB for TDSQL for MySQL instance, which has the deployment mode of one primary and two secondary nodes.
Step 2: Experiment Orchestration
2. Click Skip at the lower left quarter and create a new blank experiment.
3. Fill in the experiment information, and select Object Type TDSQL for MySQL.
4. Add an instance and click Add Now to add a fault action.
5. Select Primary-secondary switch fault, and configure fault action parameters.
Configure fault parameters. For an experiment instance, switch mode is configured as Prefer switching across availability zones.
6. After the action parameter configuration is completed, click Next. After all configurations are confirmed, click Submit to complete experiment creation.
Step 3: Experiment Execution
During fault execution, the TDSQL for MySQL instance primary-secondary switch will be triggered. Primary-secondary node architecture change in the instance can be observed through Cloud Database TDSQL Console. Go to Experiment Details, click Execute to start executing an experiment.
After a successful fault execution, primary node change can be observed through Cloud Database TDSQL Console. The primary node has been switched from the original primary availability zone to the cross-availability zone secondary availability zone node. Execute fault recovery action to recover the instance to the state before the fault.
Recovery from a fault will trigger another primary-secondary switch, and TDSQL console instance information will show the switch.
After a successful recovery, it can be seen through the console that the node has been recovered to the pre-fault state.
Was this page helpful?