OpenGauss database master and backup shared storage function
Tags: opengauss
Published: 2023-03-29 03:58:23

Primary and secondary shared storage
Feature introduction
The feature of active-standby shared storage mainly provides the ability for the active and standby machines to share a storage, provides a new HA deployment form of active-standby shared storage, solves the problem of doubling the storage capacity of a single machine under traditional HA deployment, and satisfies the need to reduce storage capacity and cost demands. Optionally, OCK RDMA can be used to improve the real-time consistent reading capability of the standby machine.

Architecture introduction
The overall architecture diagram of the active and standby shared storage is shown below.

Figure 1  Architecture diagram of active and standby shared storage

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wm9q590xej7kizbn4z1d.png)




The disk array device and the ultrapath multipath software have been installed, and the disk array device is available.

Distributed Storage Service DSS (Distributed Storage Service)

DSS is an independent process that directly manages disk array raw devices and provides external capabilities similar to distributed file systems. Through the shared memory and the client API dynamic library, the database provides the ability to create files, delete files, expand and shrink files, and read and write files.

Distributed Memory Service DMS (Distributed Memory Service)

DMS is a dynamic library, which is integrated in the database, transmits the page content through the TCP/RDMA network, integrates the primary and backup memory, and provides memory pooling capabilities, so as to realize the real-time consistent reading function of the standby machine.

The active/standby page exchange is accelerated by RDMA, depends on the CX5 network card, and depends on the OCK RDMA dynamic library.

Features
The master and backup share one data, which significantly reduces the storage capacity of traditional HA.
The log replication function is removed between the master and backup, and the master and backup page exchange function is added. The backup supports real-time consistent reading.
By default, real-time page exchange is performed between the master and backup through the TCP network. In order to reduce the delay of page exchange, the OCK RDMA dynamic library method of introducing calculation is provided to improve the real-time consistency performance of the standby machine.
Applicable scenarios and restrictions
The storage device is required to be a disk array, and the LUN of the disk array needs to support the SCSI3 PR protocol (including PR OUT ("PERSISTENT RESERVE OUT") PR IN ("PERSISTENT RESERVE IN") and INQUIRY), which is used to implement cluster IO FENCE; in addition In addition, it is also necessary to support the CAW protocol (COMPARE AND WRITE) of SCSI3, which is used to realize the shared disk lock. Such as Dorado 5000 V3 disk array equipment.
Eight backup machines can be deployed under openGauss.
Since the active and standby shared storage relies on functions similar to the distributed file system to realize the real-time consistent read capability of the standby machine, it is required that the file metadata should be changed as little as possible. Based on performance considerations, this feature only supports segment page tables.
Only active and standby deployments are supported on the same disk array device, disaster recovery deployment is not supported, and active and standby mixed deployments are not supported (for example, active and standby are deployed on different disk array devices).
The active/standby page exchange is accelerated by RDMA, relies on the CX5 network card, and relies on the OCK RDMA dynamic library provided by Compute.
Currently does not support backup machine reconstruction, node replacement, node repair and other capabilities.
Upgrades from traditional HA deployments to deployments based on active and standby shared storage are not supported.