Hello,
I have Haproxy 1.5 in production with peers which synchronize properly.
I have been testing version 1.6, but can't get peers to synchronize.
As a template for my lab I used example from the official documentation
(https://cbonte.github.io/haproxy-dconv/configuration-1.6.html#3.5-peer).
- Haproxy version: 1.6.4-3ppa1~trusty
- Iptables are turned off and nmap shows all used ports opened.
- Servers in lab:
haproxy1: 10.0.3.188
haproxy2: 10.0.3.186
worker1: 10.0.3.187:80
worker2: 10.0.3.187:81
- Haproxy configuration on both haproxy nodes:
global
daemon
group haproxy
log 127.0.0.1 local2 debug
maxconn 5000
stats socket /var/run/haproxy.sock mode 666 level user
stats socket /var/run/haproxy_admin.sock mode 600 level admin
user haproxy
defaults
log global
option dontlognull
retries 4
balance roundrobin
timeout connect 5s
timeout client 5s
timeout server 5s
peers mypeers
peer haproxy1 10.0.3.188:1024
peer haproxy2 10.0.3.186:1024
frontend www
bind 0.0.0.0:80
mode tcp
default_backend mybackend
backend mybackend
mode tcp
balance roundrobin
stick-table type ip size 20k peers mypeers
stick on src
server worker1 10.0.3.187:80 check
server worker2 10.0.3.187:81 check
- Workers return their names:
$ curl http://10.0.3.187:80
worker1
$ curl http://10.0.3.187:81
worker2
- Test workflow:
After start stick-table on both nodes is empty as expected:
root@haproxy1:~# echo show table mybackend |socat
unix-connect:/var/run/haproxy_admin.sock stdio
# table: mybackend, type: ip, size:20480, used:0
root@haproxy2:~# echo show table mybackend |socat
unix-connect:/var/run/haproxy_admin.sock stdio
# table: mybackend, type: ip, size:20480, used:0
- Curling haproxy1 creates record in the stick-table on the haproxy1,
but this record has never been replicated to the haproxy2
$ curl http://10.0.3.188
worker1
root@haproxy1:~# echo show table mybackend |socat
unix-connect:/var/run/haproxy_admin.sock stdio
# table: mybackend, type: ip, size:20480, used:1
0x55e6bbe08fb4: key=10.0.0.215 use=0 exp=0 server_id=1
root@haproxy2:~# echo show table mybackend |socat
unix-connect:/var/run/haproxy_admin.sock stdio
# table: mybackend, type: ip, size:20480, used:0
I've tested this configuration with 1.5 and synchronization works like a
charm.
Thanks,
Marko