Linux self-study notes--lvs and keepalived high-availability Foundation

Source: Internet
Author: User

1.lvs Load Mode

Static: Based on algorithm only

(1) RR Polling

(2) WRR Weighted Polling

(3) The SH source address hash, which binds a user's access session to a fixed server in a KV structure, can be considered as one of the load balancing cluster-preserving sessions.

(4) DH Target Address hash, column: With DH to the proxy server load balancing, intranet host access to the Web page, the conference KV structure store User IP and website address, improve the proxy server cache hit ratio.

Dynamic: Based on the algorithm and the current load status of each RS

(1) LC: Minimum connection, number of active connections *256+ inactive connection

(2) WLC: Default, weighted minimum connection (number of active connections *256+ inactive connection)/weight

...

2.ipvsadm

(1) Managing clusters

ipvsadm-a| e| D-t|u|f Lvsaddr:port [-S dispatch method default WLC]

(2) manage the RS on the cluster

Ipvsadm a|e|d-t|u|f lvsaddr:port-r rsaddr[:p ort] [-g|i|m] [-W]

G:DR I:nat I:tun

(3) View

IPVSADM-NL--stats--rate

(4) Save and reload

Ipvsadm-s >/path/file

Ipvsadm-r </path/file

(5) emptying the counter

Ipvsadm-z [-t|u]

(6) Persistent connection

ipvsadm-a| E-t|u|f lvsaddr-s Scheduling Method-p timeout defaults to 5 minutes

(7) NAT Load Balancing

The load balancer has both internal and external network cards

Intranet host Gateway pointing to intranet network card

turn on the core forwarding function echo ' 1 ' >/proc/sys/net/ipv4/ip_forward   

(8) Dr Load Balancer (simple configuration of each host independent address)

internal and external network addresses on the load balancer NIC

The RS host has an internal and external address, and the lo:0 alias has a vs address

RS Host does urp suppress echo ' 1 ' >/proc/sys/net/ipv4/conf/all/arp_ignore

Echo ' 2 ' >/proc/sys/net/ipv4/conf/all/arp_announce

3.keepalive

(1) Main master model: Two servers are primary and standby, using DNS to do dual address equalization

(2) Public configuration

global_defs{

notication_emaiil{

[email protected] }

Notication_email_from [email protected]

Smtp_server 127.0.0.1

Smtp_connect_timeout 30

router_id Node1

}

(3) Virtual routing

Vrrp_instance Lv_1 {

State master| BACKUP

Interface eth0

VIRTUAL_ROUTER_ID 38 Virtual Routing id,0-255

Priority 100 Precedence

Adret_int 1 Notification Interval

Auth_type pass| AH

Auth_pass 1234

virtual_ipaddress{

192.168.100.100

}

Notity_master "/path/file.sh"

Notity_backup "/path/file.sh"

Notity_fault "/path/file.sh" track_script{

Ch_down setting up a manual downline script

CH_HTTPD Monitoring Web Services

}

Vrrp_script ch_down{

Script "[[-f/etc/keepalived/down]]&&exit 1 | | Exit 0 "

Interval 2

Weight-5

}

Vrrp_script ch_httpd{

Script "killall-0 httpd"

Interval 2

Weight-5

}

}

Linux self-study notes--lvs and keepalived high-availability Foundation

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.