16.1.3 Replication with Global Transaction Identifiers16.1.3.1 GTID 的概念16.1.3.2 配置GTID 主从复制16.1.3.3 使用GTID 做Failover 和Scaleout16.1.3.4 GTID 的限制 16.1.3.1 GTID 的概念GTID = source_id:transaction_id source_id: 一般情况下使用的是server_uuid。 transaction_id: A sequence number determined by the order in which the transaction was committed on this server.0 不能作为事务号。 GTID Sets mysql.gtid_executed Table mysql.gtid_executed Table Compression 16.1.3.2 配置GTID 主从环境
将数据库设置为read-only状态
set @@global.read_only = on; 2. 停止每个数据库mysqladmin -uusername -p shutdown 3. 将数据库启动到GTID状态需要添加的参数gtid_mode = on enforce_gtid_consistency = true从库端需要添加的参数避免启动从库的时候会立刻启动IO, SQL进程 --skip-slave-start 4. 从库端配置GTID-based auto-positioning change master to master_host = 'host', master_port = 3306, master_user = user,master_password = 'password',master_auto_position = 1; start slave; 5. 关闭 read-only modeset @@global.read_only = off; 16.1.3.3 GTIDs在Failover 和Scaleout中的应用16.1.3.4 GTIDs在复制中的限制
