当前位置:Gxlcms > 数据库问题 > day9-mysql集群

day9-mysql集群

时间:2021-07-01 10:21:17 帮助过:2人阅读

使用mysql-mmm和mysql主从同步部署mysql高可用集群

  1. 配置主主结构

A、B主机设置

mysql> grant replication slave on *.* to user@"%" identified by "1";

A主机

技术分享

mysql> change master to master_host="192.168.100.101",master_user="user",master_password="1",master_log_file="master2.000001",master_log_pos=106;

mysql> slave start;

技术分享

B主机

技术分享

mysql> change master to master_host="192.168.100.100",master_user="user",master_password="1",master_log_file="master1.000001",master_log_pos=106;

mysql> slave start;

技术分享

?

  1. 配置一主多从结构

C主机

技术分享

mysql> change master to master_host="192.168.100.101",master_user="user",master_password="1",master_log_file="master2.000001",master_log_pos=106;

D主机

技术分享

mysql> change master to master_host="192.168.100.101",master_user="user",master_password="1",master_log_file="master2.000001",master_log_pos=106;

?

  1. 在所有机器安装mysql-mmm软件

tar xf mysql-mmm-2.2.1.tar.gz

cd mysql-mmm-2.2.1

make install

?

  1. 配置mysql-mmm实现mysql高可用集群

mmm_common.conf——所有服务器都需配置,都一样

作用:指定集群中服务器的角色和使用的虚拟IP地址

?

数据库服务器都设置数据库授权

mysql> grant replication client on *.* to monitor@"%" identified by "monitor";

mysql> grant replication client,process,super on *.* to agent@"%" identified by "agent";

?

所有的数据库服务器都要配置

vim /etc/mysql-mmm/mmm_agent.conf????????

include mmm_common.conf????????//加载mmm_common.conf

this 主机名????????//指定自己的主机名

?

监控配置

day9-mysql集群

标签:

人气教程排行