日本軟銀 50 億美元入股瑞士製藥巨頭羅氏,成大股東
阿新 • • 發佈:2021-08-04
日誌
配置rsyslog
檢測配置檔案
檢測編譯選項
haproxy -vv
Configuration
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
# log是發給server的, 而不是本地的facility
log 127.0.0.1 local2
log /dev/log local1 notice
chroot /var/lib/haproxy # <jail dir>
pidfile /var/run/haproxy.pid
maxconn 40000
user haproxy
group haproxy
daemon # 守護程序
# turn on stats unix socket
stats socket /var/lib/haproxy/stats
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
option httplog # mode 為http時, 記錄詳細日誌
option dontlognull
option http -server-close
option forwardfor except 127.0.0.0/8 # 在發往backend的請求首部插入 X-Forwarded-For 首部
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 30000
#---------------------------------------------------------------------
# statistics
#---------------------------------------------------------------------
listen statistics
bind *:9000
stats enable
#stats hide-version
#stats scope .
stats uri /admin
stats realm Haproxy\ Statistics
stats auth admin:admin
stats admin if TRUE # web管理
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend frontend-main *:80
#use_backend static if url_static
#default_backend app
default_backend server
#errorfile 503 /etc/haproxy/errorpages/503.html # 自定義 503 code
errorloc 504 http://baidu.com
#---------------------------------------------------------------------
# apiserver frontend which proxys to the control plane nodes
#---------------------------------------------------------------------
frontend frontend-apiserver
mode tcp
bind *:16443
option tcplog
default_backend apiserver
#---------------------------------------------------------------------
# round robin balancing for apiserver
#---------------------------------------------------------------------
backend backend-apiserver
mode tcp
option httpchk GET /healthz
http-check expect status 200
option ssl-hello-chk # https
option tcplog
option tcp-check
balance roundrobin
#server ${HOST1_ID} ${HOST1_ADDRESS}:${APISERVER_SRC_PORT} check
server gale1 192.168.8.11:6443 check
server gale2 192.168.8.12:6443 check
server gale3 192.168.8.13:6443 check
#---------------------------------------------------------------------
# backend server
#---------------------------------------------------------------------
backend backend-server
balance roundrobin
cookie ServerID insert
server gale2 192.168.8.12:80 check weight 10 cookie gale2
server gale3 192.168.8.13:80 check weight 20 cookie gale3
#---------------------------------------------------------------------
# frontend demo
#---------------------------------------------------------------------
# bind
frontend main *:80
frontend main
bind *:80 # bind 用於frontend, listen
bind *:8080
bind *:900-910
# balance
balance roundrobin, static-rr, leastconn, source, uri,
# server
server first 172.16.1.7:8080 cookie first check inter 1s port 80
server second 172.16.1.7:8080 cookie second check inter 1s port 80