{"id":6321,"date":"2020-03-18T15:09:38","date_gmt":"2020-03-18T08:09:38","guid":{"rendered":"http:\/\/gcloudvn.wam.vn\/kien-truc-du-phong-tham-hoa-co-so-du-lieu-da-vung-cho-mysql\/"},"modified":"2023-04-24T16:41:46","modified_gmt":"2023-04-24T09:41:46","slug":"kien-truc-du-phong-tham-hoa-co-so-du-lieu-da-vung-cho-mysql","status":"publish","type":"post","link":"https:\/\/gcloudvn.com\/en\/kienthuc\/kien-truc-du-phong-tham-hoa-co-so-du-lieu-da-vung-cho-mysql\/","title":{"rendered":"Multi-Region Database Disaster Redundancy Architecture for MySQL"},"content":{"rendered":"<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">Enterprises expect high reliability of the data storage infrastructure their applications are using. Although you and your team prepare the best technical scenarios, carefully, there is still a risk of database failure, whether the server or network partition fails or not. Good planning can help you respond to problems and recover faster when disaster strikes.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">This blog shows a database architecture implementation approach that ensures high resiliency and disaster recovery for MySQL on <a href=\"https:\/\/gcloudvn.com\/en\/compute-engine\/\">Compute Engine<\/a>, using sector disks as well as load balancers.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">Any database architecture should have approaches in place for error recovery and rapid recovery from failure without data loss. These methods are demonstrated in the RTO (recovery time objective) and RPO (recovery point objective), which provide ways to set up and then measure how long the service may be unavailable and save the data to be saved. how far.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">When a database fails, they should be recovered as quickly as possible with as small an RTO as possible, ideally within seconds. It takes as little data as possible, not even at all. The desired RPO is the final consistent database state.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">From a database architecture and implementation design, this can be done with two distinct concepts: high availability and disaster recovery. Use both at the same time to achieve an architecture that prepares for the greatest range of failures or failures.<\/span><\/p>\n<h3 style=\"text-align: justify;\"><strong>Create a flexible database architecture<\/strong><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">A high availability database architecture has database servers in at least two or more regions. If a server on one region fails or the zone becomes inaccessible, data in other regions is also available for further processing. The figure below shows two cases, one in the zn1 region and the other in the zn2 region. The front-end load balancer assists in directing traffic to a &#039;healthiest&#039; database available for read and write queries.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">A disaster recovery architecture adds a second highest availability database setup in the second area. If one of the zones becomes inaccessible or fails, the other is immediately put into use. The figure below shows two areas, the main area and the DR (disaster recovery) area. Data is copied from the primary to the DR zone so that the DR zone can take over from the latest consistent database state. The load balancer in front of the zones directs traffic to the zone responsible for read and write traffic. Here&#039;s how this architecture looks like:<\/span><\/p>\n<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-15613 size-full\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2020\/03\/news-8.png\" alt=\"Multi-Region Database Disaster Redundancy Architecture for MySQL 1\" width=\"512\" height=\"445\" \/><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">In addition to setting up the database servers, it is also necessary to implement a regional drive that is written to two zones simultaneously, to ensure safety in case of failure in any region. there. This is a huge advantage of Google Cloud, allowing you to bypass MySQL-level replication in a region. Each disk write operation is performed synchronously in two regions. When the primary server fails, a backup server is attached to the disk(s) in the region, and the database service (MySQL) is then similarly started. This gives the peace of mind of not worrying about replication latency or database state for high availability.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">From a disaster recovery process perspective, the following things happen over time when something goes wrong:<\/span><\/p>\n<ul style=\"text-align: justify;\">\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Normal steady state database operation<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">An error occurs and a sector becomes inoperable or the database is inaccessible<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">It must be decided whether the system is &#039;dead&#039; (in the case where it is expected that the region will be back up soon or the server is back up).<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">DNS is updated manually, so it redirects application traffic to the second zone<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Resume operation in the main area after the server is back to normal (optional), as the second zone has also been deployed, fully built<\/span><\/li>\n<\/ul>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">From a high-availability process standpoint, the following can happen over time in many situations:<\/span><\/p>\n<ul style=\"text-align: justify;\">\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Normal steady state database operation<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Database server not working<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Start the backup server<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Mount regional SSD and enable database<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Automatically redirect application traffic to standby through load balancers<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">After the server crashes or becomes unavailable again, is there a backup system?<\/span><\/li>\n<\/ul>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">A highly available database architecture will aid in disaster recovery. With sector disks and load balancers, it&#039;s simple to deploy flexible databases.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">See more about <\/span><a href=\"https:\/\/cloud.google.com\/load-balancing\" target=\"_blank\" rel=\"nofollow noopener\"><span style=\"font-weight: 400;\">load balancers<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/cloud.google.com\/compute\/docs\/disks\/#repds\" target=\"_blank\" rel=\"nofollow noopener\"><span style=\"font-weight: 400;\">regional disks<\/span><\/a><span style=\"font-weight: 400;\">, HA and DR procedures, detailed steps in <\/span><a href=\"https:\/\/cloud.google.com\/solutions\/disaster-recovery-for-microsoft-sql-server\" target=\"_blank\" rel=\"nofollow noopener\"><span style=\"font-weight: 400;\">the beginning of this document<\/span><\/a><span style=\"font-weight: 400;\">. Try to familiarize yourself with the architecture as well as the failover process.<\/span><\/p>\n<p style=\"text-align: right;\"><strong>Source: Gimasys<\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>Enterprises expect high reliability of the data storage infrastructure their applications are using. Although you and your team prepare technical scripts\u2026<\/p>","protected":false},"author":1,"featured_media":6322,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6321","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kienthuc","entry","has-media"],"_links":{"self":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts\/6321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/comments?post=6321"}],"version-history":[{"count":0,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts\/6321\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/media\/6322"}],"wp:attachment":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/media?parent=6321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/categories?post=6321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/tags?post=6321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}