MHA故障切換腳本master_ip_failover結合VIP

 MHA故障切換腳本master_ip_failover結合VIP:

創新互聯的客戶來自各行各業,為了共同目標,我們在工作上密切配合,從創業型小企業到企事業單位,感謝他們對我們的要求,感謝他們從不同領域給我們帶來的挑戰,讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。專業領域包括網站制作、成都做網站、電商網站開發、微信營銷、系統平臺開發。

#!/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, 
     $new_master_user, $new_master_password, $app_vip, $netmask, $interface, 
);
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,
    'new_master_user=s'     => \$new_master_user,
    'new_master_password=s' => \$new_master_password,
    'app_vip=s'            => \$app_vip,
    'netmask=i'           => \$netmask,
    'interface=s'         => \$interface,
);
my $ssh_start_vip = "sudo ip addr add $app_vip dev $interface";
my $ssh_stop_vip = "sudo ip addr delete $app_vip dev $interface";
my $ssh_flush_arp = "sudo arping -c 4 -A -I $interface $app_vip";
exit &main();
sub main {
    print "\n\nIN SCRIPT TEST====$ssh_stop_vip==$ssh_start_vip===\n\n";
    if ( $command eq "stop" || $command eq "stopssh" ) {
        my $exit_code = 1;
        eval {
            print "Disabling the app_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" ) {
        my $exit_code = 10;
        eval {
            print "Enabling the app_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\@cluster1 \" $ssh_start_vip \"`;
        exit 0;
    }
    else {
        &usage();
        exit 1;
    }
}
# A simple system call that enable the app_vip on the new master
sub start_vip() {
    `ssh $ssh_user\@$new_master_host \" $ssh_start_vip \"`;
    `ssh $ssh_user\@$new_master_host \" $ssh_flush_arp \"`;
}
# A simple system call that disable the app_vip on the old_master
sub stop_vip() {
     return 0  unless  ($ssh_user);
    `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";
}

標題名稱:MHA故障切換腳本master_ip_failover結合VIP
鏈接分享:http://m.kartarina.com/article48/pphjep.html

成都網站建設公司_創新互聯,為您提供關鍵詞優化網站維護網站制作用戶體驗移動網站建設品牌網站設計

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

網站托管運營
主站蜘蛛池模板: 亚洲精品一级无码鲁丝片| 免费A级毛片无码久久版 | 亚洲AV无码一区二区三区在线| 亚洲精品无码久久久久YW| 精品人妻中文无码AV在线| 国产成人亚洲综合无码精品| 国产精品三级在线观看无码| 在线精品自偷自拍无码中文| 不卡无码人妻一区三区音频 | 亚洲∧v久久久无码精品 | 无码一区二区三区AV免费| 无码人妻精品一区二区三区99不卡| 亚洲AV无码精品色午夜果冻不卡 | 久久久久久亚洲av无码蜜芽| 成人午夜精品无码区久久| 日韩av片无码一区二区不卡电影| 亚洲av无码片在线播放| 免费a级毛片无码a∨免费软件| 无码人妻aⅴ一区二区三区有奶水| 无码性午夜视频在线观看| 国产福利电影一区二区三区久久老子无码午夜伦不 | 久久久久亚洲AV无码麻豆| 国产成人无码精品久久久性色 | 久久ZYZ资源站无码中文动漫| 成人免费无码H在线观看不卡| 高清无码一区二区在线观看吞精 | 久久老子午夜精品无码怎么打| 一区二区三区无码高清| 国产精品无码一区二区在线观| 最新无码人妻在线不卡| 免费A级毛片无码无遮挡内射| 免费A级毛片无码A∨| 在线看无码的免费网站| 亚洲AV永久无码精品一百度影院| 久久中文精品无码中文字幕| 13小箩利洗澡无码视频网站免费 | 小SAO货水好多真紧H无码视频| 中文字幕av无码不卡免费| 人妻AV中出无码内射| 亚洲中文久久精品无码| 无码人妻熟妇AV又粗又大|