zoukankan      html  css  js  c++  java
  • HAProxy安装及初步使用

    1.yum安装
    wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    rpm -ivh epel-release-6-8.noarch.rpm
    yum install -y haproxy


    2.配置文件
    vi /etc/haproxy/haproxy.cfg

    3.配置查看状态网址
    defaults
        mode                    http
        log                     global
        option                  httplog
        option                  dontlognull
        option http-server-close
        option forwardfor       except 127.0.0.0/8
        option                  redispatch
        retries                 3
        timeout http-request    10s
        timeout queue           1m
        timeout connect         10s
        timeout client          1m
        timeout server          1m
        timeout http-keep-alive 10s
        timeout check           10s
        maxconn                 3000
        #查看状态网址
        stats   uri             /haproxy-stats


    4.配置监听端口:
    #前端监听端口,及后端代理配置
    frontend  main *:80
        acl url_static       path_beg       -i /static /images /javascript /stylesheets
        acl url_static       path_end       -i .jpg .gif .png .css .js

        use_backend static          if url_static
        default_backend             app

    5.后端配置
    #静态文件配置
    backend static
        #轮询
        balance     roundrobin
        server      static 127.0.0.1:4331 check

    #默认配置
    backend app
        #健康状态检测
        option httpchk HEAD /index.html HTTP/1.0   
        balance     roundrobin
        server  app1 192.168.1.102:80 check
        server  app2 192.168.1.105:80 check


    Haproxy 配置项配置实例
    http://www.cnblogs.com/dkblog/archive/2012/03/13/2393321.html

  • 相关阅读:
    81. Search in Rotated Sorted Array II (Array; Divide-and-Conquer)
    LeetCode Word Ladder
    LeetCode Word Search II
    LeetCode Invert Binary Tree
    LeetCode Implement Stack using Queues
    Bash:字符串操作
    LeetCode Basic Calculator
    LeetCode Rectangle Area
    Java 远程调试
    LeetCode Count Complete Tree Nodes
  • 原文地址:https://www.cnblogs.com/itfenqing/p/4429429.html
Copyright © 2011-2022 走看看