LVS Server2
[Linux/CentOS7] Install LVS + Keepalived Server #2
※ Did you got the good news? Please click ad again, 좋은 정보 얻으셨다면 광고 한번 눌러주시는 센스 부탁드려요
This is the Redundant configuration for LVS + Keepalived Server itself.
This example is based on the environment below.
HTTP packets to the eth0 on LVS Server are forwarded to Backend01 and Backend02 Servers with NAT.
Change the default gateway to internal IP address of LVS on both Backend Web Servers first. (it's 10.0.0.29 on the example)
1. Install ipvsadm and keepalived.
[root@otaec ~]# yum -y install ipvsadm keepalived
# enable IP forward
[root@otaec ~]# echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
[root@otaec ~]# sysctl -p
[root@otaec ~]# touch /etc/sysconfig/ipvsadm
[root@otaec ~]# systemctl start ipvsadm
[root@otaec ~]# systemctl enable ipvsadm
2. Configure Keepalived.
It's OK to configure the same settings except one setting on both backend servers.
(but only for the "priority" section, Change it on both backend server.)
[root@otaec ~]# mv /etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf.org
[root@otaec ~]# vi /etc/keepalived/keepalived.conf
# create new
global_defs {
notification_email {
root@otaec.server.world
}
notification_email_from root@otaec.server.world
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_Server
}
vrrp_instance VI_1 {
state BACKUP
# monitored interface
interface eth0
# virtual router's ID
virtual_router_id 51
# set priority (change this value on each server)
# (large number means priority is high)
priority 100
nopreempt
# VRRP sending interval
advert_int 1
# authentication info between Keepalived servers
authentication {
auth_type PASS
auth_pass password
}
virtual_ipaddress {
# virtual IP address
192.168.0.29 dev eth0
10.0.0.29/24 dev eth1
}
}
virtual_server 192.168.0.29 80 {
# monitored interval
delay_loop 3
# distribution method
lvs_sched rr
# routing method
lvs_method NAT
protocol TCP
# backend server#1
real_server 10.0.0.51 80 {
weight 1
HTTP_GET {
url {
# monitored path
path /
# status code for normally state
status_code 200
}
# timeout(sec)
connect_timeout 3
}
}
# backend server#2
real_server 10.0.0.52 80 {
weight 1
HTTP_GET {
url {
path /
status_code 200
}
connect_timeout 3
}
}
}
[root@otaec ~]# systemctl start keepalived
[root@otaec ~]# systemctl enable keepalived
[Linux/CentOS7] Install LVS + Keepalived Server #2
'리눅스 > 소프트웨어(Software)' 카테고리의 다른 글
DNS 설치 (0) | 2017.01.31 |
---|---|
하드웨어 부하테스트 (Stress) (0) | 2016.07.13 |
LVS Server1 (0) | 2016.04.08 |
리눅스 본딩셋팅 (0) | 2015.09.14 |
openssl 이용 키 생성 및 적용 (0) | 2015.07.09 |