KEEPALIVED detection RS principle, keepalivedrs Principle

Source: Internet
Author: User

KEEPALIVED detection RS principle, keepalivedrs Principle

The S function managed by keepalived supports health checks on the real servers of the backend nodes.

 

Common methods includeTcp_checkAnd http_get(More accurate)

 

Tcp_checkThe principle is to implement ip + port detection on the Real Server (we can use wget nmap telnet). If the corresponding port is enabled, add the forwarding table of The lvs instance (ipvsadm-a-t 192.168.1.6: 80-r 192.168.1.12: 80-g). Otherwise, delete the node.

(Ipvsadm-d-t 192.168.1.6: 80-r 192.168.1.12: 80-g)

The configuration method is as follows:

Real_server 192.168.1.11 80 {

Weight 1

TCP_CHECK {

Connect_timeout 3

Nb_get_retry 3

Delay_before_retry 3

Connect_port 80

}

}

 

 

Another way to detect backend nodes isHttp_getOr use ssl_get to verify and compare the md5 value of the accessed content. If the comparison is successful, add the lvs Forwarding Table operation. Similarly, if the verification fails, delete the node.

The configuration method is as follows:

 

First, define the check url and obtain the MD5dum value of the corresponding page.

 

[Root @ web1 bbs] # md5sum/application/nginx/html/bbs/fei.jpg

Ba45c8f60456a672e003a875e469d0eb/application/nginx/html/bbs/fei.jpg

 

The above marked red is the obtained MD5sum value, which will be used in the keepalived configuration file later.

 

Configuration method

 

Real_server 192.168.1.12 80 {

Weight 1

HTTP_GET {

Url {

Path/fei.jpg

Digest ba45c8f60456a672e003a875e469d0eb

}

Connect_timeout 3

Nb_get_retry 3

Delay_before_retry 3

}

}

Note that bbs is the root directory of my site and the root directory location accessed by default with IP address 192.168.1.12

 

Therefore, the url we define is/fei.jpg. Multiple URLs can be defined at the same time. Only after all URLs are detected successfully can the node be added to the ipvs forwarding table.

The sharing is here. If you have any questions, please discuss them ~~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.