zoukankan      html  css  js  c++  java
  • haproxy frontend 和backend

    <pre name="code" class="sql">frontend
    接收请求的前端虚拟节点,Frontend可以根据规则直接指定具体使用后端的 backend(可动态选择)。
     
    backend
    后端服务集群的配置,是真实的服务器,一个Backend对应一个或者多个实体服务器。
    
    
    
    
    forntend:用于定义一系列监听的套接字,这些套接字可以接受客户端请求并与子建立连接
    
    frontend        www
    
            bind            *:80
            bind            *:443                   ssl                     crt                     /etc/haproxy/cert.pem
            redirect scheme https if !{ ssl_fc }
    
    
    frontend  http
    
            bind            *:80
            bind            *:443                   ssl                     crt                     /etc/haproxy/cert.pem
    frontend http_80_in   这个名字自己定义
    
    
    
    
    
    backend webserver_8001
            mode            http
            balance         roundrobin
            server          webhost01_8001          1.22.05.17:8001     check inter 2000 fall 3
            server          webhost02_8001          10.18.2.1:8001       check inter 2000 fall 3
    ===================================360buy haproxy 配置例子=========================
    
    frontend http_80
            bind 0.0.0.0:80
            log             global
            acl index       url_end / index.html index.htm index.asp index.aspx index.php index.jsp
            use_backend     index_rr if index
            acl img         url_end .gif .jpg  .jpeg
            use_backend     img_hash if img
            acl statis      url_reg  .(css|js|swf|png|css?.*|js?.*)$
            use_backend     www_any if statis
            default_backend www_any
    
    
    backend index_rr
            balance         roundrobin
            log             global
            cookie          SERVERID
            option          httpchk GET /robots.txt HTTP/1.1
    Host:www.360buy.com
            server          www-80-21     192.168.71.21:80    check inter 3000 rise 1 fall 1 maxconn 65535
    backend img_hash
            balance         uri len 15
            log             global
            cookie          SERVERID
            option          httpchk GET /robots.txt HTTP/1.1
    Host:www.360buy.com
            server          img-80-51     192.168.71.51:80    check inter 3000 rise 1 fall 1 maxconn 65535
    backend www_any
            balance         uri len 15
            log             global
            cookie          SERVERID
            option          httpchk GET /robots.txt HTTP/1.1
    Host:www.360buy.com
            server          www-80-21     192.168.71.21:80    check inter 3000 rise 1 fall 1 maxconn 65535
    [北京]Jimin(497907352)  10:34:24
    对访问比较大的index页面作轮询,其它的页面对url做hash,分到一台服务器上,以提高命中率
    
    url len 15 以URI的前15位做hash
    


    
                                        
    
  • 相关阅读:
    进程相关知识点
    vue上传
    Storageclass 外挂NFS配置与应用
    centos强制关机后,网卡无法启动
    前端工程化2-webpack使用与学习
    android应用获取应用签名
    js获取tif格式图片的dpi
    查询生成二级树型结构最高效的方式
    03解决隔离的方案
    02SingleSpa实战
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351548.html
Copyright © 2011-2022 走看看