码迷,mamicode.com
首页 > 其他好文 > 详细

mha配置参考

时间:2019-01-08 12:13:32      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:data   lease   name   互信   nlog   sel   软件   local   query   

1.ssh互信配置:
ssh-keygen -t rsa
ssh-copy-id -i .ssh/id_rsa.pub root@192.168.56.201

2.mysql复制配置参考:
http://blog.51cto.com/1937519/2283779

3.创建监控用户:
root@localhost 15:28: [(none)]>create user monitor@‘%‘ identified by "monitor123";
Query OK, 0 rows affected (0.01 sec)

root@localhost 15:28: [(none)]>GRANT SELECT, RELOAD, SUPER, REPLICATION CLIENT ON . TO ‘monitor‘@‘%‘;
Query OK, 0 rows affected (0.00 sec)

4.软件信息:
node下载:
https://github.com/yoshinorim/mha4mysql-node/releases/tag/v0.58
manager下载:
https://github.com/yoshinorim/mha4mysql-manager/releases/tag/v0.58
安装配置wiki参考:
https://github.com/yoshinorim/mha4mysql-manager/wiki

5.配置文件参考:
[root@db1 mysql]# cat /etc/masterha_default.cnf
[server default]
user=repl
password=MYsql#123
ssh_user=root
master_binlog_dir= /data/mysql/data
remote_workdir=/logs/mysql
#secondary_check_script= masterha_secondary_check -s master1 -s master2
#master_ip_failover_script=/usr/bin/scripts/master_ip_failover
#shutdown_script= /usr/bin/scripts/power_manager
#report_script= /usr/bin/scripts/send_master_failover_mail
#master_ip_online_change_script=/usr/bin/scripts/scripts/master_ip_online_change

cat /etc/masterha/app1.cnf
[server default]
manager_workdir=/logs/master/app1
manager_log=/logs/master/app1/manager.log
master_binlog_dir=/data/mysql/data
master_ip_failover_script=/logs/master/app1/master_ip_failover
master_ip_online_change_script=/logs/master/app1/master_ip_online_change
secondary_check_script= /usr/bin/masterha_secondary_check -s 192.168.56.202 -s 192.168.56.203 --user=root --master_host=192.168.56.201 --master_ip=192.168.56.201 --master_port=3306

user=monitor
password=monitor123
ping_interval=1
remote_workdir=/tmp
repl_user=repl
repl_password=MYsql#123
ssh_user=root

[server1]
hostname=192.168.56.201
ssh_port=22
port=3306
no_master=1

[server2]
hostname=192.168.56.202
ssh_port=22
port=3306
candidate_master=1
check_repl_delay=0

[server3]
hostname=192.168.56.203
ssh_port=22
port=3306

检查ssh:
masterha_check_ssh --conf=/etc/masterha/app1.cnf

检查复制:
masterha_check_repl --conf=/etc/masterha/app1.cnf

手动切换:
masterha_master_switch --conf=/etc/masterha/app1.cnf --master_state=alive --new_master_host=192.168.56.202 --new_master_port=3306 --orig_master_is_new_slave --running_updates_limit=10000

开启监控:
nohup masterha_manager --conf=/etc/masterha/app1.cnf --remove_dead_master_conf --ignore_last_failover < /dev/null > /logs/master/app1/manager.log 2>&1 &

查看状态:
masterha_check_status --conf=/etc/masterha/app1.cnf
app1 (pid:2841) is running(0:PING_OK), master:192.168.56.202

停止监控:
masterha_stop --conf=/etc/masterha/app1.cnf

mha配置参考

标签:data   lease   name   互信   nlog   sel   软件   local   query   

原文地址:http://blog.51cto.com/1937519/2340033

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!