您的位置:首页 > 数据库 > MariaDB

Linux-6.5下 基于MariaDB-10 GTID多线程 的配置解析

2014-05-08 20:37 585 查看
mysql 5.6 基于 gtid 主从复制[b](本文是:MariaDB-10)[/b] MySQL 5.6引入的GTID(Global Transaction IDs)使得其复制功能的配置、监控及管理变得更加易于实现,且更加健壮。 GTID是一个 unique 唯一的表示符,他是由服务器的uuid 全局唯一标示,是由128位的随机符组成,mysql-5.6是依靠server-id和uuid 来标示复制架构中的每一个主机,因为是128位的随机字符串在全局都不会重复,server-id 和uuid以及每一个mysql事物的事物序号组成了唯一的gtid ,自从引进mysql-5.6之后每一个二进制日志当中在每一个事物的首部都会写上gtid 标记,因此gtid使得追踪和比较复制事物变得非常简单而且能够实现从崩溃中快速恢复。尤其是innodb 引擎要想实现高可用功能必须要借助于gtid来实现。 mysql's replication

主机环境为:

本博文是以MariaDB-10配置GTID多线程的,下面是配置步骤:
一、配置MASTER节点1、配置主机名:

2、停止服务:

3、修改配置文件:


4、创建目录及属主属组:

5、修改hosts:

6、远程复制给slave主机:

7、测试是否能ping通slave:

8、启动服务:

9、查看GTID信息:



二、配置SLAVE节点1、配置主机名:

2、停止服务:

3、修改配置文件:

4、创建目录及修改属组属主:

5、启动服务:

6、测试是否能ping通master:

7、查看GTID信息:


三、验证效果及创建授权用户1、master创建授权用户:

2、slave指向指定复制位置:

3、slave启动同步:

4、slave查看是否成功启用同步:

5、slave查看是否有mydb库:

6、master查看slave的数量:

7、master创建库:

8、slave查看是否同步:


9、这时候你要与下面的这条命令结合的使用,才能看出动态的结果,你可以开两个窗口,我这里可能是因为数据量太小了,所以看不变化了:9.1 master导入大量数据:


9.2 slave查看master导入数据的变化:


9.3 slave查看master导入数据的变化:

9.3.1 与上图作对比:


10、master查看线程信息:
MariaDB [(none)]> SHOW PROCESSLIST;
+----+-------------+------------------------+------+-------------+------+-----------------------------------------------------------------------+------------------+----------+
| Id | User        | Host                   | db   | Command     | Time | State                                                                 | Info             | Progress |
+----+-------------+------------------------+------+-------------+------+-----------------------------------------------------------------------+------------------+----------+
|  3 | system user |                        | NULL | Connect     | 1785 | Waiting for work from SQL thread                                      | NULL             |    0.000 |
|  4 | system user |                        | NULL | Connect     | 1785 | Waiting for work from SQL thread                                      | NULL             |    0.000 |
|  8 | repluser    | slave.xiaoma.com:41243 | NULL | Binlog Dump |  954 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL             |    0.000 |
| 17 | root        | localhost              | NULL | Query       |    0 | init                                                                  | SHOW PROCESSLIST |    0.000 |
+----+-------------+------------------------+------+-------------+------+-----------------------------------------------------------------------+------------------+----------+
4 rows in set (0.00 sec)
MariaDB [(none)]>
11、slave查看线程信息:
MariaDB [(none)]> SHOW PROCESSLIST;
+----+-------------+-----------+------+---------+---------+-----------------------------------------------------------------------------+------------------+----------+
| Id | User        | Host      | db   | Command | Time    | State                                                                       | Info             | Progress |
+----+-------------+-----------+------+---------+---------+-----------------------------------------------------------------------------+------------------+----------+
|  3 | system user |           | NULL | Connect | 3225828 | Waiting for work from SQL thread                                            | NULL             |    0.000 |
|  4 | system user |           | NULL | Connect | 3225828 | Waiting for work from SQL thread                                            | NULL             |    0.000 |
|  6 | root        | localhost | NULL | Query   |       0 | init                                                                        | SHOW PROCESSLIST |    0.000 |
|  7 | system user |           | NULL | Connect |    1006 | Waiting for master to send event                                            | NULL             |    0.000 |
|  8 | system user |           | NULL | Connect |     535 | Slave has read all relay log; waiting for the slave I/O thread to update it | NULL             |    0.000 |
+----+-------------+-----------+------+---------+---------+-----------------------------------------------------------------------------+------------------+----------+
5 rows in set (0.00 sec)
MariaDB [(none)]>


Welcome to the xiaomazi blog!!

本文出自 “不怕鬼的小马子” 博客,请务必保留此出处http://xiaomazi.blog.51cto.com/5891742/1408559
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: