php - How a website should handle a database crash -
i creating website in php has database backend (can either mysql or sql server) , realized if database crashes @ time, website not run , cause headaches.
so proper thing display on website if database (or crucial outside component) goes down? particular website relies heavily on database , useless without it.
one option have been told email website admin , display error 500 page says wrong server , make website unusable till issue fixed. there else work around problem? there ways design website database (any crucial component) crashing isn't issue?
i looking general rules of thumb specific examples of how people have worked around in past. also, these examples don't have website example.
if have 1 database server, , website cannot work without it's database, there no magic : you'll have display sort of nice error page, informing users there technical problem , website come shortly.
generally speaking :
- chances of such problem pretty low
- if website normal one, people tend accept problem once in while, if communicate it.
if can afford (and have technical knowledge set up), use 2 database servers, replication (mysql supports this) between them : 1 master, use, , slave, that's considered backup.
then, if master falls, application use slave.
of course, reduce risks of database-related problem (having 2 servers crash @ same time quite unlikely), you'll still have problems other components -- webserver : if have one, might want consider using two, second 1 fallback.
after that, if still have money (and think need better uptime website), you'll want think case when datacenter has problem -- setting server in 2 separate locations...
Comments
Post a Comment