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

时间:2014-05-09 06:55:38   收藏:0   阅读:515
                            mysql 5.6 基于 gtid 主从复制(本文是:MariaDB-10)

        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

bubuko.com,布布扣

主机环境为:
bubuko.com,布布扣

本博文是以MariaDB-10配置GTID多线程的,下面是配置步骤:

一、配置MASTER节点
1、配置主机名:
bubuko.com,布布扣
2、停止服务:
bubuko.com,布布扣
3、修改配置文件:
bubuko.com,布布扣
4、创建目录及属主属组:
bubuko.com,布布扣
5修改hosts:
bubuko.com,布布扣
6、远程复制给slave主机:
bubuko.com,布布扣
7、测试是否能ping通slave:
bubuko.com,布布扣
8、启动服务:
bubuko.com,布布扣
9、查看GTID信息:
bubuko.com,布布扣


二、配置SLAVE节点
1、配置主机名:
bubuko.com,布布扣
2、停止服务:
bubuko.com,布布扣
3、修改配置文件:
bubuko.com,布布扣
4、创建目录及修改属组属主:
bubuko.com,布布扣
5、启动服务:
bubuko.com,布布扣
6、测试是否能ping通master:
bubuko.com,布布扣
7、查看GTID信息:
bubuko.com,布布扣

三、验证效果及创建授权用户
1、master创建授权用户:
bubuko.com,布布扣
2、slave指向指定复制位置:
bubuko.com,布布扣
3、slave启动同步:
bubuko.com,布布扣
4、slave查看是否成功启用同步:
bubuko.com,布布扣
5、slave查看是否有mydb库:
bubuko.com,布布扣
6、master查看slave的数量:
bubuko.com,布布扣
7、master创建库:
bubuko.com,布布扣
8、slave查看是否同步:
bubuko.com,布布扣
9、这时候你要与下面的这条命令结合的使用,才能看出动态的结果,你可以开两个窗口,我这里可能是因为数据量太小了,所以看不变化了:
9.1 master导入大量数据:
bubuko.com,布布扣
9.2 slave查看master导入数据的变化:
bubuko.com,布布扣
9.3 slave查看master导入数据的变化:
bubuko.com,布布扣
9.3.1 与上图作对比:
bubuko.com,布布扣
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

Linux-6.5下 基于MariaDB-10 GTID多线程 的配置解析,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!