HAProxy 基本翻译

Proxy configuration can be located in a set of sections :
 - defaults <name>
 - frontend <name>
 - backend  <name>
 - listen   <name>

A "defaults" section sets default parameters for all other sections following
its declaration. Those default parameters are reset by the next "defaults"
section. See below for the list of parameters which can be set in a "defaults"
section. The name is optional but its use is encouraged for better readability."defaults" 区块设置默认参数,对其定义后的所有区块有效。所有默认参数在优先级上,会被后面的“defaults”区块覆盖。"defaults"区块可设置参数清单见下文。“name”不是必须的,但为了有较好的可读性建议写上。

A "frontend" section describes a set of listening sockets accepting client
connections.“frontend”区块描述接受客户端连接的监听sockets集。

A "backend" section describes a set of servers to which the proxy will connect
to forward incoming connections.“backend”区块描述代理服务器集,代理将连接并转发入栈信息给这些服务器。

A "listen" section defines a complete proxy with its frontend and backend
parts combined in one section. It is generally useful for TCP-only traffic.“listen”区块定义了完整的代理,将“frontend”和“backend”结合在一个区块中。一般用在TCP-only流量中。

All proxy names must be formed from upper and lower case letters, digits,
‘-‘ (dash), ‘_‘ (underscore) , ‘.‘ (dot) and ‘:‘ (colon). ACL names are
case-sensitive, which means that "www" and "WWW" are two different proxies.所有的代理名称必须由大小写字符、数字、‘-‘、‘_‘、‘.‘和‘:‘构成。ACL名对大小写敏感,这意味着"www"和“WWW”代表不同的代理。

Historically, all proxy names could overlap, it just caused troubles in the
logs. Since the introduction of content switching, it is mandatory that two
proxies with overlapping capabilities (frontend/backend) have different names.
However, it is still permitted that a frontend and a backend share the same
name, as this configuration seems to be commonly encountered.

Right now, two major proxy modes are supported : "tcp", also known as layer 4,
and "http", also known as layer 7. In layer 4 mode, HAProxy simply forwards
bidirectional traffic between two sides. In layer 7 mode, HAProxy analyzes the
protocol, and can interact with it by allowing, blocking, switching, adding,
modifying, or removing arbitrary contents in requests or responses, based on
arbitrary criteria.
目前,HAProxy支持两种主要的模式:“tcp”(4层)和“http”(7层)。在4层模式,HAProxy只是简单的转发双向流量。在7层模式,HAProxy分析协议,并根据任意条件对请求和响应内容进行允许、阻断、交换和增删改。
In HTTP mode, the processing applied to requests and responses flowing over
a connection depends in the combination of the frontend‘s HTTP options and
the backend‘s. HAProxy supports 5 connection modes :在HTTP模式下,对请求和响应的处理由前端的HTTP option和后端配合决定。HAProxy支持五种连接模式。

  - KAL : keep alive ("option http-keep-alive") which is the default mode : all
    requests and responses are processed, and connections remain open but idle
    between responses and new requests.

  - TUN: tunnel ("option http-tunnel") : this was the default mode for versions
    1.0 to 1.5-dev21 : only the first request and response are processed, and
    everything else is forwarded with no analysis at all. This mode should not
    be used as it creates lots of trouble with logging and HTTP processing.

  - PCL: passive close ("option httpclose") : exactly the same as tunnel mode,
    but with "Connection: close" appended in both directions to try to make
    both ends close after the first request/response exchange.

  - SCL: server close ("option http-server-close") : the server-facing
    connection is closed after the end of the response is received, but the
    client-facing connection remains open.

  - FCL: forced close ("option forceclose") : the connection is actively closed
    after the end of the response.

The effective mode that will be applied to a connection passing through a
frontend and a backend can be determined by both proxy modes according to the
following matrix, but in short, the modes are symmetric, keep-alive is the
weakest option and force close is the strongest.

                          Backend mode

                | KAL | TUN | PCL | SCL | FCL
            ----+-----+-----+-----+-----+----
            KAL | KAL | TUN | PCL | SCL | FCL
            ----+-----+-----+-----+-----+----
            TUN | TUN | TUN | PCL | SCL | FCL
 Frontend   ----+-----+-----+-----+-----+----
   mode     PCL | PCL | PCL | PCL | FCL | FCL
            ----+-----+-----+-----+-----+----
            SCL | SCL | SCL | FCL | SCL | FCL
            ----+-----+-----+-----+-----+----
            FCL | FCL | FCL | FCL | FCL | FCL

最后附上一段配置文件example供参考
# 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
时间: 2024-08-26 23:52:28

HAProxy 基本翻译的相关文章

HAProxy的三种不同类型配置方案

