Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the advantages and disadvantages of database high availability architecture

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article focuses on "what are the advantages and disadvantages of database high availability architecture". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the advantages and disadvantages of the database highly available architecture?"

Active and standby architecture

1. The basic architecture topology diagram is as follows

The overall architecture is simple, almost all databases provide the function of active and standby replication, such as Mysql, Oracle, MongoDB and so on. In this architecture, the standby database mainly plays the role of data backup and does not participate in the actual business read and write operation. If the standby machine is changed to the host computer, manual operation is required.

two。 Analysis of advantages and disadvantages

For the client, there is no need to perceive the existence of the standby. Even after the disaster recovery, the original standby is manually intervened and modified to the host, and the client only needs to simply modify the connection address, and the application architecture does not need to make any changes.

The host and standby only need to copy the data, and there is no need for complex operations such as status judgment and active / standby switching.

The shortcomings of this architecture are also obvious:

The standby machine is mainly used for data backup, which will result in cost waste if the application architecture is not designed for read-write separation.

Manual intervention is needed after the fault, which can not be recovered automatically, and the manual processing efficiency is relatively low, and the recovery process is also prone to errors.

Master-slave architecture

There is only an one-word difference between the master-slave architecture and the master-slave architecture, but there is a big gap for the actual application architecture. The slave database does not participate in the business operation in the master / slave architecture, while the slave database needs to participate in the business operation in the master / slave architecture. The application architecture needs to separate the read and write operations into the master database, while the read operation is read from the slave library.

1. The master-slave basic architecture topology diagram is as follows

two。 Analysis of advantages and disadvantages

Compared with the active and standby architecture, it has the following advantages:

In the event of a failure of the main library, the read operation related business can continue to run

The external reading ability is provided from the library, giving full play to the performance of the hardware.

Different slave libraries can be provided for different roles

Disadvantages:

The slave library in the master-slave architecture needs to provide read service. If the master-slave replication delay is large, the data will be inconsistent.

The application architecture needs to be modified, and the separation of read and write is generally added, which is more complex than the master and standby.

Manual intervention is needed after the fault, which can not be recovered automatically, and the manual processing efficiency is relatively low, and the recovery process is also prone to errors.

Master-slave switching

There are two common problems with both architectures:

Unable to write after main library failure

After there is a problem in the main database, manual intervention is needed to switch from the library to the main database, and manual switching may cause problems such as untimely or switching failure.

Based on the above two problems, we need an architecture that can switch automatically, when the master database fails, it can automatically switch from the slave library to the master database without the intervention of operation and maintenance personnel.

In order to realize the master-slave switching architecture, we must consider a key point: there must be a mechanism that can monitor the running state of the database node to decide whether to switch or not.

In this architecture, we usually introduce a third-party intermediary, in which the database node regularly reports its status information to the third-party intermediary, or the third-party intermediary regularly goes to the database node to pull the database status.

Advantages:

It solves the problem of manual intervention, greatly reduces the failure time, and protects the life safety shortcomings of operation and maintenance personnel to a certain extent:

The architecture is complex, and it is necessary to ensure the high availability of third-party intermediaries after the introduction of third-party intermediaries.

It is recommended that you learn about the MHA architecture of mysql, or use ZK or Keepalived to build the master-slave switching architecture.

Main main architecture

The master master architecture is also called master master replication. The two databases are both main libraries and copy the data to each other. The client can select any database for read and write operations.

Compared with master-slave switching, master-master architecture has the following advantages:

Both databases are main libraries, and there is no concept of switching.

The client does not need to distinguish between hosts of different roles and sends read and write operations to any database at will.

The architecture is simple

But allowing writes to two primary databases is a dangerous thing:

AB two databases use self-growing primary key, id is 1 after library An is inserted into user, id is also 1 after library B is inserted into user, and data conflict

Tb update tb set col = col + 1 update tb set col = col * 2 so far, I believe you have a deeper understanding of "what are the advantages and disadvantages of database highly available architecture?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report