Install haproxy keppalived on centos 6.5

Source: Internet
Author: User
Tags haproxy


Haproxy/keepalived server1: 192.168.1.253
Haproxy/keepalived server2: 192.168.1.254
Haproxy/keepalived VIP: 192.168.1.250


Haproxy/keepalived server1:

1. Echo "net. ipv4.ip _ nonlocal_bind = 1">/etc/sysctl. conf
Sysctl-P

Yum-y install keepalived haproxy

2. CP/etc/keepalived. CONF/etc/keepalived. Bak
VI/etc/keepalived. conf
Global_defs {
Notification_email {
[Email protected]
[Email protected]
[Email protected]
}
Notification_email_from [email protected]
Smtp_server 192.168.200.1
Smtp_connect_timeout 30
Router_id centos65-2
}

Vrrp_instance vi_1 {
State master
Interface eth0
Virtual_router_id 51
Priority100
Advert_int 1
Authentication {
Auth_type pass
Auth_pass 1111
}
Virtual_ipaddress {
192.168.1.250
}
}
Delete all of the following

1). Priority value will be higher on master server
2). virtual_router_id shocould be same on both servers
3). By default single vrrp_instance support up to 20 virtual_ipaddress

3. Service keepalived start; chkconfig keepalived on
Ip addr show eth0


4. VI/etc/haproxy. cfg
Comment out the original frontend and backend
Frontend web 192.168.1.250: 8080
Default_backend Web

Listen stats 192.168.1.253: 8080
Mode HTTP
Stats enable
Stats uri/

Backend Web
Balance leastconn
Server web01 192.168.1.253: 80 check
Server web02 192.168.1.254: 80 check

Service haproxy start; chkconfig haproxy on


Haproxy/keepalived server2:

1. Echo "net. ipv4.ip _ nonlocal_bind = 1">/etc/sysctl. conf
Sysctl-P

Yum-y install keepalived haproxy

2. CP/etc/keepalived. CONF/etc/keepalived. Bak
VI/etc/keepalived. conf
Global_defs {
Notification_email {
[Email protected]
[Email protected]
[Email protected]
}
Notification_email_from [email protected]
Smtp_server 192.168.200.1
Smtp_connect_timeout 30
Router_id centos65
}

Vrrp_instance vi_1 {
State backup
Interface eth0
Virtual_router_id 51
Priority 90
Advert_int 1
Authentication {
Auth_type pass
Auth_pass 1111
}
Virtual_ipaddress {
192.168.1.250
}
}
Delete all of the following


3. Service keepalived start; chkconfig keepalived on
Ip addr show eth0


4. VI/etc/haproxy. cfg
Comment out the original frontend and backend
Frontend web 192.168.1.250: 8080
Default_backend Web

Listen stats 192.168.1.254: 8080
Mode HTTP
Stats enable
Stats uri/

Backend Web
Balance leastconn
Server web01 192.168.1.253: 80 check
Server web02 192.168.1.254: 80 check

Service haproxy start; chkconfig haproxy on


This article is from the ilovecat blog, be sure to keep this source http://hj192837.blog.51cto.com/655995/1546076

Install haproxy keppalived on centos 6.5

Related Article

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.