MariaDB基于GTID的复制
admin
2023-05-24 17:03:14
0

1、配置主从节点的服务配置文件


1.1、配置master节点:

#binlog_format=mixed

binlog-format=ROW


# required unique id between 1 and 2^32 - 1

# defaults to 1 if master-host is not set

# but will not function as a master if omitted

server-id       = 1


log-slave-updates=true

master-info-repository=TABLE

relay-log-info-repository=TABLE

sync-master-info=1

slave-parallel-threads=2

binlog-checksum=CRC32

master-verify-checksum=1

slave-sql-verify-checksum=1

binlog-rows-query-log_events=1

report-port=3306

report-host=www.pancou.com


1.2、配置slave节点:

[mysqld]

#binlog_format=mixed

binlog-format=ROW


# required unique id between 1 and 2^32 - 1

# defaults to 1 if master-host is not set

# but will not function as a master if omitted

server-id       = 2


log-slave-updates=true

master-info-repository=TABLE

relay-log-info-repository=TABLE

sync-master-info=1

slave-parallel-threads=2

binlog-checksum=CRC32

master-verify-checksum=1

slave-sql-verify-checksum=1

binlog-rows-query-log_events=1

report-port=3306

report-host=www.pancou.com



MariaDB [(none)]> change master to master_host='192.168.110.128',master_port=3306,master_user='repl_user',master_password='pancou',master_use_gtid=current_pos;

Query OK, 0 rows affected (0.06 sec)


MariaDB [(none)]> start slave;

Query OK, 0 rows affected (0.01 sec)


MariaDB [(none)]> change master to master_host='192.168.110.130',master_port=3306,master_host='repl_user',master_password='pancou',master_use_gtid=current_pos;

Query OK, 0 rows affected (0.03 sec)


MariaDB [(none)]> start slave;

Query OK, 0 rows affected (0.02 sec)


MariaDB [(none)]> show slave status\G

*************************** 1. row ***************************

               Slave_IO_State: Connecting to master

                  Master_Host: repl_user

                  Master_User: repl_user

                  Master_Port: 3306

                Connect_Retry: 60

              Master_Log_File: 

          Read_Master_Log_Pos: 4

               Relay_Log_File: www-relay-bin.000001

                Relay_Log_Pos: 4

        Relay_Master_Log_File: 

             Slave_IO_Running: Connecting

            Slave_SQL_Running: Yes

              Replicate_Do_DB: 

          Replicate_Ignore_DB: 

           Replicate_Do_Table: 

       Replicate_Ignore_Table: 

      Replicate_Wild_Do_Table: 

  Replicate_Wild_Ignore_Table: 

                   Last_Errno: 0

                   Last_Error: 

                 Skip_Counter: 0

          Exec_Master_Log_Pos: 4

              Relay_Log_Space: 248

              Until_Condition: None

               Until_Log_File: 

                Until_Log_Pos: 0

           Master_SSL_Allowed: No

           Master_SSL_CA_File: 

           Master_SSL_CA_Path: 

              Master_SSL_Cert: 

            Master_SSL_Cipher: 

               Master_SSL_Key: 

        Seconds_Behind_Master: NULL

Master_SSL_Verify_Server_Cert: No

                Last_IO_Errno: 0

                Last_IO_Error: 

               Last_SQL_Errno: 0

               Last_SQL_Error: 

  Replicate_Ignore_Server_Ids: 

             Master_Server_Id: 2

               Master_SSL_Crl: 

           Master_SSL_Crlpath: 

                   Using_Gtid: Current_Pos

                  Gtid_IO_Pos: 0-2-645

1 row in set (0.00 sec)


MariaDB [(none)]> show variables like 'slave_parallel%';

+---------------------------+--------+

| Variable_name             | Value  |

+---------------------------+--------+

| slave_parallel_max_queued | 131072 |

| slave_parallel_threads    | 2      |

+---------------------------+--------+

2 rows in set (0.01 sec)


相关内容

热门资讯

万斯:美伊谈判取得“很大进展” △5月19日,美国副总统万斯在白宫新闻简报会上当地时间5月19日,美国副总统万斯在白宫新闻简报会上表...
全环境立德树人|广饶县:“科普... 近日,一场别开生面的 “科普漂流”活动在东营市科技馆火热启程。来自广饶县的40余名青少年走出课堂,在...
西安AI数字人选择指南 在西安,AI数字人已经从概念走向了实实在在的应用。无论是企业宣传、短视频制作,还是直播带货,数字人正...
10分钟飞越深山!无人机送出“... 在四川省雅安市汉源县唐家镇尚礼村,一架满载新鲜甜樱桃的无人机从海拔1500米的起飞点缓缓升空,平稳驶...
能源金融双线突破,西方制裁反证... 01五月北京:全球外交焦点汇聚,中俄高层会晤启新程今年5月,全球外交的钟摆,正以前所未有的高频在北京...
不仅要把人工智能送上天,长三角... 能够在3分钟内完成未来60天天气预测的“伏羲”气象模型,如今正实时加工着来自太空的“一手”气象数据。...
追觅创始人俞浩称无比感谢雷军:... 【CNMO科技消息】据CNMO科技了解,追觅科技创始人兼CEO俞浩近日在访谈中回顾了公司早期获得小米...
跑遍多家官方旗舰店!2026手... 大家好,我是小杨。说实话,写这篇文章之前,我花了整整一个周末,把各大手机官方旗舰店挨个逛了一遍。不是...
AMD AI开发者大会首次在中... IT之家 5 月 19 日消息,今天,AMD AI 开发者大会(AMD AI DevDay 2026...
警惕!这些“高科技疗愈”全是骗... 本文转自【光明日报】; 当前,一些不法分子打着“生命科学”等名义,编造“脑波修复”“能量疗愈”“光波...