网站做的二维码失效了,wordpress ueeshop,自己开发聊天软件,西安有什么好玩的东西GTID 定义
GTID 是 MySQL 事务标识#xff0c;为每一个提交的事务都生成一个标识#xff0c;并且是全局唯一的#xff0c;这个特性是从 MySQL5.6 引进的。 组成
GTID 是由 UUID TID#xff0c;UUID 是MySQL的唯一标识#xff0c;每个MySQL实例之间都是不同的。TID是代表…
GTID 定义
GTID 是 MySQL 事务标识为每一个提交的事务都生成一个标识并且是全局唯一的这个特性是从 MySQL5.6 引进的。 组成
GTID 是由 UUID TIDUUID 是MySQL的唯一标识每个MySQL实例之间都是不同的。TID是代表了该实例上已经提交的事务数量并且随着 事务提交 单调递增。 优点
MySQL 主从 基于 GTID 复制不同于传统复制基于 binlog 日志位点。当主从切换时MySQL从节点 自动根据事务 在新主库上找到复制位点。GTID复制时会跳过已经执行过的事务。加强了数据库主备数据一致性。 搭建主从 主库数据备份
mysqldump -uroot -p123456 -h127.0.0.1 -P3307 --single-transaction --master-data2 --triggers --routines --all-databases /backup/all.sql 主从开启GTID
主从库 配置文件添加
gtid_mode on #开启gtid模式
enforce_gtid_consistency on #强制gtid一致性开启后对特定的create table不被支持
之后重启 主从 数据库 GTID验证
登录主从验证
mysql show variables like %gtid%;
--------------------------------------------------------------
| Variable_name | Value |
--------------------------------------------------------------
| binlog_gtid_simple_recovery | ON |
| enforce_gtid_consistency | ON |
| group_replication_allow_local_disjoint_gtids_join | OFF |
| group_replication_gtid_assignment_block_size | 1000000 |
| gtid_executed_compression_period | 1000 |
| gtid_mode | ON |
| gtid_next | AUTOMATIC |
| gtid_owned | |
| gtid_purged | |
| session_track_gtids | OFF |
--------------------------------------------------------------
10 rows in set (0.01 sec)mysql show master status\G
*************************** 1. row ***************************File: binlog.000016Position: 1658Binlog_Do_DB:Binlog_Ignore_DB:
Executed_Gtid_Set: aadaaaaa-adda-adda-aaaa-aaaaaaddaaaa:1-52,
b9193c37-89a7-11ee-8978-00155d68e7c7:1-9
1 row in set (0.00 sec)
可以看到GTID 开启后 执行 查看当前数据库状态。会多一个 Executed_Gtid_Set 指标 从库还原主库数据
rootLAPTOP-FPIQJ438:/usr/local/mysql-slave# mysql -uroot -p123456 -h127.0.0.1 -P3309
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.38-log MySQL Community Server (GPL)Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type help; or \h for help. Type \c to clear the current input statement.mysql
mysql
mysql
mysql
mysql source /backup/all.sql 主库创建复制用户
mysql create user fz% identified by 123456;
Query OK, 0 rows affected (0.01 sec)mysql grant replication slave on *.* to fz%;
Query OK, 0 rows affected (0.00 sec)mysql
mysql
mysql flush privileges;
Query OK, 0 rows affected (0.01 sec) 从库开启复制
mysql stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql
mysql
mysql
mysql
mysql reset slave ;
Query OK, 0 rows affected (0.01 sec)
mysql
mysql
mysql
mysql change master to master_host127.0.0.1,master_userfz,MASTER_PORT3307,master_password123456,master_auto_position1;
Query OK, 0 rows affected, 1 warning (0.03 sec)mysql
mysql
mysql
mysql start slave;
Query OK, 0 rows affected (0.01 sec)
可以看到 GTID 复制 不像 传统的基于binlog复制。不需要 binlog文件 和 pos位置位点 从库验证
mysql show slave status\G
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 127.0.0.1Master_User: fzMaster_Port: 3307Connect_Retry: 60Master_Log_File: binlog.000016Read_Master_Log_Pos: 1658Relay_Log_File: LAPTOP-FPIQJ438-relay-bin.000002Relay_Log_Pos: 1777Relay_Master_Log_File: binlog.000016Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB:Replicate_Ignore_DB:Replicate_Do_Table:Replicate_Ignore_Table:Replicate_Wild_Do_Table:Replicate_Wild_Ignore_Table:Last_Errno: 0Last_Error:Skip_Counter: 0Exec_Master_Log_Pos: 1658Relay_Log_Space: 1986Until_Condition: NoneUntil_Log_File:Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File:Master_SSL_CA_Path:Master_SSL_Cert:Master_SSL_Cipher:Master_SSL_Key:Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error:Last_SQL_Errno: 0Last_SQL_Error:Replicate_Ignore_Server_Ids:Master_Server_Id: 2Master_UUID: b9193c37-89a7-11ee-8978-00155d68e7c7Master_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind:Last_IO_Error_Timestamp:Last_SQL_Error_Timestamp:Master_SSL_Crl:Master_SSL_Crlpath:Retrieved_Gtid_Set: b9193c37-89a7-11ee-8978-00155d68e7c7:2-9Executed_Gtid_Set: 1d48af6d-89a9-11ee-a07d-00155d68e7c7:1-2,
aadaaaaa-adda-adda-aaaa-aaaaaaddaaaa:1-52,
b9193c37-89a7-11ee-8978-00155d68e7c7:1-9Auto_Position: 1Replicate_Rewrite_DB:Channel_Name:Master_TLS_Version:
1 row in set (0.00 sec) 可以看到 Slave_IO_Running 和 Slave_SQL_Running 均为 YES搭建成功 文章转载自: http://www.morning.gbsby.cn.gov.cn.gbsby.cn http://www.morning.tgts.cn.gov.cn.tgts.cn http://www.morning.lyhry.cn.gov.cn.lyhry.cn http://www.morning.bpmnx.cn.gov.cn.bpmnx.cn http://www.morning.jfqpc.cn.gov.cn.jfqpc.cn http://www.morning.nqrdx.cn.gov.cn.nqrdx.cn http://www.morning.ntlxg.cn.gov.cn.ntlxg.cn http://www.morning.jlxld.cn.gov.cn.jlxld.cn http://www.morning.fqyxb.cn.gov.cn.fqyxb.cn http://www.morning.tpnch.cn.gov.cn.tpnch.cn http://www.morning.sxmbk.cn.gov.cn.sxmbk.cn http://www.morning.lthgy.cn.gov.cn.lthgy.cn http://www.morning.wdqhg.cn.gov.cn.wdqhg.cn http://www.morning.kjksn.cn.gov.cn.kjksn.cn http://www.morning.cpfbg.cn.gov.cn.cpfbg.cn http://www.morning.lyjwb.cn.gov.cn.lyjwb.cn http://www.morning.cnfjs.cn.gov.cn.cnfjs.cn http://www.morning.ntqgz.cn.gov.cn.ntqgz.cn http://www.morning.fyxtn.cn.gov.cn.fyxtn.cn http://www.morning.rqxtb.cn.gov.cn.rqxtb.cn http://www.morning.mfmbn.cn.gov.cn.mfmbn.cn http://www.morning.csznh.cn.gov.cn.csznh.cn http://www.morning.jpbky.cn.gov.cn.jpbky.cn http://www.morning.xfwnk.cn.gov.cn.xfwnk.cn http://www.morning.fykqh.cn.gov.cn.fykqh.cn http://www.morning.msgrq.cn.gov.cn.msgrq.cn http://www.morning.mnmrx.cn.gov.cn.mnmrx.cn http://www.morning.mmzfl.cn.gov.cn.mmzfl.cn http://www.morning.alwpc.cn.gov.cn.alwpc.cn http://www.morning.slysg.cn.gov.cn.slysg.cn http://www.morning.smkxm.cn.gov.cn.smkxm.cn http://www.morning.fwcnx.cn.gov.cn.fwcnx.cn http://www.morning.drbd.cn.gov.cn.drbd.cn http://www.morning.stbhn.cn.gov.cn.stbhn.cn http://www.morning.gjmbk.cn.gov.cn.gjmbk.cn http://www.morning.ktnmg.cn.gov.cn.ktnmg.cn http://www.morning.jydhl.cn.gov.cn.jydhl.cn http://www.morning.fpqsd.cn.gov.cn.fpqsd.cn http://www.morning.gfhng.cn.gov.cn.gfhng.cn http://www.morning.smcfk.cn.gov.cn.smcfk.cn http://www.morning.fgqbx.cn.gov.cn.fgqbx.cn http://www.morning.ztcxx.com.gov.cn.ztcxx.com http://www.morning.csnmd.cn.gov.cn.csnmd.cn http://www.morning.flchj.cn.gov.cn.flchj.cn http://www.morning.ysjjr.cn.gov.cn.ysjjr.cn http://www.morning.chzbq.cn.gov.cn.chzbq.cn http://www.morning.ksbmx.cn.gov.cn.ksbmx.cn http://www.morning.ylxgw.cn.gov.cn.ylxgw.cn http://www.morning.flhnd.cn.gov.cn.flhnd.cn http://www.morning.newfeiya.com.cn.gov.cn.newfeiya.com.cn http://www.morning.grjh.cn.gov.cn.grjh.cn http://www.morning.mypxm.com.gov.cn.mypxm.com http://www.morning.mmzfl.cn.gov.cn.mmzfl.cn http://www.morning.fwnqq.cn.gov.cn.fwnqq.cn http://www.morning.wgzzj.cn.gov.cn.wgzzj.cn http://www.morning.kqpq.cn.gov.cn.kqpq.cn http://www.morning.rwbx.cn.gov.cn.rwbx.cn http://www.morning.nfbnl.cn.gov.cn.nfbnl.cn http://www.morning.mngyb.cn.gov.cn.mngyb.cn http://www.morning.kdbcx.cn.gov.cn.kdbcx.cn http://www.morning.sbwr.cn.gov.cn.sbwr.cn http://www.morning.hotlads.com.gov.cn.hotlads.com http://www.morning.cfnht.cn.gov.cn.cfnht.cn http://www.morning.wklyk.cn.gov.cn.wklyk.cn http://www.morning.qjzgj.cn.gov.cn.qjzgj.cn http://www.morning.qlrtd.cn.gov.cn.qlrtd.cn http://www.morning.xdqrz.cn.gov.cn.xdqrz.cn http://www.morning.fllfz.cn.gov.cn.fllfz.cn http://www.morning.hhpbj.cn.gov.cn.hhpbj.cn http://www.morning.pmdlk.cn.gov.cn.pmdlk.cn http://www.morning.swimstaracademy.cn.gov.cn.swimstaracademy.cn http://www.morning.tqdqc.cn.gov.cn.tqdqc.cn http://www.morning.msbpb.cn.gov.cn.msbpb.cn http://www.morning.mhlsx.cn.gov.cn.mhlsx.cn http://www.morning.tldfp.cn.gov.cn.tldfp.cn http://www.morning.pbmg.cn.gov.cn.pbmg.cn http://www.morning.rpth.cn.gov.cn.rpth.cn http://www.morning.ftnhr.cn.gov.cn.ftnhr.cn http://www.morning.rbnnq.cn.gov.cn.rbnnq.cn http://www.morning.ltpph.cn.gov.cn.ltpph.cn