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)


相关内容

热门资讯

美财长:本来还想写“和伊朗最高... 美国财政部长贝森特说,美国总统特朗普政府将“不惜一切代价”支持日本稳定汇市。他还幽默地回应了媒体拍到...
对伊战争消耗过大,美弹药库存告... 美伊战争已经持续近半年,战争大量消耗美军的关键弹药储备,西媒爆料称,美国弹药库存告急。美国总统特朗普...
华为E-band微波产品斩获2... 【CNMO科技消息】 近日,华为E-band微波产品RTN 3800凭借其卓越的设计理念和技术创新,...
原创 美... 当国际空间站走到退役那一天,能不能控制它撞向中国空间站?一些美国网络社区出现这种设想,乍看像在讨论航...
华灿光电:Micro LED通... 证券之星消息,华灿光电(300323)08月04日在投资者关系平台上答复投资者关心的问题。 投资者:...
济宁的破与立:产业蝶变万亿可期... 刚刚过去的7月,济宁有两件事将机器人产业推向了新的高度。一是7月9日,珞石机器人在港交所上市,这是山...
机器人企业TOP50发布,背后... 视频制作:实习生 余天雯 8月3日,DBC德本咨询联合CIW、eNet发布《2026中国科技机器人企...
戈碧迦获得发明专利授权:“一种... 证券之星消息,根据天眼查APP数据显示戈碧迦(920438)新获得一项发明专利授权,专利名为“一种尖...
微信:即日起不再支持 8月3日,微信公众平台运营中心发布关于规范互联网渠道售卡类服务内容的公告。 微信公众平台一直致力于为...
杂活全丢给AI做,TRAE W... 一夜之间,字节、阿里、腾讯国产 AI「御三家」不约而同加码 AI 办公(Work Agent)。AI...