Keepalived, Lvs,tomcat high availability, high concurrency, high-performance application architecture
Keepalived, LVS built on the same server, two Tomcat on a tomcat
Four server versions: CentOS 6.5
Yum Install Ipvsadm-y
Keepalived:etc/keepalived/keepalived.conf
! Configuration File for Keepalived
Global_defs {
Notification_email {
Root@localhost
}
Notification_email_from Alexandre.Cassen@firewall.loc
Smtp_server 192.168.184.178
Smtp_connect_timeout 30
router_id Lvs_devel
}
Vrrp_instance Vi_1 {
StateMASTER
Interface eth0
VIRTUAL_ROUTER_ID 51
Priority -
Advert_int 1
Authentication {
Auth_type Pass
Auth_pass 1111
}
virtual_ipaddress {
192.168.184.222/24 Dev eth0 label eth0:a
}
}
Virtual_server 192.168.184.222 80 {
Delay_loop 6
Lb_algo WRR
Lb_kind DR
Nat_mask 255.255.255.0
Persistence_timeout 50
Protocol TCP
Real_server 192.168.184.188 80 {
Weight 1
Http_get {
URL {
Path/
Status_code
}
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 3
}
}
Real_server192.168.184.168{
Weight 1
Http_get {
URL {
Path/
Status_code 200
}
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 2
}
}
}
=================
! Configuration File for Keepalived
Global_defs {
Notification_email {
Root@localhost
}
Notification_email_from Alexandre.Cassen@firewall.loc
Smtp_server 192.168.184.178
Smtp_connect_timeout 30
router_id Lvs_devel
}
Vrrp_instance Vi_1 {
State BACKUP
Interface eth0
VIRTUAL_ROUTER_ID 51
Priority 10
Advert_int 1
Authentication {
Auth_type Pass
Auth_pass 1111
}
virtual_ipaddress {
192.168.184.222/24 Dev eth0 label eth0:a
}
}
Virtual_server 192.168.184.222 80 {
Delay_loop 6
Lb_algo WRR
Lb_kind DR
Nat_mask 255.255.255.0
Persistence_timeout 50
Protocol TCP
Real_server 192.168.184.188 80 {
Weight 1
Http_get {
URL {
Path/
Status_code 200
}
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 3
}
}
Real_server 192.168.184.168 80 {
Weight 1
Http_get {
URL {
Path/
Status_code 200
}
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 2
}
}
}
========================
Configuring the Lo:a IP address on the device is required on the Tomcat server