====== lvs構築 ======
- インストール
yum install --exclude=*.i386 ipvsadm iproute curl keepalived
- arp
less /etc/sysctl.conf
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.eth0.arp_ignore=1
net.ipv4.conf.eth0.arp_announce=2
sysctl -p
- lo:0
vi /etc/sysconfig/network-scripts/ifcfg-lo:0
DEVICE=lo:0
IPADDR=192.168.24.183 ←lvsのvip
NETMASK=255.255.255.255
NETWORK=192.168.24.0
BROADCAST=192.168.24.255
ONBOOT=yes
NAME=loopback
/etc/init.d/network restart
- keepalived.conf
vi /etc/keepalived/keepalived.conf
#
# Configuration File for keepalived
#
global_defs {
notification_email {
taro@clown.com
}
notification_email_from keepalived@clown
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id moca_lvs_0
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.24.183
}
}
# for MySQL Slave service
virtual_server 192.168.24.183 3306 {
delay_loop 1
lb_algo wrr
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP
real_server 192.168.24.233 3306 {
weight 100
inhibit_on_failure
TCP_CHECK {
connect_port 3306
connect_timeout 15
} # TCP_CHECK
} # real_server
real_server 192.168.24.234 3306 {
weight 100
inhibit_on_failure
TCP_CHECK {
connect_port 3306
connect_timeout 15
} # TCP_CHECK
} # real_server
}
# for Kyototycoon service
virtual_server 192.168.24.183 11221 {
delay_loop 1
#lvs_sched wlc
lvs_sched wrr
lvs_method DR
protocol TCP
# sorry server
# KT standby server
sorry_server 192.168.24.230 11221
real_server 192.168.24.229 11221 {
weight 100
inhibit_on_failure
TCP_CHECK {
connect_port 11221
connect_timeout 15
} # TCP_CHECK
} # real_server
} # virtual_server
- keepalived start
/etc/init.d/keepalived start