- PostgreSQL 9 High Availability Cookbook
- Shaun M. Thomas
- 616字
- 2021-12-08 12:32:00
Protecting your eggs
Did we suggest that having several servers was serious? We lied. The place where our servers live, the data center, also has several redundancies in place. Extra network lines, separate power sources, multiple generators, air conditioning and ventilation, everything a server can require.
Yet, some have joked that a common backhoe is the natural enemy of the Internet. There is more truth to that statement than its apparent lack of gravitas might suggest. Data centers are geographically insecure. Inclement weather, natural disasters, disrupted backbones, power outages, and of course, accidentally damaged trunk lines (from an errant backhoe?), and simple human-error can all remove a data center from the grid. When a data center vanishes from the Internet, our servers become collateral damage.
However, we've done everything right! We have duplicates of everything, multiple parts, cables, even whole servers. What can we possibly do about the data center?
Well, it's complicated...
Getting ready
For this section, we will need a list of every database server in our proposed architecture, and the desired role for each.
How to do it...
This won't be a very long list. In any case, follow these steps:
- For every critical OLTP operating pair, allocate at least one standby.
- For every two online standby replicas, consider at least one standby.
- For every other database instance, allocate one standby.
How it works...
This type of scenario is known as Disaster Recovery. In order to truly diffuse a data center outage, we need backups of every major database server, and even minor servers. The reasoning is simple: we don't know how long we have to operate at reduced capacity. At that point, even non-critical reporting services still need analogs, otherwise business decisions that depend on activity analysis may not be possible.
We only really need half the amount of database servers, as most disaster recovery scenarios are severe enough for raised alertness, reduced refresh times, manually extended queue timeouts, and more. Not only is this less expensive than having a copy of every server as the primary data center, but it also encourages closer monitoring until it can be restored. Larger companies can opt for complete parity between data centers, but this is not a requirement.
As DBAs, our scenario often resembles this:

Notice that we didn't make any reservations for QA or development database servers. In the case of a disaster, the primary concern is ensuring the continued availability of the application platform. Further development or testing is likely on hold for the duration of the outage in any case.
There's more...
We cannot stress the importance of this section strongly enough. Some may consider an entire extra data center as optional due to the cost. It is not. Others may think a total of three servers for every primary system is too much maintenance overhead. Again, it is not. The price of a few servers must be weighed against the future of the company itself; it is the cost of admission into the world of high availability.
By the time we begin utilizing failover nodes, or any replicas in a separate data center, the damage has already been done. In the absence of these resources, a database crash can result in hours or even days of unavailability depending on the size of our database, exponentially compounding the effects of the original problem.
With this in mind, all critical production systems the author designs always have a minimum of four nodes: two mirrored production systems, and two mirrored disaster recovery analogs. This ensures even the disaster recovery system is online with one node while the other node is experiencing maintenance. Outages are unexpected, and we must always be prepared for them.
- C#編程入門指南(上下冊)
- Java FX應用開發教程
- 軟件測試項目實戰之性能測試篇
- 軟件測試工程師面試秘籍
- 深入淺出Android Jetpack
- PHP+MySQL+Dreamweaver動態網站開發實例教程
- Kali Linux Wireless Penetration Testing Beginner's Guide(Third Edition)
- Linux命令行與shell腳本編程大全(第4版)
- JavaScript入門經典
- Unity 5 for Android Essentials
- Unity 2017 Mobile Game Development
- FFmpeg開發實戰:從零基礎到短視頻上線
- 從0到1:HTML5 Canvas動畫開發
- Java并發編程:核心方法與框架
- Drupal Search Engine Optimization