官方你好,我看了官网的haproxy代理ssl的例子,我发现1883端口是有会话粘贴的,8883是没有的,这个是为什么?
「会话粘性」是在 HaProxy 里设置的,和 EMQX 应该没什么关系
https://github.com/emqx/emqx/blob/master/.ci/docker-compose-file/haproxy/haproxy.cfg
这是官方的例子,为什么1883端口配置了 stick on req.payload(0,0),mqtt_field_value(connect,client_identifier)
而8883的没有?
tls配置
frontend emqx_ssl
mode tcp
option tcplog
bind *:8883 ssl crt /var/lib/haproxy/emqx.pem ca-file /usr/local/etc/haproxy/certs/cacert.pem verify required no-sslv3
default_backend emqx_ssl_back
backend emqx_ssl_back
mode tcp
balance static-rr
server emqx-1 node1.emqx.io:1883 check-send-proxy send-proxy-v2-ssl-cn
server emqx-2 node2.emqx.io:1883 check-send-proxy send-proxy-v2-ssl-cn
非tls配置
frontend emqx_tcp
mode tcp
option tcplog
bind *:1883
# Reject connections that have an invalid MQTT packet
# tcp-request content reject unless { req.payload(0,0), mqtt_is_valid }
default_backend emqx_tcp_back
backend emqx_tcp_back
mode tcp
# Create a stick table for session persistence
stick-table type string len 32 size 100k expire 30m
# Use ClientID / client_identifier as persistence key
stick on req.payload(0,0),mqtt_field_value(connect,client_identifier)
server emqx-1 node1.emqx.io:1883 check-send-proxy send-proxy-v2
server emqx-2 node2.emqx.io:1883 check-send-proxy send-proxy-v2
这不是官方例子,这是我们自动化测试时的配制,里面的字段设置并没有特殊的深意