tencent cloud

TDSQL Boundless

Release Notes
Product Introduction
Overview
Scenarios
Product Architecture
Instance Types
Compatibility Notes
Kernel Features
Kernel Overview
Kernel Version Release Notes
Functionality Features
Performance Features
Billing
Billing Overview
Purchase Method
Pricing Details
Renewal
Overdue Payments
Refund
Getting Started
Creating an Instance
Connect to Instances
User Guide
Data Migration
Data Subscription
Instance Management
Configuration Change
Parameter Configuration
Account Management
Security Group
Backup and Restoration
Database Auditing
Tag Management
Use Cases
Technical Evolution and Usage Practices of Online DDL
Lock Mechanism Analysis and Troubleshooting Practices
Data Intelligent Scheduling and Related Practices for Performance Optimization
TDSQL Boundless Selection Guide and Practical Tutorial
Developer Guide
Developer Guide (MySQL Compatibility Mode)
Developer Guide (HBase Compatibility Mode)
Performance Tuning
Performance Tuning Overview
SQL Tuning
DDL Tuning
Performance White Paper
Performance Overview
TPC-C Test
Sysbench Test
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Security Group APIs
Task APIs
Backup APIs
Rollback APIs
Parameter APIs
Database APIs
Data Types
Error Codes
General Reference
System Architecture
SQL Reference
Database Parameter Description
TPC-H benchmark data model reference
Error Code Information
Security and Compliance
FAQs
Agreements
Service Level Agreement
Terms of Service
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

ALTER INSTANCE TRANSFER LEADER

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-02-10 11:24:30

Description

The ALTER INSTANCE TRANSFER LEADER statement is used to transfer the leader node (Leader Node) of a specified Replication Group (RG) to another node within the instance. This statement allows users to designate a new leader node and optionally enforce the leadership transfer.

Permission Requirements

The ALTER INSTANCE TRANSFER LEADER requires the current user to have SUPER privileges.

Syntax

ALTER INSTANCE TRANSFER LEADER {RG | REP_GROUP} rep_group_id TO [NODE] new_leader_node [FORCE];

Parameter Description

Parameter
Required
Description
rep_group_id
Required
Specify the replication group ID for which to transfer the leader node.
new_leader_node
Required
Designate the new leader node.
FORCE
Optional
Indicates a forced leadership transfer.

Examples

1. Retrieve the information of leader_node_name for RG1792.
As shown below, leader_node_name is node-tdsql3-86ea1ffe-002.
tdsql>select * from INFORMATION_SCHEMA.META_CLUSTER_RGS where rep_group_id=1792 \\G
*************************** 1. row ***************************
rep_group_id: 1792
data_space_type: DATA_SPACE_TYPE_SYSTEM
rep_group_state: RG_STATE_L_WORKING
meta_version: 36
member_version: 0
key_range_version: 36
quorum: 3
member_node_names: [node-tdsql3-86ea1ffe-001, node-tdsql3-86ea1ffe-002, node-tdsql3-86ea1ffe-003]
leader_node_name: node-tdsql3-86ea1ffe-002
last_leader_report_time: 2024-08-20 11:30:07.277221
create_time: 2024-08-19 14:56:47.692831
parent_rep_group_id: 0
rep_group_stats_approximate_size: 9722004
rep_group_stats_approximate_keys: 3826
rep_group_log_info_current_term: 9
rep_group_log_info_committed_index: 30704
rep_group_log_info_consecutive_applied_index: 30704
rep_group_log_info_last_snapshot_index: 30683
rep_group_log_info_first_index: 2
rep_group_log_info_last_index: 30704
rep_group_log_info_disk_index: 30704
rep_group_log_info_applied_index: 30704
rep_group_log_info_raft_log_sync_delay_seconds: 11
1 row in set (0.02 sec)
2. Transfer the leader node of replication group 1792 to node-tdsql3-86ea1ffe-003.
tdsql>ALTER INSTANCE TRANSFER LEADER RG 1792 TO 'node-tdsql3-86ea1ffe-003';
Query OK, 0 rows affected (0.01 sec)
job_id: 17373
3. Recheck the information of leader_node_name for RG1792.
As shown below, the leader node has been transferred to node-tdsql3-86ea1ffe-003.
tdsql>select * from INFORMATION_SCHEMA.META_CLUSTER_RGS where rep_group_id=1792 \\G
*************************** 1. row ***************************
rep_group_id: 1792
data_space_type: DATA_SPACE_TYPE_SYSTEM
rep_group_state: RG_STATE_L_WORKING
meta_version: 36
member_version: 0
key_range_version: 36
quorum: 3
member_node_names: [node-tdsql3-86ea1ffe-001, node-tdsql3-86ea1ffe-002, node-tdsql3-86ea1ffe-003]
leader_node_name: node-tdsql3-86ea1ffe-003
last_leader_report_time: 2024-08-20 11:30:46.123801
create_time: 2024-08-19 14:56:47.692831
parent_rep_group_id: 0
rep_group_stats_approximate_size: 9727537
rep_group_stats_approximate_keys: 3837
rep_group_log_info_current_term: 10
rep_group_log_info_committed_index: 30719
rep_group_log_info_consecutive_applied_index: 30719
rep_group_log_info_last_snapshot_index: 30663
rep_group_log_info_first_index: 2
rep_group_log_info_last_index: 30719
rep_group_log_info_disk_index: 30719
rep_group_log_info_applied_index: 30719
rep_group_log_info_raft_log_sync_delay_seconds: 2
1 row in set (0.01 sec)

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백