inhumming 2020-06-10
安装MySQL:(RPM包安装)
Linux version 2.6.32-642.el6.x86_64 mysql Ver 14.14 Distrib 5.6.40 mha-manager-0.56,mha-node-0.56
+ 角色分配:
+ 整体架构图:
执行安装命令:
yum -y install mysql-server
等待安装完成后,查看相应的包是否安装成功
rpm -qa | grep mysql
启动MySQL:
systemctl start mysqld
查看MySQL是否正常启动:
netstat -antp | grep mysqld
由于MySQL安装启动后会自动生成临时密码,需要在日志中将此密码过滤出来:
grep ‘temporary password‘ /var/log/mysqld.log
登录成功后,进行密码的修改
此时未修改临时密码需要先进行修改
mysql> set password=‘#‘;
开启远程控制:
MySQL默认未开启远程控制即只能自己访问别的主机无法访问此数据库,必须添加远程访问的用户。
+ 首先配置四台主机之间免密登陆。
[ ~]# echo -e "\n" |ssh-keygen -t dsa -N ""
[ ~]# ssh-copy-id -i .ssh/id_dsa.pub
[ ~]# ssh-copy-id -i .ssh/id_dsa.pub
[ ~]# ssh-copy-id -i .ssh/id_dsa.pub
在manager节点上编辑配置文件:
[server default]
manager_workdir=/var/log/masterha/app1
manager_log=/var/log/masterha/app1/manager.log
remote_workdir=/var/log/masterha/app
ssh_user=root
user=manager
password=1234
repl_user=slave
repl_password=1234
ping_interval=1
master_ip_failover_script="/etc/masterha/master_ip_failover"
/*---
[server default]
manager_workdir=/var/log/masterha/app1
manager_log=/var/log/masterha/app1/manager.log
ssh_user=root
user=manager
password=1234
repl_user=slave
repl_password=1234
[server1]
hostname=192.168.1.211
candidate_master=1
master_binlog_dir=/data/mysql/
[server2]
hostname=192.168.1.202
candidate_master=1
master_binlog_dir=/data/mysql/
[server3]
hostname=192.168.1.205
master_binlog_dir=/data/mysql/