Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I got big phpbb forum and 2 servers. Want to distribute http load from 1 webserver to 2 webservers. Did it already in the past but there was problem.

On both servers (1 and 2) was lighttpd. I used various load ballancers when user connect to server number 1 then balancer decided if he should be connected to lighttpd on server 1 or 2.

Everything was good, except load ballancing was round robin (random) and when user logged in on forum (some kind of session) and then in next page was redirected to second server he didn't have his session! So he must log in again but then who know where he will be next redirected.

Solution to this is to create sessions accessible from both servers. Then no matter from which ligghtpd user would access he would not have problems ( i think ). Where exactly is problem, i think its session files in tmp from lighttpd because session's from phpbb are in database which both servers can access. Another thing could be cookie from phpbb session writing there ip of server which was used to login and causing problems if ip previously wrriten in cookie was changed (second webserver).

Additional problem was, when user was redirected to webserver 2 he would gain ip adress of server which redirected him (not his own ip). It was like he got tunneled from server 1 --> server 2. Not redirected directly to server 2 as it should.

This both problems need help, what i need to do to let user use my website from 2 diffirent webservers (lighttpd in this example) without problems.

share|improve this question
add comment

3 Answers

One word: haproxy - it will give persistant connections based on an ip hash, and will fix all your problems, including the tunelling ip.

share|improve this answer
add comment

I've solved this in the past in one of two ways. Way #1 involved setting a cookie on the users machine with all the session information needed. Way #2 is to use a loadbalancer that will do persistent connections - meaning when a connection comes in from a user as long as they are actively using your site they will stay on whatever server the LB initially placed them on.

share|improve this answer
add comment

Or just set up an NFS server fot the shared session directory and then mount it on both webservers.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.