Cluster cross-region dual-active read-write method and device, computer device, and storage medium
By optimizing the IO process in the Ceph architecture and directly selecting the target storage process OSD for write operations, the problem of network resource consumption caused by latency between cross-regional sites is solved, and the storage performance of the active-active solution is improved.
Patent Information
- Application Number
- CN202311699085.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-12
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2043-12-12
AI Technical Summary
In Ceph's active-active architecture, there is significant latency between sites across different regions, leading to increased network resource consumption and impacting performance.
By determining the Availability Zone (AZ) location and Placement Group (PG) when a file write request is received, the target storage process OSD is directly selected for the write operation, avoiding cross-AZ data forwarding. Static hash functions and CRUSH algorithms are used to optimize the IO process, achieving local priority writing.
It improves the performance of Ceph architecture in dual-active solutions, reduces the latency loss of finding the master OSD, and improves data processing efficiency.
Smart Images

Figure CN117827762B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of distributed storage technology, and in particular to a cluster cross-region dual-active read / write method, apparatus, computer equipment, and storage medium. Background Technology
[0002] Active-active solutions require providing services to the front-end simultaneously across two geographically dispersed sites. This necessitates storing multiple copies of the same data across multiple sites, allowing simultaneous read and write access from multiple sites. Ceph's architecture supports cross-regional deployment of cluster nodes and uses multi-replica technology to ensure data replicas at each site. Even if one site fails, other sites can continue read and write operations. The Ceph engine is fundamentally a distributed software architecture, so its ultimate goal is to evenly distribute data and I / O access across all nodes. In its implementation, Group Controllers (PGs) use the CRASH algorithm to achieve even distribution across all cluster nodes. Therefore, during front-end object writes, the primary OSD in each PG is also evenly distributed across all storage nodes. This achieves balanced access across all storage nodes and OSDs globally. The current Ceph engine's I / O processing flow is based on the PG model. The OSD members of a PG are distinguished as primary and secondary OSDs. All data writes are handled by the primary OSD of the PG, with the primary node distributing the data to other secondary OSDs. Strong data consistency is achieved by having all OSDs complete the write process before a write completion notification is returned. However, in active-active scenarios, there is a certain distance between geographically separated sites, and the latency between them can typically exceed 1.5ms. When a Ceph cluster uses cross-site deployment to meet the active-active requirements of upper-layer applications, the storage nodes in the cluster are connected across geographical networks. Therefore, during standard Ceph engine IO processing, a large amount of data traffic occurs between the two sites due to the search for the PG master OSD, resulting in network resource consumption and impacting performance. Therefore, how to reduce the data forwarding and interaction processes between sites after multi-replica deployment in an active-active solution, thereby improving the performance of the Ceph architecture in active-active scenarios, has become an urgent problem to be solved. Summary of the Invention
[0003] This application provides a cluster cross-region dual-active read / write method, apparatus, computer equipment, and storage medium to improve the performance of Ceph architecture in dual-active schemes.
[0004] Firstly, this application provides a cluster cross-region dual-active read / write method, the method comprising:
[0005] Upon receiving a file write request from a client, the location of the Availability Zone (AZ) that received the file write request is obtained based on the file write request;
[0006] Based on the file to be written in the file write request, obtain the placement group identifier pgid;
[0007] Based on the AZ location and the placement group (PG) corresponding to the pgid, the target storage process (OSD) for performing the write operation on the file to be written is determined.
[0008] Based on the write I / O and the target OSD, the write operation of the file to be written is performed to obtain the write result, and based on the read I / O, the read is performed to obtain the read result.
[0009] Further, obtaining the placement group identifier (pgid) based on the file to be written in the file write request includes:
[0010] The file to be written is sliced to obtain slice objects, and the object identifier (OID) of the slice objects is calculated.
[0011] Using the OID as an input parameter, the placement group identifier pgid is obtained based on a static hash function and a mask.
[0012] Further, determining the target storage process (OSD) for performing the file write operation based on the AZ location and the placement group (PG) corresponding to the pgid includes:
[0013] Determine whether the PG group already contains data;
[0014] When data already exists in the PG group, obtain the location of the main OSD in the PG group;
[0015] When the position of the main OSD is different from the position of the AZ, the pgid is used as the input parameter of the crush algorithm to calculate and obtain at least one member OSD of the PG group;
[0016] In at least one member OSD, identify the member OSD that has the same location as the AZ as the OSD to be determined;
[0017] When the OSD to be determined is the primary OSD of the PG group, the OSD to be determined is determined as the target OSD.
[0018] Furthermore, after determining whether the PG group already contains data, the process further includes:
[0019] When the PG group does not contain data, the local OSD is set as the target OSD.
[0020] Furthermore, after determining the member OSD with the same location as the AZ in at least one member OSD as the OSD to be determined, the method further includes:
[0021] When the OSD to be determined is not the master OSD of the PG group, the read-write lock program is invoked to send a write permission request to the master OSD of the PG group;
[0022] Receive the request result returned by the master OSD of the PG group based on the current lock state and the write permission request;
[0023] When the request result is successful, the OSD to be determined is taken as the target OSD, and the reserved information field is updated.
[0024] Furthermore, the reserved information field includes the OSD number and the current lock state.
[0025] Furthermore, after obtaining the location of the primary OSD in the PG group when data already exists in the PG group, the process further includes:
[0026] When the position of the primary OSD is the same as the position of the AZ, the primary OSD is used as the target OSD.
[0027] Secondly, this application also provides a cluster cross-region dual-active read / write device, the device comprising:
[0028] The availability zone location acquisition module is used to obtain the location of the availability zone (AZ) that receives the file write request based on the file write request when a file write request is received from a client.
[0029] The placement group identifier acquisition module is used to obtain the placement group identifier pgid based on the file to be written in the file write request;
[0030] The target OSD determination module is used to determine the target storage process OSD for performing the write operation of the file to be written, based on the AZ location and the placement group (PG) corresponding to the pgid;
[0031] The write execution module is used to perform a write operation on the file to be written based on write I / O and the target OSD, obtain the write result, and perform a read operation based on read I / O to obtain the read result.
[0032] Thirdly, this application also provides a computer device, the computer device including a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and, when executing the computer program, implement the cluster cross-region dual-active read / write method as described above.
[0033] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, enables the processor to implement the cluster cross-region dual-active read / write method as described above.
[0034] This application discloses a cluster cross-region dual-active read / write method, apparatus, computer device, and storage medium. Upon receiving a file write request from a client, the method obtains the Availability Zone (AZ) location receiving the file write request; obtains the Placement Group Identifier (pgid) based on the file to be written in the file write request; determines the target Storage Process (OSD) for performing the file write operation based on the AZ location and the Placement Group (PG) corresponding to the pgid; performs the file write operation based on write I / O and the target OSD to obtain the write result; and performs a read operation based on read I / O to obtain the read result. This application enables the determination of the target OSD based on the AZ location and the execution of the write operation through the target OSD, eliminating the need to forward the write operation to the AZ where the primary OSD resides, significantly improving processing efficiency and the performance of the Ceph architecture in a dual-active solution. Attached Figure Description
[0035] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 This is a schematic flowchart of a first embodiment of a cluster cross-region dual-active read / write method provided by an embodiment of this application;
[0037] Figure 2 This is a flowchart illustrating an implementation of a cluster cross-region dual-active read / write method provided in an embodiment of this application;
[0038] Figure 3 This is a schematic flowchart of a second embodiment of a cluster cross-region dual-active read / write method provided in the embodiments of this application;
[0039] Figure 4 This is a schematic diagram of client-side local writing in a cluster cross-region dual-active read / write method provided in an embodiment of this application;
[0040] Figure 5 A schematic block diagram of a clustered cross-regional dual-active read / write device provided for embodiments of this application;
[0041] Figure 6A schematic block diagram of the structure of a computer device provided for an embodiment of this application. Detailed Implementation
[0042] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0043] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0044] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0045] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0046] Embodiments of this application provide a cluster cross-region dual-active read / write method, apparatus, computer device, and storage medium. The cluster cross-region dual-active read / write method can be applied to servers to improve the performance of Ceph architecture in dual-active solutions. The server can be a standalone server or a server cluster.
[0047] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0048] Please see Figure 1 , Figure 1 This is a schematic flowchart illustrating a cluster cross-region dual-active read / write method provided in an embodiment of this application. This cluster cross-region dual-active read / write method can be applied to servers to improve the performance of Ceph architecture in dual-active solutions.
[0049] like Figure 1 As shown, the cross-region dual-active read / write method of the cluster specifically includes steps S101 to S104.
[0050] S101. Upon receiving a file write request from a client, obtain the location of the availability zone (AZ) that received the file write request based on the file write request;
[0051] S102. Based on the file to be written in the file write request, obtain the placement group identifier pgid;
[0052] Further, obtaining the placement group identifier pgid based on the file to be written in the file write request includes: performing slicing processing on the file to be written to obtain slice objects, calculating the object identifier OID of the slice objects; and using the OID as an input parameter, calculating the placement group identifier pgid based on a static hash function and a mask.
[0053] S103. Based on the AZ location and the placement group PG group corresponding to the pgid, determine the target storage process OSD to perform the write operation of the file to be written;
[0054] S104. Based on the write IO and the target OSD, perform the write operation on the file to be written, obtain the write result, and based on the read IO, perform the read operation to obtain the read result.
[0055] In one embodiment, by determining whether the write object is a new write or a rewrite, the execution write OSD location of PG members can be planned and optimized in real time, thereby enabling data to be written locally first and reducing the latency loss of forwarding requests between different AZs (Availability Zones) to find the primary OSD.
[0056] In one embodiment, a dual-active application scenario is set up, where clients in each AZ have read and write I / O operations, but there are no or very few instances where data written by clients in AZ1 is modified by clients in AZ2. That is, the applications deployed on the clients in both AZs are stateless applications.
[0057] In one embodiment, such as Figure 2 As shown, when a file write request is received from a client, the file written by the client is sliced normally and the object identifier (OID) of the sliced object is calculated. At this time, it is necessary to record the AZ information where the client request is located, that is, the AZ location where the request is received, so as to facilitate the subsequent matching operation of the client and the main OSD location information in the PG.
[0058] In one embodiment, a PG (placement group) is a set of objects that all have the same placement strategy. Simply put, objects within the same PG will be placed on the same hard drive. PG is a core concept of Ceph (a unified distributed storage system), and the smallest granularity for server-side data balancing and recovery is the PG. OSD is the process responsible for physical storage, and it is generally configured to correspond one-to-one with a disk, with one OSD process starting for each disk.
[0059] In one embodiment, the OID is used as input and calculated using a static hash function, and then calculated with a mask to obtain the pgid. If this PG is writing data for the first time, the local OSD is set as the target OSD. If the PG already contains data, it is necessary to determine whether the location of the primary OSD in the PG is the same as the AZ location of the record. If so, the primary OSD is used as the target OSD.
[0060] In one embodiment, if the locations are not the same, the pgid is used as input and calculated using the CRUSH algorithm to obtain the OSD information of the PG group members (OSD1, OSD2, OSD3), assuming that the location of OSD1 is in the same AZ as the client.
[0061] In one embodiment, the primary OSD in the PG group is determined. If the current primary OSD is OSD1, then an IO write is performed; if OSD1 is not the primary OSD, then the read-write lock process is invoked to request write permission for OSD1.
[0062] In one embodiment, the write I / O is performed locally, and after starting the peering process for replica synchronization, a write success is returned to the client.
[0063] In one embodiment, for read IO, each replica OSD member in each AZ has complete data, so it is not necessary to request read permission separately; it is only necessary to determine whether the current replica is complete to return the read result.
[0064] In one embodiment, disaster recovery is becoming increasingly important in current IT systems, especially for critical and core applications, where the required RPO and RTO are more stringent. Therefore, the demand for active-active solutions that achieve RPO=0 and RTO≈0 is becoming increasingly strong. Current Ceph IO can only guarantee data balance across all OSDs, but it involves a large amount of IO forwarding to find the master OSD. Forwarding across geographical regions incurs latency and performance degradation. The modified solution presented in this paper optimizes the IO process, allowing clients to prioritize writing to their local OSDs, avoiding forwarding during master OSD lookup. Simultaneously, clients are allowed to read from multiple sites, thus enabling Ceph storage to better adapt to active-active solutions and achieve better performance.
[0065] The above embodiments provide a cross-regional active-active read / write method for clusters. By judging the data write status of PGs, the primary OSD role is actively planned. By solving the limitation in existing Ceph that only the primary OSD in the PG group can perform IO processing, the ability of clients to access, read and write locally is improved. The method also solves the problem of a large number of IO forwarding operations to find the primary OSD in cross-regional clusters, thereby improving storage performance in active-active scenarios.
[0066] Please see Figure 3 , Figure 3 This is a schematic flowchart illustrating a cluster cross-region dual-active read / write method provided in an embodiment of this application. This cluster cross-region dual-active read / write method can be applied to servers to improve the performance of Ceph architecture in dual-active solutions.
[0067] like Figure 3 As shown, the cross-region dual-active read / write method of the cluster specifically includes steps S201 to S205.
[0068] S201. Determine whether the PG group already contains data;
[0069] Furthermore, after determining whether the PG group already contains data, the method further includes: when the PG group does not contain data, setting the local OSD as the target OSD.
[0070] S202. When data already exists in the PG group, obtain the location of the main OSD in the PG group;
[0071] Furthermore, when data already exists in the PG group, after obtaining the location of the primary OSD in the PG group, the method further includes: when the location of the primary OSD is the same as the location of the AZ, using the primary OSD as the target OSD.
[0072] S203. When the position of the main OSD is different from the position of the AZ, the pgid is used as the input parameter of the crush algorithm to calculate and obtain at least one member OSD of the PG group.
[0073] S204. Determine the member OSD with the same position as the AZ in at least one member OSD as the OSD to be determined;
[0074] Furthermore, after determining the member OSD with the same position as the AZ as the OSD to be determined among at least one member OSD, the method further includes: when the OSD to be determined is not the master OSD of the PG group, invoking the read-write lock program to send a write permission request to the master OSD of the PG group; receiving the request result returned by the master OSD of the PG group based on the current lock state and the write permission request; and when the request result indicates that the request is successful, designating the OSD to be determined as the target OSD and updating the reserved information field.
[0075] Furthermore, the reserved information field includes the OSD number and the current lock state.
[0076] S205. When the OSD to be determined is the primary OSD of the PG group, the OSD to be determined is determined as the target OSD.
[0077] In one embodiment, the limitations of OSD roles in the PG are modified so that each OSD can handle IO, and read-write locks are used to give each OSD the possibility of performing write operations, ensuring that data can be written by multiple ends.
[0078] In one embodiment, the roles of master and slave OSDs in the PG no longer distinguish their I / O processing capabilities; that is, all OSDs can receive I / O write requests.
[0079] In one embodiment, a read-write lock request and allocation mechanism is added to ensure write data consistency when members of a single PG simultaneously receive write requests. A reservation information field (op_status, OSD_id) is set in the OSD. op_status is 0 indicating no operation, and 1 indicating an ongoing write operation. OSD_id represents the ODS (Operational Data Store) that initiated the write operation request. This flag field is synchronously updated during PG management and peering operations.
[0080] In this specific embodiment, the front-end file sharding and hash calculation process remains unchanged, and the AZ information of the client is recorded according to the client's request. After determining the pgid, the current PG member list is obtained through the CRUSH algorithm, such as (OSD1 primary, OSD2, OSD3, assuming OSD1 is primary). The engine distributes IO to the OSD where the local replica is located, that is, the OSD member in the same AZ as the client, which is assumed to be OSD2 here.
[0081] In a specific embodiment, since OSD2 is not the master, it does not have write permissions by default. In this case, it is necessary to call the read-write lock application process to apply for write permissions from OSD1.
[0082] In a specific embodiment, after receiving the request, OSD1 returns a confirmation message to OSD2 based on the current lock status, indicating whether the request was successful. If other OSDs are currently performing write operations, it enters a waiting state; otherwise, it returns a confirmation message indicating successful reservation, updates the reservation information field to (1, ods2), and updates this information to all OSDs.
[0083] In specific embodiments, such as Figure 4 As shown, after receiving the confirmation, ods2 begins writing to disk I / O and simultaneously synchronizes data with the other two OSDs.
[0084] In a specific implementation, after all IO confirmations are completed, a write success message is returned to the client, and op_stauts is updated to 0.
[0085] Please see Figure 5 , Figure 5 This application provides a schematic block diagram of a cluster cross-region dual-active read / write device, which is used to execute the aforementioned cluster cross-region dual-active read / write method. The cluster cross-region dual-active read / write device can be configured on a server.
[0086] like Figure 5 As shown, the cluster's cross-regional dual-active read / write device 300 includes:
[0087] The availability zone location acquisition module 301 is used to obtain the location of the availability zone AZ that receives the file write request based on the file write request when a file write request is received from a client.
[0088] Placement group identifier acquisition module 302 is used to obtain the placement group identifier pgid based on the file to be written in the file write request;
[0089] The target OSD determination module 303 is used to determine the target storage process OSD for performing the write operation of the file to be written based on the AZ location and the placement group PG group corresponding to the pgid;
[0090] The write execution module 304 is used to perform a write operation on the file to be written based on write IO and the target OSD, obtain a write result, and perform a read operation based on read IO to obtain a read result.
[0091] Furthermore, the placement group identifier acquisition module 302 includes:
[0092] The object identifier acquisition unit is used to perform slicing processing on the file to be written, obtain slice objects, and calculate the object identifier (OID) of the slice objects.
[0093] The placement group identifier acquisition unit is used to take the OID as an input parameter and calculate the placement group identifier pgid based on a static hash function and a mask.
[0094] Furthermore, the target OSD determination module 303 includes:
[0095] The data existence determination unit is used to determine whether the PG group already has data;
[0096] The main OSD location acquisition unit is used to acquire the location of the main OSD in the PG group when data already exists in the PG group.
[0097] The member OSD acquisition unit is used to calculate at least one member OSD of the PG group by using the pgid as the input parameter of the crush algorithm when the position of the main OSD is not the same as the position of the AZ.
[0098] The OSD to be determined unit is used to determine, from at least one member OSD, the member OSD that has the same position as the AZ as the OSD to be determined;
[0099] The target OSD determination unit is used to determine the OSD to be determined as the target OSD when the OSD to be determined is the main OSD of the PG group.
[0100] Furthermore, the target OSD determination module 303 also includes:
[0101] The target OSD setting unit is used to set the local OSD as the target OSD when there is no data in the PG group.
[0102] Furthermore, the target OSD determination module 303 also includes:
[0103] The write permission request unit is used to call the read-write lock program and send a write permission request to the master OSD of the PG group when the OSD to be determined is not the master OSD of the PG group.
[0104] The request result obtaining unit is used to receive the request result returned by the master OSD of the PG group based on the current lock state and the write permission request;
[0105] The target OSD determination unit is used to determine the OSD to be determined as the target OSD and update the reserved information field when the request result is successful.
[0106] Furthermore, the reserved information field includes the OSD number and the current lock state.
[0107] Furthermore, the target OSD determination module 303 also includes:
[0108] The target OSD determination unit is used to identify the main OSD as the target OSD when the position of the main OSD is the same as the position of the AZ.
[0109] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the above-described apparatus and modules can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0110] The aforementioned device can be implemented as a computer program, which can be used in, for example... Figure 6 It runs on the computer device shown.
[0111] Please see Figure 6 , Figure 6 This is a schematic block diagram illustrating the structure of a computer device according to an embodiment of this application. The computer device may be a server.
[0112] See Figure 6 The computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include non-volatile storage media and internal memory.
[0113] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any cluster-wide, cross-region dual-active read / write method.
[0114] The processor provides computing and control capabilities, supporting the operation of the entire computer device.
[0115] Internal memory provides an environment for the execution of computer programs in non-volatile storage media. When the computer program is executed by the processor, it enables the processor to perform any cluster cross-region dual-active read / write method.
[0116] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0117] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.
[0118] In one embodiment, the processor is configured to run a computer program stored in memory to perform the following steps:
[0119] Upon receiving a file write request from a client, the location of the Availability Zone (AZ) that received the file write request is obtained based on the file write request;
[0120] Based on the file to be written in the file write request, obtain the placement group identifier pgid;
[0121] Based on the AZ location and the placement group (PG) corresponding to the pgid, the target storage process (OSD) for performing the write operation on the file to be written is determined.
[0122] Based on the write I / O and the target OSD, the write operation of the file to be written is performed to obtain the write result, and based on the read I / O, the read is performed to obtain the read result.
[0123] In one embodiment, when the processor obtains the placement group identifier pgid based on the file to be written in the file write request, it is configured to:
[0124] The file to be written is sliced to obtain slice objects, and the object identifier (OID) of the slice objects is calculated.
[0125] Using the OID as an input parameter, the placement group identifier pgid is obtained based on a static hash function and a mask.
[0126] In one embodiment, when the processor determines the target storage process (OSD) for performing the write operation on the file to be written based on the AZ location and the placement group (PG) corresponding to the pgid, it is configured to:
[0127] Determine whether the PG group already contains data;
[0128] When data already exists in the PG group, obtain the location of the main OSD in the PG group;
[0129] When the position of the main OSD is different from the position of the AZ, the pgid is used as the input parameter of the crush algorithm to calculate and obtain at least one member OSD of the PG group;
[0130] In at least one member OSD, identify the member OSD that has the same location as the AZ as the OSD to be determined;
[0131] When the OSD to be determined is the primary OSD of the PG group, the OSD to be determined is determined as the target OSD.
[0132] In one embodiment, after determining whether data already exists in the PG group, the processor is further configured to:
[0133] When the PG group does not contain data, the local OSD is set as the target OSD.
[0134] In one embodiment, after the processor determines, in at least one member OSD, the member OSD with the same location as the AZ as the OSD to be determined, further implements:
[0135] When the OSD to be determined is not the master OSD of the PG group, the read-write lock program is invoked to send a write permission request to the master OSD of the PG group;
[0136] Receive the request result returned by the master OSD of the PG group based on the current lock state and the write permission request;
[0137] When the request result is successful, the OSD to be determined is taken as the target OSD, and the reserved information field is updated.
[0138] In one embodiment, the reserved information field includes the OSD number and the current lock state.
[0139] In one embodiment, after the processor obtains the location of the primary OSD in the PG group when data already exists in the PG group, it is further configured to:
[0140] When the position of the primary OSD is the same as the position of the AZ, the primary OSD is used as the target OSD.
[0141] The embodiments of this application also provide a computer-readable storage medium storing a computer program, the computer program including program instructions, and the processor executing the program instructions to implement any of the cluster cross-region dual-active read / write methods provided in the embodiments of this application.
[0142] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device.
[0143] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A cluster cross-region dual-active read / write method, characterized in that, include: Upon receiving a file write request from a client, the location of the Availability Zone (AZ) that received the file write request is obtained based on the file write request; Based on the file to be written in the file write request, obtain the placement group identifier pgid; Based on the AZ location and the placement group (PG) corresponding to the pgid, the target storage process (OSD) for performing the write operation on the file to be written is determined. Based on the write I / O and the target OSD, the write operation of the file to be written is performed to obtain the write result, and based on the read I / O, the read is performed to obtain the read result; The step of determining the target storage process (OSD) for performing the file write operation based on the AZ location and the placement group (PG) corresponding to the pgid includes: Determine whether the PG group already contains data; When data already exists in the PG group, obtain the location of the main OSD in the PG group; When the position of the main OSD is different from the position of the AZ, the pgid is used as the input parameter of the crush algorithm to calculate and obtain at least one member OSD of the PG group; In at least one member OSD, identify the member OSD that has the same location as the AZ as the OSD to be determined; When the OSD to be determined is the primary OSD of the PG group, the OSD to be determined is determined as the target OSD; When the PG group does not contain data, the local OSD is set as the target OSD.
2. The cluster cross-region dual-active read / write method according to claim 1, characterized in that, The step of obtaining the placement group identifier (pgid) based on the file to be written in the file write request includes: The file to be written is sliced to obtain slice objects, and the object identifier (OID) of the slice objects is calculated. Using the OID as an input parameter, the placement group identifier pgid is obtained based on a static hash function and a mask.
3. The cluster cross-region dual-active read / write method according to claim 1, characterized in that, After determining the member OSD with the same location as the AZ in at least one member OSD as the OSD to be determined, the method further includes: When the OSD to be determined is not the master OSD of the PG group, the read-write lock program is invoked to send a write permission request to the master OSD of the PG group; Receive the request result returned by the master OSD of the PG group based on the current lock state and the write permission request; When the request result is successful, the OSD to be determined is taken as the target OSD, and the reserved information field is updated.
4. The cluster cross-region dual-active read / write method according to claim 3, characterized in that, The reserved information field includes the OSD number and the current lock status.
5. The cluster cross-region dual-active read / write method according to any one of claims 1 to 4, characterized in that, When data already exists in the PG group, after obtaining the location of the primary OSD in the PG group, the method further includes: When the position of the primary OSD is the same as the position of the AZ, the primary OSD is used as the target OSD.
6. A clustered cross-regional dual-active read / write device, characterized in that, include: The availability zone location acquisition module is used to obtain the location of the availability zone (AZ) that receives the file write request based on the file write request when a file write request is received from a client. The placement group identifier acquisition module is used to obtain the placement group identifier pgid based on the file to be written in the file write request; The target OSD determination module is used to determine the target storage process OSD for performing the write operation of the file to be written, based on the AZ location and the placement group (PG) corresponding to the pgid; The write execution module is used to perform a write operation on the file to be written based on write I / O and the target OSD, obtain the write result, and perform a read operation based on read I / O to obtain the read result; The target OSD determination module includes: The data existence determination unit is used to determine whether the PG group already has data; The main OSD location acquisition unit is used to acquire the location of the main OSD in the PG group when data already exists in the PG group. The member OSD acquisition unit is used to calculate at least one member OSD of the PG group by using the pgid as the input parameter of the crush algorithm when the position of the main OSD is not the same as the position of the AZ. The OSD to be determined unit is used to determine, from at least one member OSD, the member OSD that has the same position as the AZ as the OSD to be determined; The target OSD determination unit is used to determine the OSD to be determined as the target OSD when the OSD to be determined is the main OSD of the PG group; The target OSD setting unit is used to set the local OSD as the target OSD when there is no data in the PG group.
7. A computer device, characterized in that, The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and, when executing the computer program, implement the cluster cross-region dual-active read / write method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to implement the cluster cross-region dual-active read / write method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Data storage method and device, management equipment and active-active data storage system
CN109828868A
Hyper-converged all-in-one machine and software-defined storage SDS processing method and system thereof
CN111949217A