authentication {auth_type PASS auth_pass along} virtual_ipaddress {172.17.100.100} track_script {# execution script chk_haproxy }}
Service keepalived start enable the keepalived service
After the service is enabled, you can view that the VIP has been generated.
(2) InHaproxy-server-master from: You only need to change the master to slave, and the priority is reduced.
Vim/etc/keepalived. conf
! Configuration File for keepalivedglobal_defs { notification_email { root@localhost } no
**************************************** *************(2) install the kernel versionBefore installation, check the kernel version. Here is 2.6.18.Make TARGET = linux26 PREFIX =/usr/local/hapropxyMake install PREFIX =/usr/local/haproxy(3) set the configuration fileCd/usr/local/haproxyVi haproxy. cfg**************************************** *************########### Global configuration #########GlobalLog 127.0
: 2. Unzip: Tar zxf haproxy-1.7.1.tar.gz3. Go to the installation file directory: CD haproxy-1.7.14. Compile: Make target=linux26 prefix=/usr/local/haproxy171 Without errors, proceed to the next step to install:5. Install: sudo make install prefix=/usr/local/haproxy171 6. Haproxy after installation is no configuration file directory, here manually created: 7.
browser testing, the successful implementation of HTTP automatic redirection for HTTPS access, but due to the inability to render this dynamic effect, it is not truncated.V. Configuring HAPROXY to use stand-alone log filesThe original source of this article: Jiangjianrong Technical Blog http://jiangjianlong.blog.51cto.com/3735273/18872791, Haproxy
protocol, that is, jump to the http://haproxy.ilanni.com address. 1.4 multiple domain names on the same server Use https. The same server uses http protocol to access http.ilanni.com and haproxy.ilanni.com. 2. Configure haproxy and test the business needs. Now we can configure haproxy to meet the business needs one by one. 2.1 http jump https configuration to be honest, the https configuration of
SchemeIn the previous article, we discussed the theoretical knowledge of load balancing, and this article I intend to talk about practical methods and problems encountered in practiceScenario: Haproxy HTTP Layer Load BalancingInstall a Haproxy service, two Web servicesHaproxy:192.168.1.227:80Web1 Http://192.168.1.226:8081/loginWEB2 Http://192.168.1.246:8888/loginThe Web service is prepared for itself, and t
directorymkdir /etc/haproxy6. Copy the template configuration file to the Haproxy directorycp examples/haproxy.cfg /etc/haproxy/ 7. Edit Haproxy. CFG configuration filevim /etc/haproxy/haproxy.cfg
#1. Delete the following 2 lines of statementsChroot/usr/share/haproxyRedispatch
#2. Delete all Listen it
;650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/8C/22/wKioL1hjXv_wyflxAAAdzASW_L4197.png-wh_500x0-wm_3 -wmp_4-s_1766854770.png "title=" 8.PNG "alt=" Wkiol1hjxv_wyflxaaadzasw_l4197.png-wh_50 "/>Second: Install Nginx and make a simple web page to testYum-y Install Pcre-devel Zlib-develTar zxf nginx-1.6.2.tar.gzCD nginx-1.6.2./configure--prefix=/usr/local/nginx--user=nginx--group=nginx make make installUseradd-m-s/sbin/nologin NginxLn-s/usr/local/nginx/sbin/*/usr/local/sbin/echo "Node
Main Standby modeProgramme IThat is also where the VIP is, Haproxy is where to start the main standby mode.[Email protected] ~]# Cat/etc/ha.d/haresources#gao services#10.0.0.103 Www.lvnian.orgMASTER ipaddr::10.0.0.103/24/ Eth0 Haproxyd [[email protected] ~]#Note the point:# #haproxy If you manage heartbeat, then the Haproxy script above must be/etc/init.d/directo
between different domain names of the same server
All access to the http.ilanni.com domain name on the same server is directed to the https://http.ilanni.com, and access to haproxy.ilanni.com is directed to the http://haproxy.ilanni.com address.
1.4Multiple Domain names on the same server Use https
The same server uses http protocol to access http.ilanni.com and haproxy.ilanni.com.
2. Configure haproxy and test Business Requirements
Now we can config
#---------------------------------------------------------------------0809#---------------------------------------------------------------------10# Global settings11#---------------------------------------------------------------------12global13# to have these messages end up in /var/log/haproxy.log you will14# need to:15#16# 1) configure syslog to accept network log events. This is done17# by adding the '-
operating system when using Haproxy
2. Installation
Go to haproxy website Download address http://www.haproxy.org/
Official website Current stable version 1.7.8 version download address
Http://www.haproxy.org/download/1.7/src/haproxy-1.7.8.tar.gz
Tar zxvf haproxy-1.7.8.tar.gz
cd
tcpv4_connect_server
It is clear here that the function is triggered by calling the connect_server function and then based on the previously specified connection function. Because the tcpv4_connect_server function is specified in 3.2, it is triggered, the connect function is called in the tcpv4_connect_server function, so you need to track the connect_server function.
3.4 call of connect_server
View the call stack,
Try to locate the problem through a similar call mechanism.
More detailed call
off Net.ipv4.tcp_tw_reuse = 1 ### enable the Windows scaling defined by RFC 1323 to support TCP windows over 64KB. This value must be enabled (1 is enabled) and the ### TCP window will not take effect until both sides of the 1GB,TCP connection are enabled, the default is 1 net.ipv4.tcp_window_scaling = 1 ### maximum use of physical memory Vm.swappiness = 0
Edit/etc/security/limits.conf Add the following content
* Soft Nofile 10000000
* Hard nofile 10000000
root soft nofile 10000000
root hard N
Haproxy achieves load balancing and dynamic/static Separation
After haprxy Server Load balancer and dynamic/static separation, haproxy is more professional in these two aspects than nginx, including session persistence, cookie guidance, and url monitoring backend, mysql Server Load balancer is not available in nginx, but it cannot be said that haprox can replace nginx, and nginx cache is not available in pr
available situation, the single-buffering mechanism can not copy any data to complete the read and write operation, which will save a lot of CPU clock cycle and memory bandwidth;4, with the help of the splice () system call on the Linux 2.6 (>= 2.6.27.19), the haproxy can achieve zero replication forwarding (zero-copy forwarding), and in Linux 3.5 and above the OS can also achieve zero replication boot ( zero-starting);5. Memory allocator enables imm
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.