installation directory/usr/local/haproxy creates the conf folder and then creates haproxy in the folder. use VI or gedit to open haproxy In the CFG configuration file. the configuration file content of the CFG configuration file defines global log 127.0.0.1 local0 maxconn 4096 chroot/usr/local/
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
haproxy.cfgAdd toDelete the following statement3. Create a self-launching scriptIV. Testing the Web cluster1. Test High Performance① the client uses the browser to open http://192.168.100.100/test.html for testing② again opens a new browser page to access http://192.168.100.120/test.html for testingV. Haproxy's Log segmentation1. Modify the options for the log configuration in the
/haproxy-1.4.22.tar.gz
Tar xvfz/tmp/ Haproxy-1.4.22.tar.gz-c/tmp/
cd/tmp/haproxy-1.4.22 make
target=linux26 make
Install
Haproxy need to perform a health check on each mysqlcluster server
1. Configure HAPROXY.CFG on 2 hosts separately
root@10.1.6.203:scripts# cat/etc/ha
2000 rise 2 fall 5 weight 6Stats refresh 5SStats uri/statusStats realm Haproxy \ statisticsStats auth admin: admin123Stats admin if TRUE
3. How to add a log record to haproxy① If CentOS6.0 or earlier is usedI. vi/etc/syslog. confLocal3. */var/log/haproxy. logIi. vi/etc/sysc
HAProxy is currently a popular cluster scheduling tool, similar cluster scheduling tool, compared with LVS, LVS performance is the best, but the building is relatively complex, Nginx upstream module support cluster function, but the cluster node health Check function is not strong, performance is not HAProxy good.System environment
Host
IP Address
main software
installation is complete, check that all files are generated.
[root@haproxy ~]# rpm -ql haproxy/etc/haproxy/etc/haproxy/haproxy.cfg/etc/logrotate.d/haproxy/etc/rc.d/init.d/haproxy/usr/bin/halog/usr/sbin/
With regard to haproxy log configuration, We separately describe that the default haproxy log is output to the system syslog, which is not very convenient to view. In order to better manage haproxy logs, we generally define them separately in the production environment. The
PASS auth_pass 11112222} track_script {Chk_haproxy} virtual_ipaddress { 192.168.1.200 native Virtual IP} notify_master "/etc/keepalived/notify.sh master" scripts run in a different state notify_backup "/etc/ keepalived/notify.sh backup "Notify_fault"/etc/keepalived/notify.sh Fault "}VRRp_instance vi_2 {Another master keepalived from state BACKUP interface eth0 virtual_router_id 99 is set to a different Primary keepalived Priority Low Advert_int 1 authentication {auth_type PASS auth_pass
: Backend configuration: Define back-end allocation rules and interact with backend servers;Listen: Binding configuration: Binds the specified client directly to the backend-specific server;There is usually no special need, there is no need to manually debug the configuration file inside the options, most of the default values to meet our needs, and the official documentation says many options are recommended to use the default.Configuration parameters and Meanings Global configuration * Pro
the Haproxy configuration fileIntroduction to 3.Haproxy Configuration itemsThe Haproxy profile is typically three parts, that is, the global configuration, default configuration, and listen (app component configuration).4. Create a self-launching script5. Site testing in Nginx (Apache) (two Web server operations are consistent)6. Verification by the client7.
nbproc, so that the task_queue of each process will be much shorter, and the performance will naturally improve a lot# Pidfile/var/run/haproxy-private.pid
defaults log global mode http optionhttplog optiondontlognull log 127.0.0.1 local3 retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000
Listen webfarm 0.0.0
/haproxy/statsUltsMode httpWorking Mode:Http performs In-depth analysis on the application layer data, so it supports layer-7 filtering, processing, conversion, and other mechanisms;Tcp haproxy establishes a full-duplex connection between the client and upstream server;The application layer protocol is not checked;This mode should be used for SSL, MySQL, and SSL;Log
can be used as the default gateway of the LAN client, greatly reducing the possibility that the default gateway becomes a single point of failure;
Load Sharing: allow traffic from LAN clients to be shared by multiple router devices;
Multiple VRRP groups: up to 255 VRRP groups can be configured on one vro physical interface;
Multi-IP Address: You can configure multiple IP addresses on the same physical interface based on the Interface alias to allow access to multiple subnets on the same physica
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.