ini HAPROXY ip stick

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini HAPROXY ip stick相关的知识,希望对你有一定的参考价值。

###stick table ###
stick-table type ip size 1m expire 1h
stick on src


######lb algorith####
balance source
hash-type consistent

ini 示例haproxy配置

##based on Mesosphere Marathon's servicerouter.py haproxy config

global
  daemon
  log 127.0.0.1 local0
  log 127.0.0.1 local1 notice
  maxconn 4096
  tune.ssl.default-dh-param 2048

defaults
  log               global
  retries           3
  maxconn           2000
  timeout connect   5s
  timeout client    50s
  timeout server    50s

listen stats
  bind 127.0.0.1:9090
  balance
  mode http
  stats enable
  stats auth admin:admin

frontend microservice_http_in
  bind *:80
  mode http

frontend microservice_http_appid_in
  bind *:81
  mode http
  acl app__accountCreationService hdr(x-microservice-app-id) -i /accountCreationService
  acl app__profileEditingService hdr(x-microservice-app-id) -i /profileEditingService
  use_backend accountCreationService_10000 if app__accountCreationService
  use_backend profileEditingService_20000 if app__profileEditingService

frontend microservice_https_in
  bind *:443 ssl crt /etc/ssl/yourCertificate
  mode http

frontend accountCreationService_10000
  bind *:10000
  mode http
  use_backend accountCreationService_10000

frontend profileEditingService_20000
  bind *:20000
  mode http
  use_backend profileEditingService_20000

backend profileEditingService_20000
  balance roundrobin
  mode http
  option forwardfor
  http-request set-header X-Forwarded-Port %[dst_port]
  http-request add-header X-Forwarded-Proto https if { ssl_fc }
  server 151_256_250_152_35900 151.256.250.152:35900
  # additional servers here

backend accountCreationService_10000
  balance roundrobin
  mode http
  option forwardfor
  http-request set-header X-Forwarded-Port %[dst_port]
  http-request add-header X-Forwarded-Proto https if { ssl_fc }
  server 101_206_200_192_31900 101.206.200.192:31900
  # additional servers here

以上是关于ini HAPROXY ip stick的主要内容,如果未能解决你的问题,请参考以下文章

ini 在Elasticsearch面前的HAProxy

ini HAproxy Snippets

ini haproxy.cfg

ini 使用HAproxy进行速率限制

ini Stack Exchange HAProxy

ini HAProxy的-bitbucket.cfg