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 asked a similar question at the ec2ubuntu, but then realised it's more of a general server scalability/redundancy question.

Basically, I have a single Amazon EC2 instance running one of the Ubuntu AMIs. It's installed with a basic LAMP stack, acting as a db/webserver in one.

Now, I was wondering what's the best way of setting this up with some degree of redundancy, basically so that if the instance dies, we can spin up a new instance, mount the same EBS volume, and be on our merry way. There probably will be some minimal downtime as we wait for the new instance to spin up. Later down the track, we probably will want to make it more elastic, and have it scale upwards to cope with new loads.

I've had it suggested that I can use ELB (Elastic Load Balancing) and Autoscaling to set something like this up (this is just for the replacement instances), however, I'm not sure how it'll work with only a single server instance?

Also, are there any alternate solutions, that don't depend on ELB/Autoscaling, or is that my best option for this setup? (From what I gather, scalr and Rightscale are designed around pools - I only want a single, fairly low-key setup, and I'm willing to tolerate a few minutes of downtime while we wait for the replacement instance to spin up.)

Cheers, Victor

share|improve this question

4 Answers 4

up vote 0 down vote accepted

I would say you would need 2 more machines.

  1. The first being a load balancer that redirects the call to the best server (load balancers will handle that)

  2. The second being a second machine with the exact same specs than the current machine.

Of course, at any point you can simply plug in a new webserver and add it to the list of machines on the load balancer and now you'll have three machines setup and used depending on their loads. etc.

If you want to make sure all is good, you'd go for a third server that would be your database server and both webservers would write and read to this single database server. In the future you can easily add a replicated database infrastructure starting from that new database server.

Might be a bit over your head but that setup would in theory be good for later

share|improve this answer
    
heya, Thanks for the reply. I do get it, however, partly I was just trying to be cheap (since it's for personal sites, and mucking around), and get by with one machine...lol. I can use ELB for the load balancer, that doesn't add much at all. But as somebody above noted, I don't think that really takes care of monitoring, and restarting the box (I don't think Amazon's Autoscaling can work with only one box, although correct me if I'm wrong). Cheers, Victor –  victorhooi Nov 6 '09 at 12:03

A really inexpensive solution could be to use a cron job on a shared web hosting, like bluehost et al. You can make a script that runs every 5 minutes or so, and does something like:

  • is there an appropriate instance running at all? (using ec2-describe-instances for example)
  • is it running? eg do 'curl' to the hostname, and check it returns something sensible
  • if no to either of these questions, kill the old instance if necessary and launch a new one

Of course, both your shared web hosting goes down AND your instance could go down at the same time :-P

share|improve this answer

You will need an external entity to take care of that for you. I just don't know of a service that does that for single machine setups, since single machine kind of is the flaw in your equation to begin with. :)

I'm sure you know that you can automate EC2 setups, e.g. with a little bit of user-data, the right AMI (e.g. with chef-solo installed), etc. -- so that's the easy part.

In the end, the question is if you are better off on another provider. E.g. a slicehost instance could be good for you. Or two. One for app, one for DB. There's also less the "instance may disappear thing". Though I have to add, it really rarely happens. (But I've seen it too.)

share|improve this answer

The important thing is to have something that can detect when the instance dies and start it again. I don't think there's anything internal to EC2 that can do this, so you'll need to have some external thing to handle it. It wouldn't surprise me if someone's running a service somewhere that'll monitor your site and stop/start the EC2 instance if it has problems, but I don't know of anything off the top of my head.

share|improve this answer

Your Answer

 
discard

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

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