温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

MariaDB基于GTID的复制

发布时间:2020-06-21 08:27:52 来源:网络 阅读:432 作者:孤鸿子 栏目:数据库

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)


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI