关于HAProxy的listen与等价的backend

来源:互联网 发布:国产手机推荐 知乎 编辑:程序博客网 时间:2024/04/29 07:57


Skip to end of metadata
Go to start of metadata
2. Configuring HAProxy----------------------2.1. Configuration file format------------------------------HAProxy's configuration process involves 3 major sources of parameters :  - the arguments from the command-line, which always take precedence  - the "global" section, which sets process-wide parameters  - the proxies sections which can take form of "defaults", "listen",    "frontend" and "backend".The configuration file syntax consists in lines beginning with a keywordreferenced in this manual, optionally followed by one or several parametersdelimited by spaces. If spaces have to be entered in strings, then they must bepreceded by a backslash ('\') to be escaped. Backslashes also have to beescaped by doubling them.2.2. Time format----------------Some parameters involve values representing time, such as timeouts. Thesevalues are generally expressed in milliseconds (unless explicitly statedotherwise) but may be expressed in any other unit by suffixing the unit to thenumeric value. It is important to consider this because it will not be repeatedfor every keyword. Supported units are :  - us : microseconds. 1 microsecond = 1/1000000 second  - ms : milliseconds. 1 millisecond = 1/1000 second. This is the default.  - s  : seconds. 1s = 1000ms  - m  : minutes. 1m = 60s = 60000ms  - h  : hours.   1h = 60m = 3600s = 3600000ms  - d  : days.    1d = 24h = 1440m = 86400s = 86400000ms2.3. Examples-------------    # Simple configuration for an HTTP proxy listening on port 80 on all    # interfaces and forwarding requests to a single backend "servers" with a    # single server "server1" listening on 127.0.0.1:8000    global        daemon        maxconn 256    defaults        mode http        timeout connect 5000ms        timeout client 50000ms        timeout server 50000ms    frontend http-in        bind *:80        default_backend servers    backend servers        server server1 127.0.0.1:8000 maxconn 32    # The same configuration defined with a single listen block. Shorter but    # less expressive, especially in HTTP mode.    global        daemon        maxconn 256    defaults        mode http        timeout connect 5000ms        timeout client 50000ms        timeout server 50000ms    listen http-in        bind *:80        server server1 127.0.0.1:8000 maxconn 32
0 0
原创粉丝点击