1.创建MySQL用户
在binghe151服务器上的MySQL命令行中创建用于测试的MySQL用户。
- mysql> CREATE USER 'mysqlha'@'%' IDENTIFIED BY 'mysqlha123456';
- Query OK, 0 rows affected (0.00 sec)
- mysql> ALTER USER 'mysqlha'@'%' IDENTIFIED WITH mysql_native_password BY 'mysqlha123456';
- Query OK, 0 rows affected (0.00 sec)
- mysql> GRANT ALL ON *.* TO 'mysqlha'@'%';
- Query OK, 0 rows affected (0.00 sec)
- mysql> FLUSH PRIVILEGES;
- Query OK, 0 rows affected (0.00 sec)
注意:这里为MySQL用户指定的IP地址为虚拟IP地址192.168.175.11。
2.配置Keepalived
(1)分别在binghe151和binghe152服务器上修改Keepalived的配置文件keepalived.conf。