MySQL高可用架构之MySQL

实验系统:CentOS 6.6_x86_64

实验前提:防火墙和selinux都关闭

实验说明:本实验共有5台主机,IP分配如拓扑

实验软件:mariadb-10.0.20  MySQL-mmm-2.2.1  mysql-mmm-monitor-2.2.1  mysql-mmm-agent-2.2.1

下载地址:

或者

------------------------------------------分割线------------------------------------------

FTP地址:ftp://ftp1.linuxidc.com

用户名:ftp1.linuxidc.com

密码:

在 2015年LinuxIDC.com\8月\MySQL高可用架构之MySQL-MMM配置详解

下载方法见

------------------------------------------分割线------------------------------------------

实验拓扑:

MySQL高可用架构之MySQL

使用MySQL-MMM实现MySQL集群部署 

MySQL MMM架构看不到vip地址 

MySQL的MMM高可用架构测试

MySQL-MMM实现MySQL高可用

MySQL-MMM切换演示

mysql proxy、MySQL-MMM实现读写分离高可用性

将MySQL-MMM Master从REPLICATION_FAIL状态恢复

CentOS下利用MySQL-MMM实现MySQL高可用

一、准备工作

1.根据下表,将各主机名进行修改:

MySQL高可用架构之MySQL

2.修改hosts文件,添加如下内容:

vim /etc/hosts
------------------------------------------->
192.168.19.21  mon
192.168.19.66  db1
192.168.19.74  db2
192.168.19.76  db3
192.168.19.79  db4

3.规划虚拟ip,列表如下:

MySQL高可用架构之MySQL

二、安装mariadb并配置

1.在db1-4上安装:

tar xf mariadb-10.0.20-linux-x86_64.tar.gz  -C /usr/local/
cd /usr/local/
ln -sv mariadb-10.0.20-linux-x86_64 mysql
useradd -r mysql
mkdir -pv /mydata/data
chown -R mysql.mysql /mydata/data/
cd mysql/
chown -R root.mysql .
scripts/mysql_install_db --user=mysql --datadir=/mydata/data/
cp support-files/my-large.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on

2.编辑配置文件:   db1:

vim /etc/my.cnf
--------------------------------------------->
[mysqld]
server-id = 1
datadir = /mydata/data
log-bin = /mydata/data/mysql1-bin
binlog_format = ROW
relay_log = /mydata/data/relay-log
auto-increment-increment = 2
auto-increment-offset = 1
sync_binlog = 1
sync_master_info = 1
sync_relay_log = 1
sync_relay_log_info = 1
max_binlog_size  = 100M
log_slave_updates  = 1
<---------------------------------------------
service mysqld start

    db2:

vim /etc/my.cnf
--------------------------------------------->
[mysqld]
server-id = 2
datadir = /mydata/data
log-bin = /mydata/data/mysql2-bin
binlog_format = ROW
relay_log = /mydata/data/relay-log
auto-increment-increment = 2
auto-increment-offset = 2
sync_binlog = 1
sync_master_info = 1
sync_relay_log = 1
sync_relay_log_info = 1
max_binlog_size  = 100M
log_slave_updates  = 1
<---------------------------------------------
service mysqld start

    db3:

vim /etc/my.cnf
--------------------------------------------->
[mysqld]
server-id = 3
datadir = /mydata/data
log-bin = /mydata/data/mysql3-bin
binlog_format = ROW
relay_log = /mydata/data/relay-log
sync_binlog = 1
sync_master_info = 1
sync_relay_log = 1
sync_relay_log_info = 1
max_binlog_size  = 100M
log_slave_updates  = 1
<---------------------------------------------
service mysqld start

db4:

vim /etc/my.cnf
--------------------------------------------->
[mysqld]
server-id = 4
datadir = /mydata/data
log-bin = /mydata/data/mysql4-bin
binlog_format = ROW
relay_log = /mydata/data/relay-log
sync_binlog = 1
sync_master_info = 1
sync_relay_log = 1
sync_relay_log_info = 1
max_binlog_size  = 100M
log_slave_updates  = 1
<---------------------------------------------
service mysqld start

这里需要创建三个用户,如下表:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/b62589b48c66afcbeeca399b5b683643.html