haproxy是一款功能强大.灵活好用反向代理软件,提供了高可用.负载均衡.后端服务器代理的功能,它在7层负载均衡方面的功能很强大(支持cookie track, header rewrite等等),支持双机热备,支持虚拟主机,拥有非常不错的服务器健康检查功能,当其代理的后端服务器出现故障, HAProxy会自动将该服务器摘除,故障恢复后再自动将该服务器加入;同时还提供直观的监控页面,可以清晰实时的监控服务集群的运行状况. 在四层(tcp)实现负载均衡的软件: lvs------>重量级 ngi

Haproxy相关概念解析

一.Haproxy概述 haproxy是一款功能强大.灵活好用反向代理软件,提供了高可用.负载均衡.后端服务器代理的功能,它在7层负载均衡方面的功能很强大(支持cookie track, header rewrite等等),支持双机热备,支持虚拟主机,拥有非常不错的服务器健康检查功能,当其代理的后端服务器出现故障, HAProxy会自动将该服务器摘除,故障恢复后再自动将该服务器加入;同时还提供直观的监控页面,可以清晰实时的监控服务集群的运行状况. HAProxy提供高可用性.负载均衡以及基于TC

lVS/haproxy

haproxy 安装配置 1. 下载及安装 wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.21.tar.gz tar zxvf haproxy-1.4.21.tar.gz cd haproxy-1.4.21 make TARGET=linux26 PREFIX=/usr/local/haproxy make install PREFIX=/usr/local/haproxy 2.  配置 vi /usr/local/haproxy

在GlassFish应用服务器上创建并运行你的第一个Restful Web Service【翻译】

前言 本人一直开发Android应用,目前Android就业形势恶劣,甚至会一路下滑,因此决定学习服务器开发.采用的语言是java,IDE是Intellij,在下载Intellij的同时看到官网很多优秀的guide文章,于是按照guide成功完成了一个RESTful的demo.官方文档非常简洁,给我带来了很大的帮助,于是翻译之,希望对其他不愿意看原文的人有所帮助.由于水平有限,读者发现错误请指正,谢谢. 原文地址: https://www.jetbrains.com/help/idea/2016

HAProxy 高级应用(一)

HAProxy 高级应用 ================================================================================ 概述:   本章将继续上章的内容介绍haprosy代理配置段的相关参数,具体如下: ACL控制访问列表: 4层检测机制:dst,dst_port,src,src_port 7层检查机制:path.req.hdr.res.hdr: http层访问控制相关的参数: block,http-request TCP层的访

Java 7 Concurrency Cookbook 翻译 序言

在日常的Java代码开发过程中,很难免地有对多线程的需求,掌握java多线程和并发的机制也是Java程序员写出更健壮和高效代码的基础.笔者找寻国内已出版的关于Java多线程和并发的的中文书籍和翻译书籍,大家一致推荐的是<Java Concurrency in Practice>,笔者暂时还没有看英文原版,笔者看的是它的翻译版<Java并发编程实战>,笔者读起来感觉并不通畅,不知道是翻译的问题还是原版本来就写得不够流畅,同时感觉知识的深度也超过了入门的需求. 笔者在机缘巧合之下,发现

HAProxy+mongos搭建高可用负载均衡mongodb

在生产环境中,搭建的mongodb分片,提供了三个mongos接口.但mongodb中没有failover机制,官方建议是将mongos和应用服务器部署在一起,多个应用服务器就要部署多个mongos实例,这样很是不方便.查了一下,有几种方法可以使这三个mongos接口都利用起来,减少单个接口的压力.常用的有LVS和HAProxy.于是尝试用HAProxy做负载均衡. HAProxy是一款提供高可用性.负载均衡以及基于TCP和HTTP应用的代理软件,HAProxy是完全免费的.借助HAProxy可

[翻译] ORMLite document -- How to Use Part (二)

前言 此文档翻译于第一次学习 ORMLite 框架,如果发现当中有什么不对的地方,请指正.若翻译与原文档出现任何的不相符,请以原文档为准.原则上建议学习原英文文档. ---------------------------------------------------------------------------------------------- 二.如何使用 2.7 表的创建 ORMLite 提供了一些工具类为您存储在数据库中的类创建 table 和 schema. 2.7.1 Tabl

Reveal常用技巧(翻译来自Reveal官网blog)

翻译来自官网:http://revealapp.com/blog/reveal-common-tips-cn.html 以下基于Reveal 1.6. 用于快速上手的内置应用 刚刚下载Reveal,啥都还没配置呢,想先随便玩玩看,怎么办? 我们花了不少时间开发这个复杂程度类似与实际场景的Sample应用──Soundstagram(音频分享版的Instagram, ¯\_(ツ)_/¯),就是为了让大家能最快速地上手Reveal,尝试它的各种强大功能. 在 Help 菜单项中,点击 Inspect