问题原文
原帖链接 · TheCat · CC BY-SA 3.0
I'm wondering how you're supposed to manage a failure from your web hosting provider (server breakdown, ddos attack, server maintenance...) For instance, is it possible to host your website on multiple servers? I'm currently using shared hosting with OVH, but it has already been down multiple times, and since I'm quite dependant on my website, I'd like to know what the good practices are to avoid a "single point a failure".
已采纳解答
原帖链接 · Stephen Ostermiller · CC BY-SA 3.0
Load balancers
Most large sites run on a set of servers behind a load balancer. This allows some of the servers to go down (or be taken down for maintenance) without taking the whole site down.
The load balancer is still a single point of failure, but load balancers generally have 99.99% uptime. They are single purpose machines tested against very high loads.
Failover DNS
Failover DNS monitors your primary server (or cluster behind a load balancer). When it detects a failure it points DNS to a separate backup site running in a different location.
Content delivery networks
CDNs act as distributed caching proxy servers for your website. They handle requests to your website via "edge nodes" located around the world. Each node will have to request the resource from your "origin" server on the first request and again periodically to pick up changes. CDNs help buffer against some types of DDOS attacks as well as reduce load on your origin server.
Monitoring
Whatever solutions you have in place, you need to get alerts when your website does go down. This will allow you to jump in and fix issues.
Staging servers
Releasing new versions of your website can occasionally be problematic. It helps to maintain a staging environment where new versions can run for a while before a live release. You would typically want to do both manual and automated tests against your staging environment.
Database synchronization
Sites that use a database will typically want to have a live database and a second backup database ready to go at each hosting location. This is usually accomplished by synchronizing databases by serializing all database transactions and replaying them to each database.
Sharding
Sharding is a technique of having different data live on different servers based on a hash of data key. In a robust sharding environment, data typically gets written to at least two locations for redundancy. Unlike database synchronization, not all servers have to have a copy of all of the data which allows sharding to more easily handle large data sets (terrabytes) that don't fit well in traditional relational databases.
Cloud hosting
Cloud hosting providers such as Amazon AWS typically offer all of these services. AWS even has Elastic Beanstalk technology that will add and remove servers automatically based on server load.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
