您的位置:首页 > 财经 > 产业 > 宁波信息港_建筑设计防火规范2018_长沙关键词优化推荐_哈尔滨推广优化公司

宁波信息港_建筑设计防火规范2018_长沙关键词优化推荐_哈尔滨推广优化公司

2024/12/22 22:20:27 来源:https://blog.csdn.net/xxzhaobb/article/details/144294724  浏览:    关键词:宁波信息港_建筑设计防火规范2018_长沙关键词优化推荐_哈尔滨推广优化公司
宁波信息港_建筑设计防火规范2018_长沙关键词优化推荐_哈尔滨推广优化公司

参考文档:
https://dev.mysql.com/doc/refman/8.4/en/group-replication-configuring-instances.html

MySQL版本:

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.4.3     |
+-----------+
1 row in set (0.00 sec)mysql> 

-- 设置/etc/hosts (三个节点都需要设置)

192.168.2.11  mgr01
192.168.2.12  mgr02
192.168.2.13  mgr03

-- 关闭掉OS的防火墙 (三个节点都需要设置,略)

-- 第一个库的设置

-- 初始化MySQL (略)

-- MySQL配置文件(本测试,仅仅设置MGR所需的必须的参数)

[mysqld]#
# Disable other storage engines
#
disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"#
# Replication configuration parameters
#
server_id=1
gtid_mode=ON
enforce_gtid_consistency=ON#
# Group Replication configuration
#
plugin_load_add='group_replication.so'
group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
group_replication_start_on_boot=off
group_replication_local_address= "mgr01:33061"
group_replication_group_seeds= "mgr01:33061,mgr02:33061,mgr03:33061"
group_replication_bootstrap_group= off

-- 安装插件,(my.cnf中plugin_load_add='group_replication.so',发现plogins已经是active了)

INSTALL PLUGIN group_replication SONAME 'group_replication.so';
SHOW PLUGINS;

-- 创建用户

SET SQL_LOG_BIN=0;CREATE USER rpl_user@'%' IDENTIFIED BY 'mysql';
alter user rpl_user@'%' identified with  mysql_native_password  by 'mysql';
GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';
GRANT CONNECTION_ADMIN ON *.* TO rpl_user@'%';
GRANT BACKUP_ADMIN ON *.* TO rpl_user@'%';
GRANT GROUP_REPLICATION_STREAM ON *.* TO rpl_user@'%';
FLUSH PRIVILEGES;SET SQL_LOG_BIN=1;

-- 创建测试库 

CREATE DATABASE test;
USE test;
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 TEXT NOT NULL);
INSERT INTO t1 VALUES (1, 'Luis');
SHOW BINLOG EVENTS;mysql> SHOW BINLOG EVENTS;
+---------------+-----+----------------+-----------+-------------+----------------------------------+
| Log_name      | Pos | Event_type     | Server_id | End_log_pos | Info                             |
+---------------+-----+----------------+-----------+-------------+----------------------------------+
| binlog.000001 |   4 | Format_desc    |         1 |         127 | Server ver: 8.4.3, Binlog ver: 4 |
| binlog.000001 | 127 | Previous_gtids |         1 |         158 |                                  |
| binlog.000001 | 158 | Stop           |         1 |         181 |                                  |
+---------------+-----+----------------+-----------+-------------+----------------------------------+
3 rows in set (0.00 sec)mysql> 

-- 启用复制 

CHANGE REPLICATION SOURCE TO SOURCE_USER='rpl_user',SOURCE_PASSWORD='mysql' FOR CHANNEL 'group_replication_recovery';
SET GLOBAL group_replication_bootstrap_group=ON;
START GROUP_REPLICATION USER='rpl_user', PASSWORD='mysql';
SET GLOBAL group_replication_bootstrap_group=OFF;mysql> CHANGE REPLICATION SOURCE TO SOURCE_USER='rpl_user',SOURCE_PASSWORD='mysql' FOR CHANNEL 'group_replication_recovery';
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> SET GLOBAL group_replication_bootstrap_group=ON;
Query OK, 0 rows affected (0.00 sec)mysql> START GROUP_REPLICATION USER='rpl_user', PASSWORD='mysql';
Query OK, 0 rows affected (1.08 sec)mysql> SET GLOBAL group_replication_bootstrap_group=OFF;
Query OK, 0 rows affected (0.00 sec)mysql> 

