文章目录
1.环境说明
ip | 主机 | 服务 |
---|---|---|
192.168.69.134 | 读写分离解析主机 | proxysql |
192.168.69.130 | mysql-master | mysql |
192.168.69.132 | mysql-master2 | mysql |
192.168.69.5 | mysql-slave | mysql |
192.168.69.6 | mysql-slave2 | mysql |
把所有主机关闭防火墙和setLinux
[root@proxysql ~]# setenforce 0
[root@proxysql ~]# systemctl stop firewalld
2.安装proxysql和安装mysql和配置主从
安装流程图
2.1给四台mysql安装mariadb
[root@mysql-master ~]# yum -y install mariadb mariadb-server
[root@mysql-master ~]# systemctl start mariadb
[root@mysql-master ~]# systemctl enable mariadb
[root@mysql-master ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 *:3306 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
2.2安装proxysql
[root@proxysql ~]# cat <<EOF | tee /etc/yum.repos.d/proxysql.repo
[proxysql_repo]
name= ProxySQL
baseurl=http://repo.proxysql.com/ProxySQL/proxysql-1.4.x/centos/7
gpgcheck=1
gpgkey=http://repo.proxysql.com/ProxySQL/repo_pub_key
EOF
[proxysql_repo]
name= ProxySQL
baseurl=http://repo.proxysql.com/ProxySQL/proxysql-1.4.x/centos/7
gpgcheck=1
gpgkey=http://repo.proxysql.com/ProxySQL/repo_pub_key
[root@proxysql ~]# yum -y install proxysql
[root@proxysql ~]# vi /etc/yum.repos.d/proxysql.repo
[proxysql_repo]
name= ProxySQL
baseurl=http://repo.proxysql.com/ProxySQL/proxysql-1.4.x/centos/7
gpgcheck=1
enabled=1 \\设置开机启动
gpgkey=http://repo.proxysql.com/ProxySQL/repo_pub_key
[root@proxysql ~]# yum -y install mariadb-5.5.60-1.el7_5.x86_64
[root@proxysql ~]# service proxysql start
Starting ProxySQL: 2019-03-14 15:23:54 [INFO] Using config file /etc/proxysql.cnf
DONE!
[root@proxysql ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:6032 *:*
LISTEN 0 128 *:6033 *:*
LISTEN 0 128 *:6033 *:*
LISTEN 0 128 *:6033 *:*
LISTEN 0 128 *:6033 *:*
LISTEN 0 128 *:22 *:*