A
A
AusTiN2011-01-21 13:58:23
MySQL
AusTiN, 2011-01-21 13:58:23

How to make a failover web server?

Initial data: There is a site, there are two servers. One of them contains nginx, MySQL and site content (audio, photo).
Task: If one of the servers goes down, the site should still be available.
Question: How to do it and what is needed for this? How can I make the client access the site and be redirected to server B if server A is unavailable and vice versa?
Thanks in advance for your replies.
PS: OS on both servers is Debian 5.

Answer the question

In order to leave comments, you need to log in

10 answer(s)
P
Puma Thailand, 2011-01-21
@opium

Put in front of the nginx servers a proxy for backends.

N
NanoDragon, 2011-01-22
@NanoDragon

Host on Amazon and redirect from Amazon to any of your live servers.

S
Sergey Savostin, 2011-01-21
@savostin

something like this

S
Sergey Savostin, 2011-01-21
@savostin

The third "most reliable" server with nginx and such settings.

E
equand, 2011-01-21
@equand

As a variant of anycast.

A
AnViar, 2011-01-21
@AnViar

What You Need www.linux-ha.org/wiki/Main_Page

N
nicolnx, 2011-01-21
@nicolnx

servers nearby or in different data centers?

V
Vladimir Zhurkin, 2011-01-21
@icCE

you need:
Shared storage (FC/iSCSI) with a clustered FS - for example ocfs2.
There you store html / database and other stuff you need.
Two machines are combined Heartbeat, in your cases behind the eyes.
The storage can also be made a backup somewhere else using drbd+ocfs2 :)
In this variation, you will have one server idle.
If you need one-time work, then in Apache the balancing module or through nginx.
DB replication.

S
sevmax, 2011-01-22
@sevmax

To increase availability, it is necessary to divide the servers into roles and duplicate them. Database server, storage server and a couple of front-end servers with nginx. Then we can talk about some kind of fault tolerance.

N
nicolnx, 2011-01-22
@nicolnx

If DCs are different, then you can only taxi through DNS records, there are no other options. Moreover, if you just write 2 records, if one DC falls, half of the requests will go nowhere. You can set the records to have a shorter lifetime, then draw a script on each DC that checks the neighbor for survivability, and if he does not receive a clear response from him, he tries to update the DNS zone. Only what kind of fuses should be provided for from split-brain ... Thus, if one site falls, half of the clients have worked and will continue to work; the second half will experience temporary difficulties. Still better than nothing, I guess.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question