-- 查看复制状态

SELECT * FROM performance_schema.replication_group_members;mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | e558e52f-b327-11ef-8266-000c291c3ef6 | mgr01       |        3306 | ONLINE       | PRIMARY     | 8.4.3          | XCom                       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
1 row in set (0.01 sec)mysql> 

 

-- 添加第二个库  

-- 初始化MySQL、创建用户,同第一个库 (略)

-- 启动 

CHANGE REPLICATION SOURCE TO SOURCE_USER='rpl_user', SOURCE_PASSWORD='mysql' FOR CHANNEL 'group_replication_recovery';START GROUP_REPLICATION;
START GROUP_REPLICATION USER='rpl_user', PASSWORD='mysql';
SELECT * FROM performance_schema.replication_group_members;mysql> CHANGE REPLICATION SOURCE TO SOURCE_USER='rpl_user', SOURCE_PASSWORD='mysql' FOR CHANNEL 'group_replication_recovery';
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> mysql> START GROUP_REPLICATION USER='rpl_user', PASSWORD='mysql';
Query OK, 0 rows affected (5.94 sec)mysql> 
mysql> CHANGE REPLICATION SOURCE TO SOURCE_USER='rpl_user', SOURCE_PASSWORD='mysql' FOR CHANNEL 'group_replication_recovery';
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> START GROUP_REPLICATION USER='rpl_user', PASSWORD='mysql';
Query OK, 0 rows affected (1.89 sec)mysql> 

-- 查看复制状态 (状态为RECOVERING,说明有问题,通过后面的问题1234解决。设置时候可以参考各个mysql的log,以查看复制是否有问题)

mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | 47b589a3-b3c3-11ef-ba63-000c297e6af7 | mgr02       |        3306 | RECOVERING   | SECONDARY   | 8.4.3          | XCom                       |
| group_replication_applier | e558e52f-b327-11ef-8266-000c291c3ef6 | mgr01       |        3306 | ONLINE       | PRIMARY     | 8.4.3          | XCom                       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
2 rows in set (0.00 sec)mysql> 

-- 添加第三个库 

[mysqld]#
# Disable other storage engines
#
disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"#
# Replication configuration parameters
#
server_id=3
gtid_mode=ON
enforce_gtid_consistency=ON#
# Group Replication configuration
#
plugin_load_add='group_replication.so'
group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
group_replication_start_on_boot=off
group_replication_local_address= "mgr03:33061"
group_replication_group_seeds= "mgr01:33061,mgr02:33061,mgr03:33061"
group_replication_bootstrap_group= off

-- 初始化MySQL、创建用户,同第一个库 (略)

-- 启动复制 

 

CHANGE REPLICATION SOURCE TO SOURCE_USER='rpl_user',SOURCE_PASSWORD='mysql' FOR CHANNEL 'group_replication_recovery';
START GROUP_REPLICATION USER='rpl_user', PASSWORD='mysql';

-- 查看复制状态

mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | 47b589a3-b3c3-11ef-ba63-000c297e6af7 | mgr02       |        3306 | ONLINE       | SECONDARY   | 8.4.3          | XCom                       |
| group_replication_applier | 7bf19e8c-b3d1-11ef-b688-000c29e5c624 | mgr03       |        3306 | ONLINE       | SECONDARY   | 8.4.3          | XCom                       |
| group_replication_applier | e558e52f-b327-11ef-8266-000c291c3ef6 | mgr01       |        3306 | ONLINE       | PRIMARY     | 8.4.3          | XCom                       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
3 rows in set (0.00 sec)mysql> 

-- 查询复制 
mgr01 上

mysql>  select * from performance_schema.replication_connection_status \G
*************************** 1. row ***************************CHANNEL_NAME: group_replication_applierGROUP_NAME: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaaSOURCE_UUID: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaaTHREAD_ID: NULLSERVICE_STATE: ONCOUNT_RECEIVED_HEARTBEATS: 0LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00.000000RECEIVED_TRANSACTION_SET: e558e52f-b327-11ef-8266-000c291c3ef6:1-4LAST_ERROR_NUMBER: 0LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION: LAST_QUEUED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000
LAST_QUEUED_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION_END_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION: QUEUEING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000
*************************** 2. row ***************************CHANNEL_NAME: group_replication_recoveryGROUP_NAME: SOURCE_UUID: THREAD_ID: NULLSERVICE_STATE: OFFCOUNT_RECEIVED_HEARTBEATS: 0LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00.000000RECEIVED_TRANSACTION_SET: LAST_ERROR_NUMBER: 0LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION: LAST_QUEUED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000
LAST_QUEUED_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION_END_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION: QUEUEING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000
2 rows in set (0.01 sec)mysql> 

