ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

haproxy基本了解

haproxy基本了解

haproxy基本了解

haproxy是一个高性能的、开源的TCP/http负载均衡器和反向代理,用于分发网络流量到多个后端服务器。

工作原理

主要组件:
frontend前端组件
backend后端组件
listen: 同时前端和后端功能
可选负载均衡算法:
roundrobin:轮询
leastcorn: 最少连接数
source: 基于源ip哈希
static-rr: 静态权重查询

基础配置

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

# /etc/haproxy/haproxy.cfgglobaldaemonmaxconn 256defaultsmode httptimeout connect 5000mstimeout client 50000mstimeout server 50000msfrontend http_frontbind *:6443default_backend http_backbackend http_backbalance roundrobinserver server1 192.168.1.10:6443 checkserver server2 192.168.1.11:6443 check
返回列表