Most people use this option to offload the traffic for real-server.
In this blog I am
going to show workaround for this limitation.
I am having keepalived version v2.1.5
Configuration Steps
- Create a folder call "status" inside the "/etc/keepalived" folder.
- Create two files "active" and "passive"
- Content inside the active file should be "0". Content inside passive file should be non-zero.
- Apply the keepalived configurations as follow.
- We have to define two track file. One for active. Other one for passive.
track_file _active {file /etc/keepalived/status/activeweight 1}track_file _passive {file /etc/keepalived/status/passiveweight 0}
- Include this track file to real_server
real_server 5.79.56.40 9006 {weight 1TCP_CHECK {connect_port 9006connect_timeout 3retry 3delay_before_retry 2}FILE_CHECK {track_file _active#track_file _passive}}
Full configuration
global_defs {router_id TestQS}
vrrp_instance Float_QS_Test {state BACKUPinterface enp0s3virtual_router_id 66priority 101 # 101 on master, 100 on backupadvert_int 1nopreemptsmtp_alertvirtual_ipaddress {192.168.8.201/24 #data.directfn.com}}
track_file _active {file /etc/keepalived/status/activeweight 1}track_file _passive {file /etc/keepalived/status/passiveweight 0}
virtual_server 192.168.8.201 9006 {lvs_sched rrlvs_method DRprotocol TCPinhibit_on_failurereal_server 5.79.56.40 9006 {weight 1TCP_CHECK {connect_port 9006connect_timeout 3retry 3delay_before_retry 2}FILE_CHECK {track_file _active#track_file _passive}}real_server 78.136.25.234 9006 {weight 1TCP_CHECK {connect_port 9006connect_timeout 3retry 3delay_before_retry 2}FILE_CHECK {track_file _active#track_file _passive}}}



No comments:
Post a Comment