配置虚拟ip 采用ifconfig的方式 /sbin/ifconfig eth0:1 192.168.6.66/24 删除VIP: /sbin/ifconfig eth0:1 down 网上找了一个master_ip_failover脚本就是用此方法更改VIP: [root@localhost app1]# more /usr/local/bin/master_ip_online_change_script #!/usr/bin/env perl use strict; use warnings FATAL => 'all';
my $vip = '192.168.6.66/24'; # Virtual IP my $key = "1"; my $ssh_start_vip = "/sbin/ifconfig eth0:$key $vip"; my $ssh_stop_vip = "/sbin/ifconfig eth0:$key down";