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 am a student in IT and I have been asked to build a web server cluster for multiple websites. After 2 weeks of searching, reading and testing, I came here to ask for help.

What we want is a cluster of web servers working together in load balancing and fail over.

What I have as running test setup now:

2 piranha servers in fail over and load balancing over 3 web servers each (nginx/php5).

The problems I encountered:

  • Sessions are not synced. I have tried combining memcache, memcached & repcached, I failed to make php save it's sessions inside memcache
  • No ideas about syncing data over 3 (or even more) web servers. I have setup DRBD it works for 2 servers but never found out how to for 4 servers.

What I have tried before:

Tried:

  • 2 nginx servers with a round-robin upstream to each 3 web servers load balancing

Problems:

  • The 2 main servers get a high load on high activity

  • Sessions are not synced, every server-switch needs a new log in

  • If one of the 3 servers do not answer it will stop switching to the next server


Tried:

  • DRBD as data sync between the web servers

Problems:

  • Can't get DRBD working on 4 servers

To explain what my real questions are, we want to build a high available and fast web cluster. The web cluster should have all data synchronized realtime. I have no idea how to accomplish this! On this web cluster will run lots of websites, this means it should all be automatic and the users (websites) will not know this is on more than one server but will think it is one really big powerfull server.

How does google or facebook do this?

I do have thought about having a separate server on which the customer can edit the web server live, the real server will not be edited until they push their website to the web cluster. This could be done by rsync, but this doesn't seem to be a good solution.. the sessions could be on a shared storage, I think?

Any idea's or solutions are welcome!

share|improve this question

closed as off topic by EEAA, Tom O'Connor, mdpc, Khaled, Dave M Mar 3 '13 at 18:44

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

It takes years of learning, practice and experience to know how to set up something like this. And there are many, MANY solutions.

A few hints:

Forget about DRBD. If you want to keep the filesystems synchronized in real time then use a replicating filesystem such as HDFS or AFS.

The 2 main servers get a high load on high activity

WTF? You've hosed 2 nginx servers acting as proxies to 3 nginx servers???? You're doing something very wrong at a very basic level or haven't really explained your set up properly.

If you need shared sessions, then this should be top of your list to work on.

This could be done by rsync, but this doesn't seem to be a good solution

If (apart from session storage, if you choose to go down that root - but I'd say stick with a replicating database) your only requirement for sharing data between the servers is for publishing sites then actually it's a very good solution. It has minimal dependencies, it can recover from long outages, it's very robust. Indeed, it doesn't take a lot of effort to set it up so that you don't even need an explicitly nominated server to apply the edits on.

share|improve this answer
    
Thank you for your answer! I will take a look at the 2 file systems you gave me. What I meant with the nginx servers: i meant one of them, there are 2 of them, but only one is working. The other is just a failover. With rsync the other servers are not immediatly synced with the other web servers so they will (when the load balancer switches server) not see their edited content unless you give them straight access to that server. Wouldn't it be needed to setup a "editor server" where you can give a sync command when you are done? It even gives an extra service ^^! –  Marco Mar 3 '13 at 0:58

Instead of syncronize filesystems you can use NFS to export the volume used to store all websites roots and mount it on all webservers, so every website will easily has the same contents.

Concerning sessions management through the cluster, I suggest a different approach, make a single user session to stay on the same webserver, in other words sticky sessions.

I got this problem with IBM Tivoli Access Manager used as reverse proxy, this product has some junction options to handle session persistence. If you're using LVS you can find the solution here

share|improve this answer
    
NFS server? Single point of failure. Stick sessions? Multiple single points of failure. –  symcbean Mar 4 '13 at 9:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.