【MySQL高可用】MySQL高可用之MGR部署
【MySQL高可用】MySQL高可用之MGR部署
参考:https://www.xmmup.com/dbbao45mysqlgaokeyongzhimgrconsuljiagoubushu.html
架构介绍
采用MGR集群、和consul服务注册发现实现应用端通过动态dns访问MGR集群,实现数据库高可用,自动化切换的方案。
本次环境一共包含7台机器。其中3台做MySQL的MGR数据节点(也需要安装Consul,作为Consul client)。单主模式,还有3台做Consul server集群。实现Consul的高可用,剩下一台做DNS服务器,用来解析MGR节点域名。
IP | 数据库版本 | 主机名 | 容器名 | 容器映射端口 | Server ID | 实例端口 | MGR通讯端口 | 备注 |
---|---|---|---|---|---|---|---|---|
192.168.68.60 | 8.0.22 | mgr60 | mysql8022mgr33060 | 33060 | 802233060 | 3306 | 33061 | MGR主节点 |
192.168.68.61 | 8.0.22 | mgr61 | mysql8022mgr33061 | 33061 | 802233061 | 3306 | 33061 | MGR节点 |
192.168.68.62 | 8.0.22 | mgr62 | mysql8022mgr33062 | 33062 | 802233062 | 3306 | 33061 | MGR节点 |
搭建MGR
申请3台MGR机器
[root@mysql conf]# docker pull lhrbest/lhrcentos76:8.0-- 创建主从网络环境
[root@mysql ~]# docker network create --subnet=192.168.68.0/16 mhaclone
8b8e5ae9dd1efbb247323978a3dbcf025415b861b76bd828859ac934aefa77d1
[root@mysql ~]# docker network inspect mhaclone
[{"Name": "mhaclone","Id": "8b8e5ae9dd1efbb247323978a3dbcf025415b861b76bd828859ac934aefa77d1","Created": "2022-10-14T20:55:25.87905019+08:00","Scope": "local","Driver": "bridge","EnableIPv6": false,"IPAM": {"Driver": "default","Options": {},"Config": [{"Subnet": "192.168.68.0/16"}]},"Internal": false,"Attachable": false,"Ingress": false,"ConfigFrom": {"Network": ""},"ConfigOnly": false,"Containers": {},"Options": {},"Labels": {}}
]-- 生成3台CentOS的环境
[root@mysql conf]# docker rm -f mysql8022mgr33060 mysql8022mgr33061 mysql8022mgr33062[root@mysql conf]# docker run -d --name mysql8022mgr33060 -h mgr60 --network mhaclone --ip 192.168.68.60 --privileged=true -p 33060:3306 -v /sys/fs/cgroup:/sys/fs/cgroup lhrbest/lhrcentos76:8.0 init
575e7d8692eeb9bd702c190d4faf281696eb913611b96cc3eb14f2fd81022b74
[root@mysql conf]# docker run -d --name mysql8022mgr33061 -h mgr61 --network mhaclone --ip 192.168.68.61 --privileged=true -p 33061:3306 -v /sys/fs/cgroup:/sys/fs/cgroup lhrbest/lhrcentos76:8.0 init
73d80f98b3ddd54a5b9c6a4a7c91ae1bf54980e1d7f7aafca571827aff328ae5
[root@mysql conf]# docker run -d --name mysql8022mgr33062 -h mgr62 --network mhaclone --ip 192.168.68.62 --privileged=true -p 33062:3306 -v /sys/fs/cgroup:/sys/fs/cgroup lhrbest/lhrcentos76:8.0 init
3705d9583d6d8f8574a839ddb4e6a46b2055efc86d6e7f0b5b26a074483f6ff6
mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar下载地址:
https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar
-- 上传mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar到docker
[root@mysql ~]# pwd
/root
[root@mysql ~]# ls
anaconda-ks.cfg centos:7.6.1810 mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar -p --privileged=true
[root@mysql ~]# docker cp mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar mysql8022mgr33060:/
[root@mysql ~]# docker cp mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar mysql8022mgr33061:/
[root@mysql ~]# docker cp mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar mysql8022mgr33062:/[root@mysql ~]# docker network connect bridge mysql8022mgr33060
[root@mysql ~]# docker network connect bridge mysql8022mgr33061
[root@mysql ~]# docker network connect bridge mysql8022mgr33062
[root@mysql ~]# docker restart mysql8022mgr33060 mysql8022mgr33061 mysql8022mgr33062
3台主机安装MySQL环境
mysql8022mgr33060
[root@mysql ~]# docker exec -it mysql8022mgr33060 bash
[root@mgr60 /]# tar -xvf mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar
[root@mgr60 /]# yum localinstall -y mysql-community-*.rpm
-- 取消密码认证
[root@mgr60 /]# mv /usr/lib64/mysql/plugin/validate_password.so /usr/lib64/mysql/plugin/validate_password.so_bk
[root@mgr60 /]# mv /usr/lib64/mysql/plugin/component_validate_password.so /usr/lib64/mysql/plugin/component_validate_password.so_bk
[root@mgr60 /]# systemctl start mysqld
[root@mgr60 /]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Sat 2022-10-15 11:43:50 CST; 975ms agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 1140 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 1211 (mysqld)Status: "Server is operational"CGroup: /system.slice/docker-575e7d8692eeb9bd702c190d4faf281696eb913611b96cc3eb14f2fd81022b74.scope/system.slice/mysqld.service└─1211 /usr/sbin/mysqldOct 15 11:43:46 mgr60 systemd[1]: Starting MySQL Server...
Oct 15 11:43:50 mgr60 systemd[1]: Started MySQL Server.
[root@mgr60 /]# grep 'temporary password' /var/log/mysqld.log
2022-10-15T03:43:47.341706Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: HPe-pnyYh3us
[root@mgr60 /]# mysql -uroot -pHPe-pnyYh3us
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 8
Server version: 8.0.22Copyright (c) 2000, 2020, 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> alter user root@'localhost' identified with mysql_native_password by 'wcb';
Query OK, 0 rows affected (0.00 sec)mysql> grant all on *.* to root@'localhost' with grant option;
Query OK, 0 rows affected (0.00 sec)mysql> create user root@'%' identified with mysql_native_password by 'wcb';
Query OK, 0 rows affected (0.01 sec)mysql> grant all on *.* to root@'%' with grant option;
Query OK, 0 rows affected (0.01 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)mysql> select user,host,grant_priv,super_priv,authentication_string,password_last_changed from mysql.user;
+------------------+-----------+------------+------------+------------------------------------------------------------------------+-----------------------+
| user | host | grant_priv | super_priv | authentication_string | password_last_changed |
+------------------+-----------+------------+------------+------------------------------------------------------------------------+-----------------------+
| root | % | Y | Y | *1095707276B0CF42657EB271586320F15FD4D6AB | 2022-10-15 11:45:00 |
| mysql.infoschema | localhost | N | N | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | 2022-10-15 11:43:47 |
| mysql.session | localhost | N | Y | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | 2022-10-15 11:43:47 |
| mysql.sys | localhost | N | N | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | 2022-10-15 11:43:47 |
| root | localhost | Y | Y | *1095707276B0CF42657EB271586320F15FD4D6AB | 2022-10-15 11:44:49 |
+------------------+-----------+------------+------------+------------------------------------------------------------------------+-----------------------+
5 rows in set (0.00 sec)
mysql8022mgr33061
[root@mysql ~]# docker exec -it mysql8022mgr33061 bash
[root@mgr61 /]# tar -xvf mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar
[root@mgr61 /]# yum localinstall -y mysql-community-*.rpm
[root@mgr61 /]# mv /usr/lib64/mysql/plugin/validate_password.so /usr/lib64/mysql/plugin/validate_password.so_bk
[root@mgr61 /]# mv /usr/lib64/mysql/plugin/component_validate_password.so /usr/lib64/mysql/plugin/component_validate_password.so_bk
[root@mgr61 /]# systemctl start mysqld
[root@mgr61 /]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Sat 2022-10-15 11:47:14 CST; 608ms agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 1262 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 1333 (mysqld)Status: "Server is operational"CGroup: /system.slice/docker-73d80f98b3ddd54a5b9c6a4a7c91ae1bf54980e1d7f7aafca571827aff328ae5.scope/system.slice/mysqld.service└─1333 /usr/sbin/mysqldOct 15 11:47:10 mgr61 systemd[1]: Starting MySQL Server...
Oct 15 11:47:14 mgr61 systemd[1]: Started MySQL Server.
[root@mgr61 /]# grep 'temporary password' /var/log/mysqld.log
2022-10-15T03:47:11.109466Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: <A!;j)I4Tptt
[root@mgr61 /]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.22Copyright (c) 2000, 2020, 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> alter user root@'localhost' identified with mysql_native_password by 'wcb';
Query OK, 0 rows affected (0.01 sec)mysql> grant all on *.* to root@'localhost' with grant option;
Query OK, 0 rows affected (0.01 sec)mysql> create user root@'%' identified with mysql_native_password by 'wcb';
Query OK, 0 rows affected (0.01 sec)mysql> grant all on *.* to root@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)mysql> select user,host,grant_priv,super_priv,authentication_string,password_last_changed from mysql.user;
+------------------+-----------+------------+------------+------------------------------------------------------------------------+-----------------------+
| user | host | grant_priv | super_priv | authentication_string | password_last_changed |
+------------------+-----------+------------+------------+------------------------------------------------------------------------+-----------------------+
| root | % | Y | Y | *1095707276B0CF42657EB271586320F15FD4D6AB | 2022-10-15 11:48:35 |
| mysql.infoschema | localhost | N | N | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | 2022-10-15 11:47:11 |
| mysql.session | localhost | N | Y | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | 2022-10-15 11:47:11 |
| mysql.sys | localhost | N | N | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | 2022-10-15 11:47:11 |
| root | localhost | Y | Y | *1095707276B0CF42657EB271586320F15FD4D6AB | 2022-10-15 11:48:27 |
+------------------+-----------+------------+------------+------------------------------------------------------------------------+-----------------------+
5 rows in set (0.00 sec)
mysql8022mgr33062
[root@mysql ~]# docker exec -it mysql8022mgr33062 bash
[root@mgr62 /]# tar -xvf mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-8.0.22-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm
mysql-community-common-8.0.22-1.el7.x86_64.rpm
mysql-community-devel-8.0.22-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.22-1.el7.x86_64.rpm
mysql-community-libs-8.0.22-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.22-1.el7.x86_64.rpm
mysql-community-server-8.0.22-1.el7.x86_64.rpm
mysql-community-test-8.0.22-1.el7.x86_64.rpm
[root@mgr62 /]# yum localinstall -y mysql-community-*.rpm
Loaded plugins: fastestmirror, ovl
Examining mysql-community-client-8.0.22-1.el7.x86_64.rpm: mysql-community-client-8.0.22-1.el7.x86_64
Marking mysql-community-client-8.0.22-1.el7.x86_64.rpm as an update to mysql-community-client-5.7.32-1.el7.x86_64
Examining mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm: mysql-community-client-plugins-8.0.22-1.el7.x86_64
Marking mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm to be installed
Examining mysql-community-common-8.0.22-1.el7.x86_64.rpm: mysql-community-common-8.0.22-1.el7.x86_64
Marking mysql-community-common-8.0.22-1.el7.x86_64.rpm as an update to mysql-community-common-5.7.32-1.el7.x86_64
Examining mysql-community-devel-8.0.22-1.el7.x86_64.rpm: mysql-community-devel-8.0.22-1.el7.x86_64
Marking mysql-community-devel-8.0.22-1.el7.x86_64.rpm to be installed
Examining mysql-community-embedded-compat-8.0.22-1.el7.x86_64.rpm: mysql-community-embedded-compat-8.0.22-1.el7.x86_64
Marking mysql-community-embedded-compat-8.0.22-1.el7.x86_64.rpm to be installed
Examining mysql-community-libs-8.0.22-1.el7.x86_64.rpm: mysql-community-libs-8.0.22-1.el7.x86_64
Marking mysql-community-libs-8.0.22-1.el7.x86_64.rpm as an update to mysql-community-libs-5.7.32-1.el7.x86_64
Examining mysql-community-libs-compat-8.0.22-1.el7.x86_64.rpm: mysql-community-libs-compat-8.0.22-1.el7.x86_64
Marking mysql-community-libs-compat-8.0.22-1.el7.x86_64.rpm as an update to mysql-community-libs-compat-5.7.32-1.el7.x86_64
Examining mysql-community-server-8.0.22-1.el7.x86_64.rpm: mysql-community-server-8.0.22-1.el7.x86_64
Marking mysql-community-server-8.0.22-1.el7.x86_64.rpm to be installed
Examining mysql-community-test-8.0.22-1.el7.x86_64.rpm: mysql-community-test-8.0.22-1.el7.x86_64
Marking mysql-community-test-8.0.22-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.32-1.el7 will be updated
---> Package mysql-community-client.x86_64 0:8.0.22-1.el7 will be an update
---> Package mysql-community-client-plugins.x86_64 0:8.0.22-1.el7 will be installed
---> Package mysql-community-common.x86_64 0:5.7.32-1.el7 will be updated
---> Package mysql-community-common.x86_64 0:8.0.22-1.el7 will be an update
---> Package mysql-community-devel.x86_64 0:8.0.22-1.el7 will be installed
---> Package mysql-community-embedded-compat.x86_64 0:8.0.22-1.el7 will be installed
---> Package mysql-community-libs.x86_64 0:5.7.32-1.el7 will be updated
---> Package mysql-community-libs.x86_64 0:8.0.22-1.el7 will be an update
---> Package mysql-community-libs-compat.x86_64 0:5.7.32-1.el7 will be updated
---> Package mysql-community-libs-compat.x86_64 0:8.0.22-1.el7 will be an update
---> Package mysql-community-server.x86_64 0:8.0.22-1.el7 will be installed
---> Package mysql-community-test.x86_64 0:8.0.22-1.el7 will be installed
--> Finished Dependency ResolutionDependencies Resolved===========================================================================================================================================Package Arch Version Repository Size
===========================================================================================================================================
Installing:mysql-community-client-plugins x86_64 8.0.22-1.el7 /mysql-community-client-plugins-8.0.22-1.el7.x86_64 1.0 Mmysql-community-devel x86_64 8.0.22-1.el7 /mysql-community-devel-8.0.22-1.el7.x86_64 58 Mmysql-community-embedded-compat x86_64 8.0.22-1.el7 /mysql-community-embedded-compat-8.0.22-1.el7.x86_64 90 Mmysql-community-server x86_64 8.0.22-1.el7 /mysql-community-server-8.0.22-1.el7.x86_64 2.3 Gmysql-community-test x86_64 8.0.22-1.el7 /mysql-community-test-8.0.22-1.el7.x86_64 678 M
Updating:mysql-community-client x86_64 8.0.22-1.el7 /mysql-community-client-8.0.22-1.el7.x86_64 230 Mmysql-community-common x86_64 8.0.22-1.el7 /mysql-community-common-8.0.22-1.el7.x86_64 8.9 Mmysql-community-libs x86_64 8.0.22-1.el7 /mysql-community-libs-8.0.22-1.el7.x86_64 22 Mmysql-community-libs-compat x86_64 8.0.22-1.el7 /mysql-community-libs-compat-8.0.22-1.el7.x86_64 6.1 MTransaction Summary
===========================================================================================================================================
Install 5 Packages
Upgrade 4 PackagesTotal size: 3.4 G
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionUpdating : mysql-community-common-8.0.22-1.el7.x86_64 1/13 Installing : mysql-community-client-plugins-8.0.22-1.el7.x86_64 2/13 Updating : mysql-community-libs-8.0.22-1.el7.x86_64 3/13 Updating : mysql-community-client-8.0.22-1.el7.x86_64 4/13 Installing : mysql-community-server-8.0.22-1.el7.x86_64 5/13 Installing : mysql-community-test-8.0.22-1.el7.x86_64 6/13 Installing : mysql-community-devel-8.0.22-1.el7.x86_64 7/13 Updating : mysql-community-libs-compat-8.0.22-1.el7.x86_64 8/13 Installing : mysql-community-embedded-compat-8.0.22-1.el7.x86_64 9/13 Cleanup : mysql-community-libs-compat-5.7.32-1.el7.x86_64 10/13 Cleanup : mysql-community-client-5.7.32-1.el7.x86_64 11/13 Cleanup : mysql-community-libs-5.7.32-1.el7.x86_64 12/13 Cleanup : mysql-community-common-5.7.32-1.el7.x86_64 13/13 Verifying : mysql-community-libs-8.0.22-1.el7.x86_64 1/13 Verifying : mysql-community-client-plugins-8.0.22-1.el7.x86_64 2/13 Verifying : mysql-community-common-8.0.22-1.el7.x86_64 3/13 Verifying : mysql-community-server-8.0.22-1.el7.x86_64 4/13 Verifying : mysql-community-embedded-compat-8.0.22-1.el7.x86_64 5/13 Verifying : mysql-community-devel-8.0.22-1.el7.x86_64 6/13 Verifying : mysql-community-client-8.0.22-1.el7.x86_64 7/13 Verifying : mysql-community-test-8.0.22-1.el7.x86_64 8/13 Verifying : mysql-community-libs-compat-8.0.22-1.el7.x86_64 9/13 Verifying : mysql-community-client-5.7.32-1.el7.x86_64 10/13 Verifying : mysql-community-libs-compat-5.7.32-1.el7.x86_64 11/13 Verifying : mysql-community-libs-5.7.32-1.el7.x86_64 12/13 Verifying : mysql-community-common-5.7.32-1.el7.x86_64 13/13 Installed:mysql-community-client-plugins.x86_64 0:8.0.22-1.el7 mysql-community-devel.x86_64 0:8.0.22-1.el7 mysql-community-embedded-compat.x86_64 0:8.0.22-1.el7 mysql-community-server.x86_64 0:8.0.22-1.el7 mysql-community-test.x86_64 0:8.0.22-1.el7 Updated:mysql-community-client.x86_64 0:8.0.22-1.el7 mysql-community-common.x86_64 0:8.0.22-1.el7 mysql-community-libs.x86_64 0:8.0.22-1.el7 mysql-community-libs-compat.x86_64 0:8.0.22-1.el7 Complete!
[root@mgr62 /]# mv /usr/lib64/mysql/plugin/validate_password.so /usr/lib64/mysql/plugin/validate_password.so_bk
[root@mgr62 /]# mv /usr/lib64/mysql/plugin/component_validate_password.so /usr/lib64/mysql/plugin/component_validate_password.so_bk
[root@mgr62 /]# systemctl start mysqld
[root@mgr62 /]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Sat 2022-10-15 11:49:55 CST; 1s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 1345 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 1418 (mysqld)Status: "Server is operational"CGroup: /system.slice/docker-3705d9583d6d8f8574a839ddb4e6a46b2055efc86d6e7f0b5b26a074483f6ff6.scope/system.slice/mysqld.service└─1418 /usr/sbin/mysqldOct 15 11:49:48 mgr62 systemd[1]: Starting MySQL Server...
Oct 15 11:49:55 mgr62 systemd[1]: Started MySQL Server.
[root@mgr62 /]# grep 'temporary password' /var/log/mysqld.log
2022-10-15T03:49:49.759486Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: r7pD1vOPKf!j
[root@mgr62 /]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.22Copyright (c) 2000, 2020, 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> alter user root@'localhost' identified with mysql_native_password by 'wcb';
Query OK, 0 rows affected (0.02 sec)mysql> grant all on *.* to root@'localhost' with grant option;
Query OK, 0 rows affected (0.00 sec)mysql> create user root@'%' identified with mysql_native_password by 'wcb';
Query OK, 0 rows affected (0.01 sec)mysql> grant all on *.* to root@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)mysql> select user,host,grant_priv,super_priv,authentication_string,password_last_changed from mysql.user;
+------------------+-----------+------------+------------+------------------------------------------------------------------------+-----------------------+
| user | host | grant_priv | super_priv | authentication_string | password_last_changed |
+------------------+-----------+------------+------------+------------------------------------------------------------------------+-----------------------+
| root | % | Y | Y | *1095707276B0CF42657EB271586320F15FD4D6AB | 2022-10-15 11:50:25 |
| mysql.infoschema | localhost | N | N | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | 2022-10-15 11:49:50 |
| mysql.session | localhost | N | Y | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | 2022-10-15 11:49:50 |
| mysql.sys | localhost | N | N | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | 2022-10-15 11:49:50 |
| root | localhost | Y | Y | *1095707276B0CF42657EB271586320F15FD4D6AB | 2022-10-15 11:50:17 |
+------------------+-----------+------------+------------+------------------------------------------------------------------------+-----------------------+
5 rows in set (0.01 sec)
修改MySQL参数
[root@mgr60 /]# cat > /etc/my.cnf <<"EOF"
[mysqld]
user=mysql
port=3306
character_set_server=utf8mb4
secure_file_priv=
server-id = 802233060
default-time-zone = '+8:00'
log_timestamps = SYSTEM
log-bin =
binlog_format=row
binlog_checksum=NONE
skip-name-resolve
log_slave_updates = 1
gtid-mode=ON
enforce-gtid-consistency=on
default_authentication_plugin=mysql_native_password
max_allowed_packet = 500M
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log=lhrmgr60-relay-bin
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose-group_replication_start_on_boot=OFF
loose-group_replication_local_address= "192.168.68.60:33061"
loose-group_replication_group_seeds= "192.168.68.60:33061,192.168.68.61:33061,192.168.68.62:33061"
loose-group_replication_bootstrap_group=OFF
loose-group_replication_ip_whitelist="192.168.68.60,192.168.68.61,192.168.68.62"
report_host=192.168.68.60
report_port=3306
EOF
[root@mgr60 /]# systemctl restart mysqld
[root@mgr60 /]# mysql -uroot -pwcb -e "select @@hostname,@@server_id,@@server_uuid"
mysql: [Warning] Using a password on the command line interface can be insecure.
+------------+-------------+--------------------------------------+
| @@hostname | @@server_id | @@server_uuid |
+------------+-------------+--------------------------------------+
| mgr60 | 802233060 | 92e7d67b-4c3b-11ed-a1a5-0242ac110004 |
+------------+-------------+--------------------------------------+
[root@mgr61 /]# cat > /etc/my.cnf <<"EOF"
[mysqld]
user=mysql
port=3306
character_set_server=utf8mb4
secure_file_priv=
server-id = 802233061
default-time-zone = '+8:00'
log_timestamps = SYSTEM
log-bin =
binlog_format=row
binlog_checksum=NONE
log_slave_updates = 1
gtid-mode=ON
enforce-gtid-consistency=ON
skip_name_resolve
default_authentication_plugin=mysql_native_password
max_allowed_packet = 500M
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log=lhrmgr61-relay-bin
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose-group_replication_start_on_boot=OFF
loose-group_replication_local_address= "192.168.68.61:33061"
loose-group_replication_group_seeds= "192.168.68.60:33061,192.168.68.61:33061,192.168.68.62:33061"
loose-group_replication_bootstrap_group=OFF
loose-group_replication_ip_whitelist="192.168.68.60,192.168.68.61,192.168.68.62"
report_host=192.168.68.61
report_port=3306
EOF
[root@mgr61 /]# systemctl restart mysqld
[root@mgr61 /]# mysql -uroot -pwcb -e "select @@hostname,@@server_id,@@server_uuid"
mysql: [Warning] Using a password on the command line interface can be insecure.
+------------+-------------+--------------------------------------+
| @@hostname | @@server_id | @@server_uuid |
+------------+-------------+--------------------------------------+
| mgr61 | 802233061 | 0c738122-4c3c-11ed-a575-0242ac110005 |
+------------+-------------+--------------------------------------+
[root@mgr62 /]# cat > /etc/my.cnf <<"EOF"
[mysqld]
user=mysql
port=3306
character_set_server=utf8mb4
secure_file_priv=
server-id = 802233062
default-time-zone = '+8:00'
log_timestamps = SYSTEM
log-bin =
binlog_format=row
binlog_checksum=NONE
log_slave_updates = 1
gtid-mode=ON
enforce-gtid-consistency=ON
skip_name_resolve
default_authentication_plugin=mysql_native_password
max_allowed_packet = 500M
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log=lhrmgr62-relay-bin
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose-group_replication_start_on_boot=OFF
loose-group_replication_local_address= "192.168.68.62:33061"
loose-group_replication_group_seeds= "192.168.68.60:33061,192.168.68.61:33061,192.168.68.62:33061"
loose-group_replication_bootstrap_group=OFF
loose-group_replication_ip_whitelist="192.168.68.60,192.168.68.61,192.168.68.62"
report_host=192.168.68.62 report_port=3306
EOF
[root@mgr62 /]# systemctl restart mysqld
[root@mgr62 /]# mysql -uroot -pwcb -e "select @@hostname,@@server_id,@@server_uuid"
mysql: [Warning] Using a password on the command line interface can be insecure.
+------------+-------------+--------------------------------------+
| @@hostname | @@server_id | @@server_uuid |
+------------+-------------+--------------------------------------+
| mgr62 | 802233062 | 6adef8e0-4c3c-11ed-af3b-0242ac110006 |
+------------+-------------+--------------------------------------+
安装MGR插件
[root@mgr60 /]# mysql -uroot -pwcb
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 9
Server version: 8.0.22 MySQL Community Server - GPLCopyright (c) 2000, 2020, 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> INSTALL PLUGIN group_replication SONAME 'group_replication.so';
Query OK, 0 rows affected (0.06 sec)mysql> INSTALL PLUGIN clone SONAME 'mysql_clone.so';
Query OK, 0 rows affected (0.01 sec)
mysql> show plugins;
[root@mgr61 /]# mysql -uroot -pwcb
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 9
Server version: 8.0.22 MySQL Community Server - GPLCopyright (c) 2000, 2020, 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> INSTALL PLUGIN group_replication SONAME 'group_replication.so';
Query OK, 0 rows affected (0.05 sec)mysql> INSTALL PLUGIN clone SONAME 'mysql_clone.so';
Query OK, 0 rows affected (0.02 sec)mysql> show plugins;
[root@mgr62 /]# mysql -uroot -pwcb
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 9
Server version: 8.0.22 MySQL Community Server - GPLCopyright (c) 2000, 2020, 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> INSTALL PLUGIN group_replication SONAME 'group_replication.so';
Query OK, 0 rows affected (0.07 sec)mysql> INSTALL PLUGIN clone SONAME 'mysql_clone.so';
Query OK, 0 rows affected (0.02 sec)mysql> show plugins;
设置复制账号
[root@mgr60 /]# mysql -uroot -pwcb
mysql> CREATE USER repl@'%' IDENTIFIED BY 'wcb';
Query OK, 0 rows affected (0.06 sec)mysql> GRANT REPLICATION SLAVE,BACKUP_ADMIN ON *.* TO repl@'%';
Query OK, 0 rows affected (0.00 sec)mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> CHANGE MASTER TO MASTER_USER='repl', MASTER_PASSWORD='wcb' FOR CHANNEL 'group_replication_recovery';
Query OK, 0 rows affected, 2 warnings (0.02 sec)
[root@mgr61 /]# mysql -uroot -pwcb
mysql> CHANGE MASTER TO MASTER_USER='repl', MASTER_PASSWORD='wcb' FOR CHANNEL 'group_replication_recovery';
Query OK, 0 rows affected, 2 warnings (0.02 sec)
[root@mgr62 /]# mysql -uroot -pwcb
mysql> CHANGE MASTER TO MASTER_USER='repl', MASTER_PASSWORD='wcb' FOR CHANNEL 'group_replication_recovery';
Query OK, 0 rows affected, 2 warnings (0.04 sec)
启动MGR(主节点)
[root@mgr60 /]# mysql -uroot -pwcb
mysql> SET GLOBAL group_replication_bootstrap_group=ON;
Query OK, 0 rows affected (0.00 sec)mysql> START GROUP_REPLICATION;
Query OK, 0 rows affected, 1 warning (2.20 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;
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 92e7d67b-4c3b-11ed-a1a5-0242ac110004 | 192.168.68.60 | 3306 | ONLINE | PRIMARY | 8.0.22 |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
1 row in set (0.00 sec)
其他节点加入MGR(其他节点)
[root@mgr61 /]# mysql -uroot -pwcb
mysql> reset master;
Query OK, 0 rows affected (0.04 sec)mysql> START GROUP_REPLICATION;
Query OK, 0 rows affected, 1 warning (3.51 sec)mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 0c738122-4c3c-11ed-a575-0242ac110005 | 192.168.68.61 | 3306 | ONLINE | SECONDARY | 8.0.22 |
| group_replication_applier | 92e7d67b-4c3b-11ed-a1a5-0242ac110004 | 192.168.68.60 | 3306 | ONLINE | PRIMARY | 8.0.22 |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
2 rows in set (0.01 sec)
[root@mgr62 /]# mysql -uroot -pwcb
mysql> reset master;
Query OK, 0 rows affected (0.06 sec)mysql> START GROUP_REPLICATION;
Query OK, 0 rows affected, 1 warning (2.87 sec)mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 0c738122-4c3c-11ed-a575-0242ac110005 | 192.168.68.61 | 3306 | ONLINE | SECONDARY | 8.0.22 |
| group_replication_applier | 6adef8e0-4c3c-11ed-af3b-0242ac110006 | 192.168.68.62 report_port=3306 | 3306 | ONLINE | SECONDARY | 8.0.22 |
| group_replication_applier | 92e7d67b-4c3b-11ed-a1a5-0242ac110004 | 192.168.68.60 | 3306 | ONLINE | PRIMARY | 8.0.22 |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
3 rows in set (0.03 sec)
测试同步
[root@mgr60 /]# mysql -uroot -pwcb
mysql> create database db1;
Query OK, 1 row affected (0.09 sec)mysql> CREATE TABLE db1.`tb1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `hostname` varchar(100) DEFAULT NULL, `server_id` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Query OK, 0 rows affected, 1 warning (0.06 sec)mysql> insert into db1.tb1(hostname,server_id) select @@hostname,@@server_id;
Query OK, 1 row affected (0.03 sec)
Records: 1 Duplicates: 0 Warnings: 0mysql> select * from db1.tb1;
+----+----------+-----------+
| id | hostname | server_id |
+----+----------+-----------+
| 1 | mgr60 | 802233060 |
+----+----------+-----------+
1 row in set (0.01 sec)
[root@mgr61 /]# mysql -uroot -pwcb
mysql> select * from db1.tb1;
+----+----------+-----------+
| id | hostname | server_id |
+----+----------+-----------+
| 1 | mgr60 | 802233060 |
+----+----------+-----------+
1 row in set (0.02 sec)
[root@mgr62 /]# mysql -uroot -pwcb
mysql> select * from db1.tb1;
+----+----------+-----------+
| id | hostname | server_id |
+----+----------+-----------+
| 1 | mgr60 | 802233060 |
+----+----------+-----------+
1 row in set (0.02 sec)
这里可以看到MGR已经搭建完成,主库的数据可以同步到从库。
其他MGR相关操作
删除节点
mysql> stop GROUP_REPLICATION;
Query OK, 0 rows affected (4.60 sec)mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 8818cc27-4d2a-11ed-ae32-0242ac110004 | 192.168.68.62 report_port=3306 | 3306 | OFFLINE | | |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
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 | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 2d2ef770-4d2a-11ed-af9d-0242ac110002 | 192.168.68.60 | 3306 | ONLINE | PRIMARY | 8.0.22 |
| group_replication_applier | 6367f2b8-4d2a-11ed-bed1-0242ac110003 | 192.168.68.61 | 3306 | ONLINE | SECONDARY | 8.0.22 |
| group_replication_applier | 8818cc27-4d2a-11ed-ae32-0242ac110004 | 192.168.68.62 report_port=3306 | 3306 | ONLINE | SECONDARY | 8.0.22 |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
3 rows in set (0.03 sec)mysql> select group_replication_set_as_primary('6367f2b8-4d2a-11ed-bed1-0242ac110003');
+--------------------------------------------------------------------------+
| group_replication_set_as_primary('6367f2b8-4d2a-11ed-bed1-0242ac110003') |
+--------------------------------------------------------------------------+
| Primary server switched to: 6367f2b8-4d2a-11ed-bed1-0242ac110003 |
+--------------------------------------------------------------------------+
1 row in set (1.06 sec)mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 2d2ef770-4d2a-11ed-af9d-0242ac110002 | 192.168.68.60 | 3306 | ONLINE | SECONDARY | 8.0.22 |
| group_replication_applier | 6367f2b8-4d2a-11ed-bed1-0242ac110003 | 192.168.68.61 | 3306 | ONLINE | PRIMARY | 8.0.22 |
| group_replication_applier | 8818cc27-4d2a-11ed-ae32-0242ac110004 | 192.168.68.62 report_port=3306 | 3306 | ONLINE | SECONDARY | 8.0.22 |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
3 rows in set (0.00 sec)
模拟主库停止后自动切换主节点
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 2d2ef770-4d2a-11ed-af9d-0242ac110002 | 192.168.68.60 | 3306 | ONLINE | SECONDARY | 8.0.22 |
| group_replication_applier | 6367f2b8-4d2a-11ed-bed1-0242ac110003 | 192.168.68.61 | 3306 | UNREACHABLE | PRIMARY | 8.0.22 |
| group_replication_applier | 8818cc27-4d2a-11ed-ae32-0242ac110004 | 192.168.68.62 report_port=3306 | 3306 | ONLINE | SECONDARY | 8.0.22 |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
停止主库
[root@mysql ~]# docker stop mysql8022mgr33061
mysql8022mgr33061
等待一会后发现已经进行切换
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 2d2ef770-4d2a-11ed-af9d-0242ac110002 | 192.168.68.60 | 3306 | ONLINE | PRIMARY | 8.0.22 |
| group_replication_applier | 8818cc27-4d2a-11ed-ae32-0242ac110004 | 192.168.68.62 report_port=3306 | 3306 | ONLINE | SECONDARY | 8.0.22 |
+---------------------------+--------------------------------------+--------------------------------+-------------+--------------+-------------+----------------+
2 rows in set (0.00 sec)
【MySQL高可用】MySQL高可用之MGR部署相关推荐
- mysql 升级高可用_MySQL高可用方案升级规划
这是学习笔记的第2035篇文章 这两天在梳理MySQL高可用方案的升级计划,发现要做的事情还真不少. 我们目前有新系统和老系统,老系统因为历史原因使用的是MySQL 5.5版本,新系统有了整体的规划, ...
- 《MySQL性能优化和高可用架构实践》阅读总结
文章目录 介绍 第1章 MySQL架构介绍 1.1 MySQL简介 1.2 MySQL主流的分支版本 1.3 MySQL存储引擎 1.4 MySQL逻辑架构 1.5 MySQL物理文件体系结构 第2章 ...
- 《MySQL性能优化和高可用架构实践》简介与推荐序
#好书推荐##好书奇遇季#<MySQL性能优化和高可用架构实践>,京东当当天猫都有发售.腾讯云架构师宋立桓倾情奉献,定价59元,网店打折销售其实没多少钱. 互联网公司里面几乎很少有公司不用 ...
- Mysql HA实现MYSQL的高可用
Mysql HA实现MYSQL的高可用 http://colderboy.blog.51cto.com/485582/104872
- gtid mysql failover_Keepalived + MySQLfailover + GTIDs 高可用
配置基于GTIDs的主从 本实验在GTIDs主从的基础上进行,GTIDs配置步骤省略.但不懂的可以参考如下步骤配置 比较简单 1. 修改Master配置文件 1 2 3 4 5 6 vim /etc/ ...
- 《高可用MySQL》2 – 单机版MySQL主从配置
这里搭建的主从是最简单的单一主从复制(即一个Master和一个slave.没有不论什么的热机备份和多slave),该主从结构的基本拓扑图例如以下所看到的: 建立主要的主从复制能够总结为下面三个基本步骤 ...
- mysql高可用_mysql高可用方案
第一节:mysql 高可用方案 1.1 一主一从架构 mysql 配置为主从模式,从库是主库的 backup,同一时间设置其中一台为主服务器,提供读写,另一台服务器作为热备,不提供读写,通过复制与主服 ...
- MySQL高可靠_MySQL高可用与高可靠架构
前言 数据库高可用是生产环境使用数据库必要条件,MySQL数据库通常使用复制技术实现.然MySQL复制本身存在很多的"坑"容易被忽视,导致一些开发或运维人员对于MySQL复制的可靠 ...
- MySQL(11)数据库实现高可用架构之MMM
文章目录 一.MySQL MMM介绍 1.1 什么是 MMM? 1.2 MMM的组成 2.1 MySQL M搭建的步骤(理论) 2.1.1 搭建步骤 2.1.2故障测试 2.2 MySQL M搭建具体 ...
最新文章
- 无线渗透--wifiphisher之wifi钓鱼获取wifi密码
- [Design]设计模式-- 为什么要学习设计原则/模式
- IOS 企业版发布后,用户通过sarafi浏览器安装无效的解决方案
- PSIM软件学习---04 子电路的创建
- 《Troubleshooting Windows 7 Inside Out》文摘-1
- NIO-ByteBuffer
- 【情感分析】华为云细粒度文本情感分析及应用
- opencv基本绘图函数--点,线,矩形,圆等
- 一篇关于用户需求,己方产品(服务)与竞争对手的小清单
- 大型体检系统源码,PEIS医院体检管理系统源码
- OPNsense用户手册-缓存代理
- STM32八路ADC采用DMA方式
- 人力资源管理专业知识与实务(初级)【11】
- 使用阿里云dns+oss+cdn+ssl发布静态网站
- wireshark出现rst的原因_Wireshark过滤器的使用
- PYTHON设置默认清华源
- Java反编译工具JAD的安装与简单使用
- Dayjs 的一些常用方法
- weiit-saas第六篇《如何快速制作与搭建微信公众号商城》
- 【科普】UGC和PGC的区别(用户运营)