My Standard Server Setup

Configurations with Rackspace Cloud Servers

Posted 2 years ago by Tom Maiaroto.

I figured I would share my typical web application server setup while I've recently been on the subject of hosting. This is my mission-critical, scalable, redundant, (did I miss anything?) setup.

You'll need 5 servers, along with a cloud load balancer, to pull it off with Rackspace. You can use smaller servers to cut down on costs as you see fit, but I typically start with 2GB for a production project.

  • (2x) Web/application servers (I use Nginx if in need of a web server)
  • (2x) Database servers (I use MongoDB) master/slave
  • (1x) Monitoring server (also where I put the MongoDB arbiter)

This provides for redundancy if one should go down the other will kick in. Both in terms of web/application server and database. I use Munin to monitor the health of everything from the monitoring server which can be a small 512MB cloud server. It is also where I place the arbiter. This monitoring server gets no load so I never feel the need to add more than just one.

Last, but not least, the cloud load balancer. You can add the two web servers to it and you're done.

There's obviously a lot of configuration going on within these servers. You will want to ensure the firewall is open between them where necessary (so web/app servers can access the database for example across the private network) as well as to the world for your application needs. You will also want to ensure you edit the /etc/hosts file to put a friendy hostname in for each server.

Then you want to create an image for a web/app server and a database server. This will allow you to quickly launch more to scale as needed. The /etc/hosts file will need to be adjusted on each new server and the old servers to accommodate the new. This is typically useful for MongoDB. Though it is optional if you prefer to use IPs. Though you, likely, will still need to quickly make some firewall adjustments.

You can then also resize your existing servers as needed. Again, I typically start with a 2GB cloud server size and go up from there. Larger if there is a lot of traffic expected. Remember, you can resize at will if your application is designed properly because Rackspace's cloud load balancer will not send traffic to the server if it can't. You can also, of course, adjust the load balancer while making upgrades to be safe. Keep in mind resizes can take a little while. It is often faster just to bring on a new server and when you do so you can build it at a larger size than your image backup.

You will likely need a few moments of downtime or, really, a "freeze" period when upgrade the size of your MongoDB servers. You can upgrade one of your secondaries first and then let that replicate again after restarting to catch up with the primary. Then elect it to be the new primary (hence why you need to freeze things for a short while) and then upgrade the old primary's server size and bring it back online (no need to promote it back to primary unless you want to for some OCD reason). So with very little downtime you can scale your setup.

This is my typical go to setup and even in a recent situation where I needed a major upgrade in hardware due to an unexpected spike of traffic, there was no downtime. There was certainly short while of slowness and requests being turned away...But this was all minimized by the preparedness of this setup and the tools that Rackspace cloud servers provides. This is a battle tested setup and I can't express enough that Rackspace cloud hosting is a life saver.

Filed under
comments powered by Disqus

Search for Posts

Popular Labels

social media virality score general internet web development reviews and opinions php web tools hosting lithium web design

Recent Posts