mgr02 上

mysql> select * from performance_schema.replication_connection_status \G
*************************** 1. row ***************************CHANNEL_NAME: group_replication_applierGROUP_NAME: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaaSOURCE_UUID: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaaTHREAD_ID: NULLSERVICE_STATE: ONCOUNT_RECEIVED_HEARTBEATS: 0LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00.000000RECEIVED_TRANSACTION_SET: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1,
e558e52f-b327-11ef-8266-000c291c3ef6:1-4LAST_ERROR_NUMBER: 0LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1LAST_QUEUED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 2024-12-06 08:40:56.415873
LAST_QUEUED_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 2024-12-06 08:40:56.415873LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP: 2024-12-06 08:40:56.530630LAST_QUEUED_TRANSACTION_END_QUEUE_TIMESTAMP: 2024-12-06 08:40:56.530646QUEUEING_TRANSACTION: QUEUEING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000
*************************** 2. row ***************************CHANNEL_NAME: group_replication_recoveryGROUP_NAME: SOURCE_UUID: THREAD_ID: NULLSERVICE_STATE: OFFCOUNT_RECEIVED_HEARTBEATS: 0LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00.000000RECEIVED_TRANSACTION_SET: LAST_ERROR_NUMBER: 0LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION: LAST_QUEUED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000
LAST_QUEUED_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION_END_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION: QUEUEING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000
2 rows in set (0.00 sec)mysql> 

mgr03上 

mysql> select * from performance_schema.replication_connection_status \G
*************************** 1. row ***************************CHANNEL_NAME: group_replication_applierGROUP_NAME: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaaSOURCE_UUID: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaaTHREAD_ID: NULLSERVICE_STATE: ONCOUNT_RECEIVED_HEARTBEATS: 0LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00.000000RECEIVED_TRANSACTION_SET: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1,
e558e52f-b327-11ef-8266-000c291c3ef6:1-4LAST_ERROR_NUMBER: 0LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1LAST_QUEUED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 2024-12-06 08:40:56.415873
LAST_QUEUED_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 2024-12-06 08:40:56.415873LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP: 2024-12-06 08:40:56.432417LAST_QUEUED_TRANSACTION_END_QUEUE_TIMESTAMP: 2024-12-06 08:40:56.432447QUEUEING_TRANSACTION: QUEUEING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000
*************************** 2. row ***************************CHANNEL_NAME: group_replication_recoveryGROUP_NAME: SOURCE_UUID: THREAD_ID: NULLSERVICE_STATE: OFFCOUNT_RECEIVED_HEARTBEATS: 0LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00.000000RECEIVED_TRANSACTION_SET: LAST_ERROR_NUMBER: 0LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION: LAST_QUEUED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000
LAST_QUEUED_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000LAST_QUEUED_TRANSACTION_END_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION: QUEUEING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00.000000QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00.000000
2 rows in set (0.00 sec)mysql> 

问题1 
group_replication_local_address    等,是mgr01:33061 或其他端口,不是mysql默认的3306 

问题2 
因为是clone的虚拟机,msyql的server_uuid是一样的,需要select uuid()生成一个后,修改,修改的文件是data目录下的auto.cnf ,而不是mysql的启动的时候使用的那个cnf文件

问题3 
mysql8.4 ,默认mysql_native_password 是disable的,如果需要启动,则需要在启动MySQL服务的时候加上--mysql-native-password=ON

问题4 
在启动mgr复制的时候,提示一下错误:
2024-12-06T12:05:35.826175Z 67 [ERROR] [MY-010584] [Repl] Replica I/O for channel 'group_replication_recovery': Error connecting to source 'rpl_user@mgr01:3306'. This was attempt 1/1, with a delay of 60 seconds between attempts. Message: Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection. Error_code: MY-002061
需要设置为: mysql_native_password
该错误信息也可通过 select * from performance_schema.replication_connection_status \G 查询 
 

END 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com