Thanks very much. 1) Sorry, my error was "stick store-request set-cookie(myCookie)" - it should have been "cookie" (not "set-cookie"). Now it works, sorry to have bothered you.
2) I don't need a cluster of HAProxies, just one HAProxy with stickiness. So it's okay to work without "peers", isn't it? 3) Could you kindly also clarify something about "store response". Because I think in my case I should omit it, but I wanted to be sure. Our stickiness isn't based "session id" but on department name: all "HR" users get "myCookie=HR" , all "R&D" users get "myCookie=RND", and that's the sticky cookie. All users from the same department - are served by same backend machine. Of course users must login to figure out who they are & which department they're from. So they log into any random machine, which returns the a cookie - say "myCookie=HR", and from now on this user's requests should go to the machine that serves HR. He has no attachment to the machine that gave him this initial cookie (during login), he want to move on to the machine that serves HR. So am I correct to use only "store request" without "store response"? Thanks again ________________________________ From: Baptiste <bed...@gmail.com> To: sol myr <solmy...@yahoo.com> Sent: Sunday, April 7, 2013 5:16 PM Subject: Re: Stickiness lost after failover Hi, You're missing a peers section in your HAProxy configuration and on your stick-table description. Baptiste On Sun, Apr 7, 2013 at 3:34 PM, sol myr <solmy...@yahoo.com> wrote: > > Thanks, unfortunately even with the new "stick table" I'm losing stickiness > after failover. > Could you please tell if it's a know issue? It's a very simple scenario, so > I was sure other users reported it before me (regardless of whether you > chose to fix it - that's entirely up to you of course - I'm just wondering > if I'm doing some silly error which nobody else made ). > > With stick table it looks like this: > backend tom > balance roundrobin > server tom1 t1.mycompany:80 check > server tom2 t2.mycompany:80 check > server tom3 t3.mycompany:80 check > # appsession myCookie len 32 timeout 3h request-learn > > stick-table type string size 32k > stick match cookie(myCookie) > stick store-response set-cookie(myCookie) > stick store-request set-cookie(myCookie) > > All I do is: > - set "myCookie" to some fixed value, send several requests to haproxy, and > see that indeed they stick to a single machine (say tom1) > - take down that machine to which they stuck (tom1 above) > - send more requests with the same fixed cookie as before. Now it doesn't > stick, just does round-robin between tom2 and tom3 > > Is it a known issue? > Thanks again > ________________________________ > From: Baptiste <bed...@gmail.com> > To: sol myr <solmy...@yahoo.com> > Cc: "haproxy@formilux.org" <haproxy@formilux.org> > Sent: Wednesday, April 3, 2013 12:36 PM > > Subject: Re: Stickiness lost after failover > > Hi, > > Better using stick tables with store-response and store-request to replace > your appsession configuration. > that way, you can reload your haproxy without loosing persistence > information. > It also allows you to have a cluster of HAProxy sharing the same persistence > information. > > Baptiste > > > On Wed, Apr 3, 2013 at 11:08 AM, sol myr <solmy...@yahoo.com> wrote: > > Hi, > > We set up HAProxy with stickiness ("appsession"), and usually it works > great. > But unfortunately, after failover it seems to stop "sticking" and just do > round robin. > We got the problem on both 1.4 and 1.5. > > The details - it's a backend of 3 Tomcat servers, with stickiness based on > "myCookie". > backend tom > balance leastconn > server tom1 t1.mycompany.com:80 check > server tom2 t2.mycompany.com:80 check > server tom3 t3.mycompany.com:80 check > appsession myCookie len 32 timeout 3h request-learn > > Initially it works: I send several requests with the same cookie > "myCookie=1" and see they all go to the same Tomcat - say "tom1". > But if I crash tom1, and send more requests with the same "myCookie=1", > they starts round robin between tom2 and tom3... I expected them all to > stick to one of those servers. > > Am I missing something silly? > With Google I only fished one old vague reference: > http://www.mail-archive.com/haproxy@formilux.org/msg02632.html > It mentioned "I know about the drawbacks of appsession, i.e. in memory hash > lost on relad or failover" - but the reply implied a fix on 1.5...? > > Thanks very much > > > >