Haproxy+tomcat for load balancing and session sharing (Linux CENTOS7 environment)

Source: Internet
Author: User
Tags create directory haproxy

First, install the Haproxy

1. Go to the home directory and download the latest Haproxy installation package.

Cd/home

wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.24.tar.gz

2. Unzip:

TAR-ZXVF haproxy-1.4.24.tar.gz

Rename to Haproxy

MV Haproxy-1.4.24.tar.gz Haproxy

Create Directory/usr/local/haproxy

Mkdir/usr/local/haproxy

3. Installation

CD Haproxy

Make Target=linux26 Prefix=/usr/local/haproxy

Make install Prefix=/usr/local/haproxy

Cd/usr/local/haproxy

Mkdir/usr/local/haproxy/conf

cp/home/haproxy/examples/haproxy.cfg/home/haproxy/haproxy/conf/

4. Modify the configuration

Vi/usr/local/haproxy/conf/haproxy.cfg

:

Content:

# This config needs haproxy-1.1.28 or haproxy-1.2.1global    log 127.0.0.1    local0    log 127.0.0.1    local1 Notice    #log loghost    local0 info    maxconn 4096    chroot/usr/share/haproxy    uid    gid    Daemon    #debug    #quietdefaults    log    Global    mode    http    option    httplog    Option    dontlognull    retries    3    option Redispatch    maxconn    contimeout    clitimeout    50000    srvtimeout    50000    Listen Web    bind *:8666    mode http    Balance Roundrobin    stats uri/haproxy-stats    stats Refresh 10s    stats Realm haproxy\ Statistics    Stats auth admin:admin    option httpchk head/index.html    server web1 127.0.0.1:8080 weight 1 maxconn 10000 Check I  Nter 3s rise 3 Fall 3    Server web2 127.0.0.1:8081 weight 1 maxconn 10000 check Inter 3s rise 3 Fall 3        server Web3 127.0.0.1:8082 weight 1 maxconn 10000 check Inter 3s rise 3 Fall 3    

Second, the Tomcat service cluster and session sharing reference:

Nginx+tomcat for load balancing and session sharing (Linux CENTOS7 Environment) (2nd)

Three, 3 tomcat configuration completed and started, start haproxy

./usr/local/haproxy/sbin/haproxy-f/usr/local/haproxy/conf/haproxy.cfg

The Close Haproxy command is:

Killall Haproxy

Haproxy+tomcat for load balancing and session sharing (Linux CENTOS7 environment)

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.