1

I have an app already deployed on Ubuntu EC2 machine. I am using Apache2 web server, phusion passenger and MySQL. Now I want to add one more server, but I don't know how to set up servers on EC2. Any help will be appreciated.Thank you.

Daniel t.
  • 9,061
  • 1
  • 32
  • 36
Katie
  • 13
  • 3

1 Answers1

0

There's several 'right' ways to do this. The lowest barrier of entry would be to create an ami image of the first ec2 machine. Use that custom ami to create a second server with a different host name. From there, you can:

a) (easiest, cheapest) add the second web server to your DNS, serving your pages 'round robin.' Basically, when a new client asks for your website name, your DNS provider alternates between the two server IPs, effectively sending half of your traffic to one server, and the other half to the other.

http://www.rrdns.com/round-robin-dns-setup-a-howto.html

b) (a little more expense, a little more difficult to set up) use Amazons Elastic Load Balancer. Amazon documents this solution well:

http://aws.amazon.com/elasticloadbalancing/

c) (a good bit more expense, a lot more difficult depending on skillset, most flexibility and control) stand up a load balancing instance (or ideally two, using HA proxy.) This method is also well documented, but requires a fairly high degree of experience.

http://backreference.org/2012/04/25/load-balancing-and-ha-for-multiple-applications-with-apache-haproxy-and-keepalived/

Stephan
  • 999
  • 7
  • 11
  • Thank you stephan, can i go with option (a) and use HA proxy as a load balancer? – Katie Feb 14 '13 at 21:58
  • Not really, because with a DNS entry there is no single point of entry so the client's randomly pick the server on which they will send a request. But you can use a similar strategy as in example a to use two HA proxy for redundancy. – golja Feb 14 '13 at 22:04
  • I meant after adding another apache instance , to use these steps http://www.leaseweblabs.com/2011/07/high-availability-load-balancing-using-haproxy-on-ubuntu-part-1/#more-46 is it possible? – Katie Feb 14 '13 at 22:16
  • Briefly, 'round robin dns' (option A) means your DNS provider has the A record for your website, with two IPs instead of just one. Every time a client requests the IP for your website, your provider gives one of those two out, at random. If you had two load balancers with HA proxy on each, you can round robin their IPs, and have them share a virtual IP. This is, in fact, what StackOverflow uses: http://serverfault.com/questions/281230/how-to-setup-haproxy-with-failover – Stephan Feb 14 '13 at 22:26
  • Oh i see..Thank you so much. What do you think of the link i posted , is it a good aproach? – Katie Feb 14 '13 at 22:35
  • I don't know enough about your needs and skillset, honestly. Do you have enough traffic that you feel you actually need two servers? Even if you do, an HA Proxy solution now means four servers and a fairly steep learning curve. Your link seems fine, so please take this kindly: that you need to ask the question suggests you're trying to solve a problem you don't actually have. – Stephan Feb 15 '13 at 00:11
  • @Stephan : will the user's session not break if solution a is implemented. What i mean is, if the user has an active logged in session with webserver 1 and then because of dns round robin the same user "might" land up on webserver2. Will this not break his logged in state? –  Feb 15 '13 at 15:52