亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MHA 學習(二) 配置文件

發布時間:2020-08-12 21:58:05 來源:ITPUB博客 閱讀:124 作者:stay_sun 欄目:MySQL數據庫
一  配置  所有 主機的  ssh key 認證
ssh-keygen -t rsa 
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.10.103 


二  數據庫授權  
grant all privileges on *.* TO mha@'192.168.%' IDENTIFIED BY 'test';  

三 配額文件  
 /etc/masterha_default.cnf 
 [server default]
  user=mha
  password=test
  ssh_user=root
  master_binlog_dir= /zx/mysql/data
  remote_workdir=/var/log/mha/app1
#  secondary_check_script= masterha_secondary_check -s master1 -s master2
  ping_interval=3
  master_ip_failover_script=/etc/mha/scripts/master_ip_failover
#  shutdown_script= /etc/mha/scripts/power_manager
#  report_script= /etc/mha/scripts/send_master_failover_mail
#master_ip_online_change_script=/etc/mha/scripts/master_ip_online_change



[root@manager mha]# cat /etc/mha/app1.cnf 
[server default]
manager_log=/var/log/mha/app1/manager.log
manager_workdir=/var/log/mha/app1.log
master_binlog_dir=/zx/mysql/data
password=test
ping_interval=2
repl_password=zhangxu
repl_user=repl_user
ssh_user=root
user=mha


[server1]
candidate_master=1
check_repl_delay=0
hostname=master2
port=3306


[server2]
candidate_master=1
check_repl_delay=0
hostname=master1
port=3306


[root@manager mha]# cat scripts/master_ip_failover
#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
use Getopt::Long;
my (
$command, $ssh_user, $orig_master_host, $orig_master_ip,
$orig_master_port, $new_master_host, $new_master_ip, $new_master_port
);
my $vip = '192.168.248.100'; # Virtual IP
my $gateway = '192.168.1.1';#Gateway IP
my $interface = 'eth2';
my $key = "1";
my $ssh_start_vip = "/sbin/ifconfig $interface:$key $vip;/sbin/arping -I $interface -c 3 -s $vip $gateway >/dev/null 2>&1";
my $ssh_stop_vip = "/sbin/ifconfig $interface:$key down";
GetOptions(
'command=s' => \$command,
'ssh_user=s' => \$ssh_user,
'orig_master_host=s' => \$orig_master_host,
'orig_master_ip=s' => \$orig_master_ip,
'orig_master_port=i' => \$orig_master_port,
'new_master_host=s' => \$new_master_host,
'new_master_ip=s' => \$new_master_ip,
'new_master_port=i' => \$new_master_port,
);
exit &main();
sub main {
print "\n\nIN SCRIPT TEST====$ssh_stop_vip==$ssh_start_vip===\n\n";
if ( $command eq "stop" || $command eq "stopssh" ) {
# $orig_master_host, $orig_master_ip, $orig_master_port are passed.
# If you manage master ip address at global catalog database,
# invalidate orig_master_ip here.
my $exit_code = 1;
eval {
print "Disabling the VIP on old master: $orig_master_host \n";
&stop_vip();
$exit_code = 0;
};
if ($@) {
warn "Got Error: $@\n";
exit $exit_code;
}
exit $exit_code;
}
elsif ( $command eq "start" ) {
# all arguments are passed.
# If you manage master ip address at global catalog database,
# activate new_master_ip here.
# You can also grant write access (create user, set read_only=0, etc) here.
my $exit_code = 10;
eval {
print "Enabling the VIP - $vip on the new master - $new_master_host \n";
&start_vip();
$exit_code = 0;
};
if ($@) {
warn $@;
exit $exit_code;
}
exit $exit_code;
}
elsif ( $command eq "status" ) {
print "Checking the Status of the script.. OK \n";
`ssh $ssh_user\@$orig_master_host \" $ssh_start_vip \"`;
exit 0;
}
else {
&usage();
exit 1;
}
}
# A simple system call that enable the VIP on the new master
sub start_vip() {
`ssh $ssh_user\@$new_master_host \" $ssh_start_vip \"`;
}
# A simple system call that disable the VIP on the old_master
sub stop_vip() {
`ssh $ssh_user\@$orig_master_host \" $ssh_stop_vip \"`;
}
sub usage {
print
"Usage: master_ip_failover --command=start|stop|stopssh|status --orig_master_host=host --orig_master_ip=ip --orig_master_port=port --new_master_host=host --new_master_ip=ip --new_master_port=port\n";
}


啟動腳本 

nohup masterha_manager --ignore_last_failover --remove_dead_master_conf --conf=/etc/mha/app1.cnf --remove_dead_master_conf < /dev/null > /var/log/mha/app1/app1.log 2>&1 &

檢查復制
masterha_check_repl --conf=/etc/mha/app1.cnf
檢查ssh
masterha_check_ssh --conf=/etc/mha/app1.cnf
檢查 mha 狀態 
masterha_check_status --conf=/etc/mha/app1.cnf

切換完成后 

進程就死掉了  重新修改配置文件
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

聂拉木县| 阳高县| 泰州市| 平罗县| 沙河市| 平潭县| 齐齐哈尔市| 高邑县| 鲜城| 屏山县| 甘泉县| 浏阳市| 大名县| 衡阳县| 轮台县| 冀州市| 藁城市| 宁安市| 都兰县| 封丘县| 塘沽区| 二连浩特市| 永平县| 宿松县| 慈利县| 鸡泽县| 老河口市| 溧阳市| 新竹市| 堆龙德庆县| 绿春县| 谢通门县| 大理市| 航空| 南漳县| 七台河市| 绥宁县| 宁乡县| 肇东市| 香格里拉县| 临夏县|