Hello, I'm facing the following problem:
I use stickiness table on a peers cluster. If I reload the configuration without changing any backend server, everything works fine. Reload command: /usr/local/sbin/haproxy -f /usr/local/etc/haproxy.cfg -p /var/run/haproxy.pid -D -sf $(cat /var/run/haproxy.pid) The problem happens if I add or remove backend servers to the config file. The stickiness table will maintain the index to the original servers' order so the "reloaded" table will point to wrong servers. ********************************************* Example config running: backend farm option httpchk GET /health HTTP/1.0 option forwardfor balance roundrobin stick store-response hdr(X-Session) stick-table type string len 24 size 200k peers cluster stick on url_param(X-Session) server vm--i-43279674 172.18.80.60 check port 80 inter 30s fastinter 5s rise 2 fall 3 server vm--i-76afe142 172.18.81.100 check port 80 inter 30s fastinter 5s rise 2 fall 3 server vm--i-b40a3a80 172.18.81.165 check port 80 inter 30s fastinter 5s rise 2 fall 3 root@haproxy--i-46279671:~# echo "show stat ; show table farm" | socat unix-connect:/var/run/haproxy.sock stdio # pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp, cluster,FRONTEND,,,16,24,2000,163,43646,62502,0,0,41,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,11,,,,0,106,0,41,0,0,,0,9,163,,,0,0,0,0, farm,vm--i-43279674,0,0,5,6,,41,15703,15498,,0,,0,0,0,0,UP,1,1,0,0,0,551,0,,1,3,1,,20,,2,0,,3,L7OK,200,2,5,36,0,0,0,0,0,,,,0,0,,,,, farm,vm--i-76afe142,0,0,6,8,,41,16123,15192,,0,,0,0,0,0,UP,1,1,0,0,0,551,0,,1,3,2,,19,,2,0,,3,L7OK,200,3,6,35,0,0,0,0,0,,,,0,0,,,,, farm,vm--i-b40a3a80,0,0,5,7,,31,10164,11985,,0,,0,0,0,0,UP,1,1,0,0,0,551,0,,1,3,3,,19,,2,0,,4,L7OK,200,4,5,26,0,0,0,0,0,,,,0,0,,,,, farm,BACKEND,0,0,16,21,200,113,41990,42675,0,0,,0,0,0,0,UP,3,3,0,,0,551,0,,1,3,0,,58,,1,0,,8,,,,0,97,0,0,0,0,,,,,0,0,0,0,0,0, admin,FRONTEND,,,0,0,2000,0,0,0,0,0,0,,,,,OPEN,,,,,,,,,1,4,0,,,,0,0,0,0,,,,0,0,0,0,0,0,,0,0,0,,,0,0,0,0, admin,BACKEND,0,0,0,0,200,0,0,0,0,0,,0,0,0,0,UP,0,0,0,,0,551,0,,1,4,0,,0,,1,0,,0,,,,0,0,0,0,0,0,,,,,0,0,0,0,0,0, # table: farm, type: string, size:204800, used:3 0x1ed99a4: key=30f1495e88a701ef50b403de use=0 exp=0 server_id=3 0x1ead934: key=66db4cecb6de98fdb8944927 use=0 exp=0 server_id=2 0x1ead874: key=d7b4416c86d81f54b905e0b9 use=0 exp=0 server_id=1 ********************************************* Now I add more servers: backend farm option httpchk GET /health HTTP/1.0 option forwardfor balance roundrobin stick store-response hdr(X-Session) stick-table type string len 24 size 200k peers cluster stick on url_param(X-Session) server vm--i-37a49303 172.18.80.106 check port 80 inter 30s fastinter 5s rise 2 fall 3 server vm--i-43279674 172.18.80.60 check port 80 inter 30s fastinter 5s rise 2 fall 3 server vm--i-76afe142 172.18.81.100 check port 80 inter 30s fastinter 5s rise 2 fall 3 server vm--i-b2f3a386 172.18.80.103 check port 80 inter 30s fastinter 5s rise 2 fall 3 server vm--i-b40a3a80 172.18.81.165 check port 80 inter 30s fastinter 5s rise 2 fall 3 server vm--i-bcc96e8b 172.18.81.29 check port 80 inter 30s fastinter 5s rise 2 fall 3 server vm--i-cfa3b8fb 172.18.81.80 check port 80 inter 30s fastinter 5s rise 2 fall 3 root@haproxy--i-46279671:~# echo "show stat ; show table farm" | socat unix-connect:/var/run/haproxy.sock stdio # pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp, cluster,FRONTEND,,,0,1,2000,174,12689,84866,0,0,77,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,2,,,,0,97,0,77,0,0,,0,2,174,,,0,0,0,0, farm,vm--i-37a49303,0,0,0,1,,11,1287,4807,,0,,0,0,0,0,UP,1,1,0,0,0,1159,0,,1,3,1,,11,,2,0,,1,L7OK,200,2,0,11,0,0,0,0,0,,,,0,0,,,,, farm,vm--i-43279674,0,0,0,1,,11,1287,4818,,0,,0,0,0,0,UP,1,1,0,0,0,1159,0,,1,3,2,,11,,2,0,,1,L7OK,200,2,0,11,0,0,0,0,0,,,,0,0,,,,, farm,vm--i-76afe142,0,0,0,1,,11,1287,4818,,0,,0,0,0,0,UP,1,1,0,0,0,1159,0,,1,3,3,,11,,2,0,,1,L7OK,200,3,0,11,0,0,0,0,0,,,,0,0,,,,, farm,vm--i-b2f3a386,0,0,0,1,,11,1287,4807,,0,,0,0,0,0,UP,1,1,0,0,0,1159,0,,1,3,4,,11,,2,0,,1,L7OK,200,2,0,11,0,0,0,0,0,,,,0,0,,,,, farm,vm--i-b40a3a80,0,0,0,1,,11,1287,4807,,0,,0,0,0,0,UP,1,1,0,0,0,1159,0,,1,3,5,,11,,2,0,,1,L7OK,200,3,0,11,0,0,0,0,0,,,,0,0,,,,, farm,vm--i-bcc96e8b,0,0,0,1,,11,1287,4807,,0,,0,0,0,0,UP,1,1,0,0,0,1159,0,,1,3,6,,11,,2,0,,1,L7OK,200,3,0,11,0,0,0,0,0,,,,0,0,,,,, farm,vm--i-cfa3b8fb,0,0,0,1,,11,1287,4807,,0,,0,0,0,0,UP,1,1,0,0,0,1159,0,,1,3,7,,11,,2,0,,1,L7OK,200,3,0,11,0,0,0,0,0,,,,0,0,,,,, farm,BACKEND,0,0,0,1,200,77,9009,33671,0,0,,0,0,0,0,UP,7,7,0,,0,1159,0,,1,3,0,,77,,1,0,,1,,,,0,77,0,0,0,0,,,,,0,0,0,0,0,0, admin,FRONTEND,,,0,0,2000,0,0,0,0,0,0,,,,,OPEN,,,,,,,,,1,4,0,,,,0,0,0,0,,,,0,0,0,0,0,0,,0,0,0,,,0,0,0,0, admin,BACKEND,0,0,0,0,200,0,0,0,0,0,,0,0,0,0,UP,0,0,0,,0,1159,0,,1,4,0,,0,,1,0,,0,,,,0,0,0,0,0,0,,,,,0,0,0,0,0,0, # table: farm, type: string, size:204800, used:3 0x1288934: key=30f1495e88a701ef50b403de use=0 exp=0 server_id=3 0x1288874: key=66db4cecb6de98fdb8944927 use=0 exp=0 server_id=2 0x12889f4: key=d7b4416c86d81f54b905e0b9 use=0 exp=0 server_id=1 As you can see on the table, the server_ids are still pointing to the 3rd, 2nd and 1st server entries respectively but the backend farm has servers in a different order now... Thanks Jose

