MySQL 5.7 MGR单主确定主节点方法

我们行MGR年底要上线了,每天都要看官方文档学习,做测试,坚持每天写一个小知识点,有想一起学习的么~

MySQL 5.7 MGR单主确定主节点是哪个,我们可以通过成员ID来判断,然后结合read_only参数来确认。

[[email protected] ~]# mysql -uroot -p -P 3306 -h 127.0.0.1
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 857246
Server version: 5.7.26-29-log Percona Server (GPL)

Copyright (c) 2009-2019 Percona LLC and/or its affiliates
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> status
--------------
mysql  Ver 14.14 Distrib 5.7.26-29, for Linux (x86_64) using  EditLine wrapper

Connection id:      857246
Current database:
Current user:       [email protected]
SSL:            Not in use
Current pager:      stdout
Using outfile:      ‘‘
Using delimiter:    ;
Server version:     5.7.26-29-log Percona Server (GPL)
Protocol version:   10
Connection:     127.0.0.1 via TCP/IP
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8
Conn.  characterset:    utf8
TCP port:       3306
Uptime:         39 days 8 hours 53 min 39 sec

Threads: 4  Questions: 4989552  Slow queries: 731837  Opens: 930  Flush tables: 1  Open tables: 924  Queries per second avg: 1.466
--------------

mysql> SHOW STATUS LIKE ‘group_replication_primary_member‘;
+----------------------------------+--------------------------------------+
| Variable_name                    | Value                                |
+----------------------------------+--------------------------------------+
| group_replication_primary_member | 59d7f183-b8f6-11e9-863b-005056875165 |
+----------------------------------+--------------------------------------+
1 row in set (0.00 sec)

mysql> select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | 500dd0aa-b8f6-11e9-85ba-005056875a61 | 196.55.7.37 |        3306 | ONLINE       |
| group_replication_applier | 59d7f183-b8f6-11e9-863b-005056875165 | 196.55.7.36 |        3306 | ONLINE       |
| group_replication_applier | 69e1c26d-b8f6-11e9-91c1-00505687032a | 196.55.7.38 |        3306 | ONLINE       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
3 rows in set (0.00 sec)

mysql> show variables like ‘%read_only‘;
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| innodb_read_only      | OFF   |
| read_only             | OFF   |
| super_read_only       | OFF   |
| transaction_read_only | OFF   |
| tx_read_only          | OFF   |
+-----------------------+-------+
5 rows in set (0.01 sec)

mysql> 

原文地址:https://blog.51cto.com/roidba/2438715

时间: 2024-11-09 03:40:37

MySQL 5.7 MGR单主确定主节点方法的相关文章

MySQL Group Replication mgr 单主 proxysql 读写分离配置过程

1.前期准备,mgr安装见上一篇文章 2.创建用户和导入脚本 GRANT ALL ON *.* TO 'rootuser'@'%' IDENTIFIED BY '123456'; /mgr/mysql/bin/mysql -h127.0.0.1 -P24802 <a.sql [[email protected] ~]# cat a.sql USE sys; DELIMITER $$ CREATE FUNCTION IFZERO(a INT, b INT) RETURNS INT DETERMIN

mysql MGR 单主多主模式切换

主库执行CREATE DATABASE test CHARACTER SET utf8 COLLATE utf8_general_ci;use test;create table if not exists h1 (id int(10) PRIMARY KEY AUTO_INCREMENT,name varchar(50) NOT NULL);insert into test.h1 values(1,"wang"),(2,"guo"),(3,"yang&q

MGR单主启动报错处理ERROR 3092

环境描述:三个节点的MGR集群,单主模式,准备关闭主节点进行数据库维护,出现了报错信息. 1.关闭数据库 mysql> shutdown; Query OK, 0 rows affected (0.00 sec) mysql> mysql> 2019-09-23T07:16:36.262422Z mysqld_safe mysqld from pid file /data/arkdb/3306/pid/mysql.pid ended 2.启动数据库 [[email protected]

MGR单主之自增序列参数设置

一.官网说明When Group Replication is started on a server, the value of auto_increment_increment is changed to the value of group_replication_auto_increment_increment, which defaults to 7, and the value of auto_increment_offset is changed to the server ID.

MySQL集群MGR架构for单主在线转为多主模式

本文源链接地址:https:www.93bok.com 之前已经完成了MGR集群的单主模式搭建,在生产环境中,我们有时候想改变一下MGR的模式,但是又不想停止mysql服务的正常运行和正常提供服务,本文就来说说,该怎么在不影响mysql正常提供服务的前提下,从单主模式转换为多主模式,即在线转换 注意: 多点写入会存在冲突检查,这耗损性能挺大的,官方建议采用网络分区功能,在程序端把相同的业务定位到同一节点,尽量减少冲突发生几率. 单主模式之前已经搭建过,可参考之前文章,这里直接接着单主模式继续操作

Mysql Group Replication 简介及单主模式组复制配置【转】

一 Mysql Group Replication简介 Mysql Group Replication(MGR)是一个全新的高可用和高扩张的MySQL集群服务. 高一致性,基于原生复制及paxos协议的组复制技术,以插件方式提供一致数据安全保证: 高容错性,大多数服务正常就可继续工作,自动不同节点检测资源征用冲突,按顺序优先处理,内置自动防脑裂机制: 高扩展性,自动添加移除节点,并更新组信息: 高灵活性,单主模式和多主模式.单主模式自动选主,所有更新操作在主进行:多主模式,所有server同时更

MySQL学习笔记14分组复制的部署之(一)单主模式的部署及故障恢复

1. 单主模式的部署步骤 目标:部署一个有3台主机的单主模式的MySQL分组. Primary:192.168.197.110. Secondary:192.168.197.111. Secondary:192.168.197.112. MySQL端口:3306,MySQL分组复制端口:33061. (1)主机192.168.197.110上的操作. 按照如下步骤完成MySQL配置,并且将自己加入到分组中,最后启动分组. (a)修改MySQL配置. 修改MySQL服务的配置文件. [mysqld

Mysql 5.6.27 双主模型&&主备模型安装测试

http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.27-1.el6.x86_64.rpm-bundle.tar 测试环境:    两台服务器          MYSQL-1:10.11.22.78          MYSQL-2:10.11.22.248    测试系统          Centos 6.5_64    Mysql版本          MySQL-5.6.27    Keepalived版本          k

mycat分布式mysql中间件(自增主键)

一.全局序列号 全局序列号是MyCAT提供的一个新功能,为了实现分库分表情况下,表的主键是全局唯一,而默认的MySQL的自增长主键无法满足这个要求.全局序列号的语法符合标准SQL规范,其格式为:next value for MYCATSEQ_XXXMYCATSEQ_XXX 是序列号的名字,MyCAT自动创建新的序列号,免去了开发的复杂度,另外,MyCAT也提供了一个全局的序列号,名称为:MYCATSEQ_GLOBAL 注意,MYCATSEQ_必须大写才能正确识别.MyCAT温馨提示:实践中,建议