redgeoff commented on issue #9: Understanding how to run a cluster
URL: https://github.com/apache/couchdb-docker/issues/9#issuecomment-301319482
 
 
   Update as there are 2 threads :). From 
https://github.com/klaemo/docker-couchdb/issues/93#issuecomment-301318230:
   
   @peanutpi you rock! I managed to make [these 
changes](https://github.com/redgeoff/couchdb-docker/commit/4fed77b63e0f3e6444ee52ed7966f965dce9ed37)
 and now the requests are routed to the correct server via haproxy!
   
   Here's what I ended up. It's pretty much identical to the config at 
http://www.haproxy.com/blog/load-balancing-affinity-persistence-sticky-sessions-what-you-need-to-know.
 The cookie name needs to be something other than `AuthSession` as 
`AuthSession` is reserved for the cookie used by CouchDB. Instead we need a 
second cookie, e.g. `SERVERID`, that stores the server id/name so that haproxy 
knows how to route subsequent requests.
   
   ```
   backend couchdbs
           option httpchk GET /_up
           http-check disable-on-404
           cookie SERVERID insert indirect nocache
           server couchdb1 couchdb1:5984 check inter 5s cookie couchdb1
           server couchdb2 couchdb2:5984 check inter 5s cookie couchdb2
           server couchdb3 couchdb3:5984 check inter 5s cookie couchdb3
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to