I / O permission management method and device, computer device, readable storage medium and program product
By unifying I/O permissions through log storage services, the problem of permission contention in multi-cluster shared storage environments is solved, thereby improving data consistency and system stability.
Patent Information
- Application Number
- CN202611312215.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-11-27
AI Technical Summary
In a multi-cluster shared storage environment, traditional I/O permission management methods cause both the disaster recovery cluster and the original primary cluster to modify I/O fence permissions simultaneously, leading to unstable permission states, disordered switching processes, and data inconsistencies.
By introducing a log storage service as the unified execution entity, I/O permissions are centrally managed by identifying a unique master cluster, and permission adjudication is performed based on the master-slave relationship to ensure that permission modifications are uniformly performed at the cluster group level.
It effectively avoids the contention and overwriting problem of I/O permissions being modified simultaneously in multiple clusters, improves data consistency and system stability, ensures the controllability and predictability of permission changes, and realizes centralized management of I/O permissions across cluster groups.
Smart Images

Figure CN123185202A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of big data technology, and in particular to an I / O permission management method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] With the rapid development of big data and distributed system technologies, multi-cluster architectures have emerged. In this architecture, multiple clusters share underlying storage resources and achieve data synchronization and failover through a master-slave relationship to support the continuous operation of critical business processes. In a multi-cluster environment with shared storage, I / O (Input / Output) permission management is a core element in ensuring data consistency and system stability.
[0003] In traditional technology, when a node in the primary cluster A fails, the disaster recovery cluster A' is promoted to primary. During the promotion process, disaster recovery cluster A' modifies I / O fence permissions to grant write access. However, the original primary cluster A may still be alive at this time. After a failover occurs within its cluster, the new primary node in the original primary cluster A will also attempt to modify I / O fence permissions, trying to regain access to cluster A. In this situation, both disaster recovery cluster A' and the original primary cluster A will modify I / O fence permissions simultaneously, leading to I / O fence contention. This results in unstable permission states, a disordered failover process, and even serious consequences such as data inconsistency. Summary of the Invention
[0004] Therefore, it is necessary to provide an I / O permission management method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve data consistency in response to the above-mentioned technical problems.
[0005] Firstly, this application provides an I / O permission management method applied to a log storage service, wherein the log storage service is used to serve at least one cluster group, and the method includes:
[0006] For each of the cluster groups, the primary / standby relationship between multiple clusters in the cluster group is obtained; each of the clusters includes at least one node;
[0007] Based on the primary / standby relationship, a unique master cluster is determined from the cluster group; the master cluster has the authority to modify the I / O operation permissions of each of the multiple clusters in the log storage service; the master cluster can be changed if the primary / standby relationship changes.
[0008] Upon receiving an I / O request initiated by any of the nodes, determine the first cluster group to which the node belongs from the at least one cluster group;
[0009] Based on the I / O operation permissions of the cluster to which the node belongs in the first cluster group, the I / O request is adjudicated to obtain an adjudication result; the adjudication result is used to determine whether to execute an I / O operation that matches the I / O request.
[0010] In one embodiment, the owner cluster in any of the cluster groups writes logs to the log storage service and synchronizes the logs to the disaster recovery cluster in the cluster group. In this embodiment, the method further includes:
[0011] In the case where there is a second cluster group in the at least one cluster group where the master-slave relationship has changed, the master cluster of the second cluster group is downgraded to a disaster recovery cluster, and a candidate master cluster is determined from the disaster recovery cluster of the second cluster group.
[0012] The candidate owner cluster is controlled to read the difference logs of the second cluster group from the log storage service and replay them;
[0013] Once the difference log replay is complete, the candidate owner cluster will be designated as the new owner cluster for the second cluster group.
[0014] In one embodiment, the method further includes:
[0015] If a failure is detected in any of the master clusters, it is determined that a change in the master-slave relationship has occurred in the second cluster group to which the master cluster belongs;
[0016] The step of controlling the candidate master cluster to read the difference logs of the second cluster group from the log storage service includes:
[0017] Send a promotion notification to the candidate master cluster to control the candidate master cluster to read the difference logs of the second cluster group from the log storage service;
[0018] The candidate owner cluster is also used to report its own cluster information to the log storage service; the cluster information is used to modify the I / O operation permissions of the candidate owner cluster.
[0019] In one embodiment, the master cluster includes master nodes and slave nodes; the method further includes:
[0020] Establish heartbeat connections with the master nodes of each of the aforementioned master clusters;
[0021] If any of the aforementioned master nodes has a target master node that has missed heartbeats for N consecutive heartbeat cycles, then a waiting window is entered; the target master node belongs to the target master cluster; N is a natural number;
[0022] If a heartbeat is received from any node in the target master cluster within the waiting window, it is determined that the master-slave relationship of the target cluster group to which the target master cluster belongs has not changed.
[0023] If no heartbeat is received from the target master cluster by the end of the waiting window, it is determined that the master-slave relationship of the target cluster group has changed.
[0024] In one embodiment, the cluster information of the owner cluster includes an owner identifier and a version number; the version number increments when the owner cluster changes.
[0025] The step of adjudicating the I / O request based on the I / O operation permissions of the node's cluster in the first cluster group, and obtaining the adjudication result, includes:
[0026] If the I / O request is a permission modification request for the first cluster group, obtain the initiating cluster information carried in the request;
[0027] If the initiator cluster information contains an owner identifier and the version number in the initiator cluster information is consistent with the current version number of the first cluster group, the decision result of the I / O request is determined to be a successful decision.
[0028] If the initiator cluster information does not contain an owner identifier, or if the version number in the initiator cluster information is inconsistent with the current version number of the first cluster group, the decision result of the I / O request is determined to be a failure.
[0029] In one embodiment, determining a unique master cluster from the cluster group based on the master-slave relationship includes:
[0030] Based on the primary-backup relationship, maintain the access control list corresponding to the cluster group in the log storage service, so as to determine the unique owner cluster and the disaster recovery cluster other than the owner cluster from the cluster group.
[0031] The access control list is used to record the I / O operation permissions of the master cluster and each of the disaster recovery clusters.
[0032] In one embodiment, the log storage service includes log storage service instances deployed across multiple regions. In this embodiment, the method further includes:
[0033] If any of the cluster groups undergoes a change of ownership cluster, and the first region where the current ownership cluster of the cluster group is located is different from the second region where the original ownership cluster of the cluster group is located, the log writing operation of the cluster group will be switched from the log storage service instance in the second region to the log storage service instance in the first region.
[0034] Secondly, this application also provides an I / O permission management device applied to a log storage service, the log storage service being used to serve at least one cluster group, the device comprising:
[0035] The primary / standby relationship acquisition module is used to acquire the primary / standby relationship between multiple clusters in each of the cluster groups; each of the clusters includes at least one node;
[0036] The owner determination module is used to determine a unique owner cluster from the cluster group based on the master-slave relationship; the owner cluster has the right to modify the I / O operation permissions of each of the multiple clusters in the log storage service; the owner cluster can be changed if the master-slave relationship changes.
[0037] The cluster group matching module is used to determine the first cluster group to which the node belongs from the at least one cluster group when receiving an I / O request initiated by any of the nodes.
[0038] The adjudication module is used to adjudicate the I / O request based on the I / O operation permissions of the cluster to which the node belongs in the first cluster group, and obtain an adjudication result; the adjudication result is used to determine whether to execute an I / O operation that matches the I / O request.
[0039] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described I / O permission management method.
[0040] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described I / O permission management method.
[0041] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the aforementioned I / O permission management method.
[0042] The aforementioned I / O permission management methods, devices, computer equipment, computer-readable storage media, and computer program products integrate I / O permission management functions into log storage services. The log storage service acts as a unified execution entity to centrally maintain and manage I / O operation permissions for multiple clusters within each cluster group. This eliminates the dispersion of permission management entities and avoids contention and overwriting issues caused by multiple clusters simultaneously modifying permissions at the architectural level. By determining a unique master cluster within each cluster group based on the master-slave relationship, and ensuring that this master cluster has the authority to modify I / O operation permissions, permission modification authority always belongs to the unique master cluster of the cluster group, regardless of changes in the master-slave relationship. This effectively avoids permission contention and state instability caused by multiple entities simultaneously initiating permission modifications. Furthermore, binding master changes to master-slave relationship changes ensures that permission modifications are only triggered when the master-slave relationship switches at the cluster group level. This avoids frequent permission changes caused by non-cluster group level events such as internal node failures or master-slave failover, significantly improving the controllability and predictability of permission changes. Upon receiving an I / O request from any node, the system first determines the target cluster group to which the node belongs, and then makes a decision based on the permission information within that cluster group. This "group-isolated, independent decision-making" mechanism ensures that I / O permission management between different cluster groups is independent and does not interfere with each other. It enables centralized management of I / O permissions across cluster groups, thereby effectively improving data consistency in multi-cluster group shared storage scenarios and ensuring system stability during disaster recovery failover. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is an application environment diagram of an I / O permission management method in one embodiment;
[0045] Figure 2 This is an application environment diagram of the I / O permission management method in another embodiment;
[0046] Figure 3 This is a flowchart illustrating an I / O permission management method in one embodiment;
[0047] Figure 4 This is a flowchart illustrating the I / O permission management method in another embodiment;
[0048] Figure 5This is a schematic diagram illustrating the principle of log synchronization within a cluster group in one embodiment;
[0049] Figure 6 This is a flowchart illustrating the adjudication process for I / O requests in one embodiment;
[0050] Figure 7 This is a schematic diagram illustrating the principle of configuring different I / O permissions for different clusters in one embodiment;
[0051] Figure 8 This is a schematic diagram illustrating the deployment regions of the cluster and log storage service in one embodiment;
[0052] Figure 9 This is a schematic diagram illustrating the switching process for off-site disaster recovery upgrade in one embodiment;
[0053] Figure 10 This is a flowchart illustrating the I / O permission management method in yet another embodiment;
[0054] Figure 11 This is a schematic diagram of the disaster recovery upgrade process in one embodiment;
[0055] Figure 12 This is a structural block diagram of an I / O access control device in one embodiment;
[0056] Figure 13 This is an internal structural diagram of a computer device in one embodiment;
[0057] Figure 14 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. It should be noted that existing industry solutions such as software, components, and models may be mentioned in the embodiments of this application. These should be considered exemplary and are intended only to illustrate the feasibility of implementing the technical solutions of this application, but do not imply that the applicant has already used or necessarily used such solutions.
[0059] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant regulations. The acquisition, storage, use and processing of data in the technical solution of this application all comply with the relevant provisions of national laws and regulations.
[0060] The terms "first," "second," etc., used in this application may be used to describe various elements, but these elements are not limited by these terms. These terms are used only to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0061] As mentioned earlier, traditional technologies are prone to I / O framing contention. Related technologies typically address this issue using a node-level contention scheme based on a storage device reservation mechanism. The basic workflow is as follows: When each node joins the cluster for the first time, it registers a unique key with the shared storage device. After registration, the master server usually performs a reservation operation, requesting specific types of access permissions to achieve access isolation of the shared storage resources. When a node fails, the surviving nodes in the cluster can use a preemption and cleanup command to forcibly preempt and clear the key information registered by the failed node on the shared storage device, preventing it from continuing to issue I / O requests to the shared storage, thus completing the I / O framing operation and ensuring data consistency.
[0062] However, the aforementioned storage device reservation mechanism is essentially a decentralized node-level competition mechanism. When a network partition or link anomaly occurs in the cluster, different clusters may simultaneously believe they still have write permissions to the shared storage, thus attempting to update each other's access keys. In this scenario, multiple nodes will simultaneously launch preemptive commands to the shared storage device, vying for control. Although related technologies use pre-defined delay competition strategies to try to avoid multiple nodes winning simultaneously, it still relies on competition and preemption between nodes, lacking a unified permission management entity and a deterministic permission decision-making mechanism. In complex scenarios of multi-cluster shared storage, this competition mechanism cannot fundamentally avoid the contention and overwriting problems caused by multiple clusters simultaneously modifying I / O fence permissions, and the risks of unstable permission states and disordered switching processes still exist.
[0063] To address the shortcomings of the storage device reservation mechanism in the aforementioned related technologies, this application provides an I / O permission management method. By introducing a log storage service as the unified execution entity for I / O permission management and by introducing a unique owner cluster, a centralized permission decision-making mechanism replaces the traditional node-level competition mechanism, fundamentally avoiding the problem of multiple clusters simultaneously competing for and covering I / O fence permissions.
[0064] The I / O permission management method provided in this application embodiment can be applied to, for example, Figure 1In the application environment shown, the log storage service 110 communicates with at least one cluster group 120 via a network. This cluster group 120 may include multiple clusters. For example... Figure 1 In this cluster group 120, cluster group 121 includes cluster 121 and cluster 122. Cluster 121 and cluster 122 have a master-slave relationship, with one cluster acting as the master cluster to provide read and write services, and the other cluster acting as a disaster recovery cluster to synchronize the data change logs of the master cluster in real time, so as to take over the service in case the master cluster fails. The log storage service 110 is used to store the log data written by the master cluster in cluster group 120 and provides it to the disaster recovery cluster for reading and playback.
[0065] The log storage service 110, acting as the unified execution entity for I / O permission management, maintains the I / O operation permissions of clusters 121 and 122 within cluster group 120. Specifically, the log storage service 110 obtains the master-slave relationship among multiple clusters in cluster group 120 and, based on this relationship, determines a unique master cluster within cluster group 120. Optionally, the log storage service 110 can designate the master cluster in cluster group 120 as the master cluster. This master cluster possesses the permission to modify the I / O operation permissions of each cluster within cluster group 120. In other words, the master cluster can control the ownership and changes of I / O operation permissions throughout the entire cluster group through this modification permission.
[0066] The following explanation will be based on the case where the master cluster is cluster 121.
[0067] Under normal operating conditions, cluster 121 has read and write permissions in the log storage service 110, while cluster 122, as a disaster recovery cluster, has read-only permissions. When the master-slave relationship of cluster group 120 changes (for example, if cluster 121 fails and needs to be switched to cluster 122), the log storage service 110 responds to this change by changing the master cluster of cluster group 120 from cluster 121 to cluster 122, and changing the I / O operation permissions of cluster 122 from read-only to read and write permissions, while changing the I / O operation permissions of cluster 121 from read and write permissions to read-only permissions or no permissions.
[0068] When there are multiple cluster groups 120, the log storage service 110 maintains corresponding I / O operation permission information for each cluster group, and the permission management between different cluster groups is independent. Upon receiving an I / O request from any node, the log storage service 110 first determines the target cluster group to which the node belongs, and then adjudicates the I / O request based on the permission information in the target cluster group, allowing only cluster nodes with the corresponding permissions to execute the corresponding I / O operation. In this way, the log storage service 110 completes centralized management and dynamic adjudication of I / O operation permissions, ensuring data consistency in multi-cluster shared storage scenarios.
[0069] Optionally, the log storage service 110 can be integrated into the disaster recovery management component of a database system, distributed storage system, or cloud service platform, or it can be deployed as an independent intermediary service. This application embodiment does not limit this.
[0070] Optionally, the log storage service 110 can be hosted on a computer device. This computer device can be a terminal, a server, or a cluster of multiple servers. In cloud service mode, regardless of whether it is a terminal, server, or cluster, the above physical resources can be elastically supplied through cloud hosts, bare metal servers, or containerized deployment. Users can dynamically adjust the number of CPU cores, memory capacity, storage type, and network bandwidth according to the log scale without having to worry about the underlying physical details.
[0071] In one exemplary embodiment, such as Figure 2 As shown, the log storage service 110 can serve multiple cluster groups. These cluster groups may include, for example, cluster group 120 and cluster group 130. Each cluster group contains a primary cluster and a disaster recovery cluster. Figure 2 In this configuration, the primary cluster in cluster group 120 is cluster 121, and the primary cluster in cluster group 130 is cluster 131. The log storage service 110 can manage I / O permissions for each cluster group separately to achieve permission isolation between different cluster groups.
[0072] In one embodiment, such as Figure 3 As shown, an I / O permission management method is provided, which can be applied to... Figure 1 Taking the log storage service 110 as an example, this log storage service 110 is used to serve at least one cluster group. In this embodiment, the I / O permission management method includes the following steps 302 to 308. Wherein:
[0073] Step 302: For each cluster group, obtain the master-slave relationship between multiple clusters in the cluster group.
[0074] In this context, a cluster group refers to a collection of primary and backup clusters that share the same log storage service. The cluster group is the basic unit for I / O permission management in the log storage service. The log storage service maintains the corresponding I / O operation permission information and owner cluster information independently for each cluster group, using the cluster group as the granularity.
[0075] A cluster group comprises multiple clusters with a master-slave relationship. That is, one cluster in the group acts as the master cluster, providing read and write services, while the other clusters act as disaster recovery clusters, synchronizing the master cluster's data change logs in real time to take over services in the event of a master cluster failure. A cluster refers to a computing unit consisting of at least one node, possessing independent data processing and I / O access capabilities, and capable of initiating I / O requests to the log storage service as a whole.
[0076] Any cluster can include one or more nodes. When a cluster contains multiple nodes, these nodes can have a master-slave relationship. Optionally, the master node can be responsible for performing I / O operations and permission negotiation between the cluster and the log storage service, while the slave nodes act as backups of the master node, taking over its functions when the master node fails.
[0077] There is no single way to obtain the master-slave relationship.
[0078] Optionally, when the primary / standby relationship of a cluster group is established or changed, the clusters in the cluster group can proactively report the primary / standby relationship between multiple clusters in the group to the log storage service. For example, after an administrator configures the primary / standby relationship in a cluster group, the primary cluster and / or the disaster recovery cluster send a primary / standby relationship registration request to the log storage service. This request carries the group identifier of the cluster group and the role information of each cluster in the group. After receiving the registration request, the log storage service determines the primary / standby relationship between multiple clusters in the cluster group based on the information carried in the request.
[0079] Optionally, the log storage service can proactively discover and determine the primary / standby relationship between multiple clusters in each cluster group through heartbeat connections or metadata queries with each cluster. For example, the log storage service periodically sends primary / standby relationship query requests to registered clusters, and upon receiving the query request, the clusters return the current primary / standby relationship information to the log storage service.
[0080] Optionally, the log storage service can store the master-slave relationship information in the metadata area. When the master-slave relationship of the cluster group changes, the log storage service can synchronously update the master-slave relationship information stored locally to ensure that the master-slave relationship maintained in the log storage service is consistent with the actual master-slave status of the cluster group.
[0081] Step 304: Based on the master-slave relationship, determine the unique master cluster from the cluster group.
[0082] In this context, the master cluster refers to the unique cluster within a cluster group that the log storage service determines as having the sole authority to modify I / O operation permissions, based on the master-slave relationship within that cluster group. The master cluster is the core decision-making entity for I / O permission management within the log storage service; it is the only cluster entity in the cluster group authorized by the log storage service to modify the I / O operation permissions of each cluster within that group.
[0083] Optionally, I / O operation permissions may include at least one of read-write permissions, read-only permissions, or no permissions. No permissions means that no I / O operations are allowed. For clusters that have failed or been isolated within a cluster group, their permissions can be set to no permissions to completely block their access to the log storage service.
[0084] Optionally, the log storage service can designate the primary cluster in a cluster group as the owner cluster of that cluster group. The owner cluster is essentially a logical permission role; its existence depends on the permission records in the log storage service, rather than a physical cluster role identifier. The owner cluster only changes when the primary / standby relationship of the cluster group changes. When the primary / standby role of the cluster group changes, the log storage service will accordingly switch the owner cluster from the original primary cluster to the new primary cluster.
[0085] The master cluster has the authority to modify the I / O operation permissions of multiple clusters in the cluster group. That is, only the master cluster can send a request to the log storage service to modify the I / O permissions of the cluster group. I / O permission modification requests sent by non-master clusters will be rejected by the log storage service.
[0086] In an optional embodiment, after obtaining the master-slave relationship of a cluster group, the log storage service directly determines the master cluster in the master-slave relationship as the owner cluster of the cluster group. For example, assume that the master-slave relationship of cluster group A obtained by the log storage service is: cluster A1 is the master cluster, and cluster A2 is the disaster recovery cluster. Based on this master-slave relationship, the log storage service directly determines cluster A1 as the owner cluster of cluster group A and records "owner cluster of cluster group A = cluster A1" in the metadata area of the log storage service. When the master-slave relationship of cluster group A changes (e.g., cluster A1 fails, and cluster A2 is promoted to master), the log storage service responds to the change in the master-slave relationship by updating the owner cluster record to cluster A2.
[0087] In an optional embodiment, the primary cluster in a cluster group can proactively send owner information to the log storage service when establishing a primary-standby relationship or when the primary-standby relationship changes. This owner information carries the cluster identifier of the primary cluster. Upon receiving this owner information, the log storage service verifies it against the locally stored primary-standby relationship information. If the reported primary cluster matches the primary cluster recorded in the primary-standby relationship, the log storage service identifies the primary cluster as the owner cluster and records the owner information. For example, after establishing a primary-standby relationship with disaster recovery cluster B2, primary cluster B1 in cluster group B proactively sends owner information to the log storage service. This owner information includes the group identifier of cluster group B and the cluster identifier of cluster B1. Upon receiving this owner information, the log storage service queries the locally stored primary-standby relationship of cluster group B. If it confirms that cluster B1 is indeed the primary cluster, it records the owner information as valid owner information and identifies cluster B1 as the owner cluster of cluster group B.
[0088] Step 306: Upon receiving an I / O request initiated by any node, determine the first cluster group to which the node belongs from at least one cluster group.
[0089] In this context, the first cluster group refers to the cluster group to which the node initiating the I / O request belongs. When the log storage service serves multiple cluster groups, the I / O operation permissions between different cluster groups are independent, each maintaining its own owner cluster and permission information. When the log storage service receives an I / O request from a node, since the log storage service serves multiple cluster groups simultaneously, the node may belong to any of them. Therefore, it is necessary to first determine which specific cluster group the node belongs to in order to subsequently use the permission information corresponding to that cluster group for decision-making.
[0090] Optionally, an I / O request may include at least one of a read request, a write request, or a permission modification request. Specifically, a read request is used to read log data from the log storage service; a write request is used to write log data to the log storage service; and a permission modification request is used to modify the I / O operation permissions of each cluster in the cluster group.
[0091] In an optional embodiment, any I / O request carries a source node identifier, which uniquely identifies the node initiating the I / O request so that the log storage service can determine the cluster group to which the node belongs based on the source node identifier. The log storage service can store context information for each cluster within the cluster group it serves. This context information can be used to record the affiliation between cluster groups, i.e., which cluster group each cluster belongs to, and which nodes are included in each cluster. When an I / O request is received from a node, the log storage service extracts the source node identifier from the I / O request. Then, using the source node identifier as an index, it performs a matching query in the context information of each cluster group to determine if there is a cluster group whose context information records the node. If a matching cluster group is found, this matching cluster group is determined as the first cluster group to which the node belongs.
[0092] In an optional embodiment, when a node initiates an I / O request, it carries the group identifier of the cluster group to which it belongs in the I / O request. In this embodiment, the log storage service can directly extract the cluster group identifier from the I / O request after receiving it, and determine the first cluster group to which the node belongs based on the cluster group identifier.
[0093] In an optional embodiment, the log storage service may have a pre-configured mapping relationship between node address ranges and cluster groups. When an I / O request is received from a node, the log storage service can determine the cluster group to which the node belongs based on the address range to which the node's address belongs.
[0094] Optionally, if the log storage service cannot find any cluster group to which the node belongs after querying, the log storage service will reject the I / O request and return an error response to the node that initiated the I / O request. This error response indicates that the node is not registered in the log storage service and does not have I / O operation permissions.
[0095] Step 308: Based on the I / O operation permissions of the cluster to which the node belongs in the first cluster group, adjudicate the I / O request and obtain the adjudication result.
[0096] The adjudication result is used to determine whether to execute an I / O operation that matches the I / O request. Adjudication is the process by which the log storage service, as the unified execution entity for I / O permission management, verifies permissions and makes admission decisions for I / O requests initiated by nodes. Essentially, adjudication matches the operation type declared in the I / O request with the I / O operation permissions granted to the requesting cluster in the first cluster group: if they match, execution is allowed; otherwise, execution is rejected. Through this adjudication mechanism, the log storage service ensures that only cluster nodes with the corresponding permissions can execute the corresponding I / O operation, thereby achieving centralized control of I / O permissions in multi-cluster shared storage scenarios.
[0097] After determining the first cluster group to which the node belongs, the log storage service further determines the role of the cluster within that first cluster group. That is, whether the node belongs to the master cluster or the disaster recovery cluster within the first cluster group. The cluster's role information determines the type of I / O operation permissions that the cluster possesses within the first cluster group.
[0098] In its implementation, the log storage service can extract the target operation type from the I / O request. If the I / O request is a read request, the target operation type is "read"; if the I / O request is a write request, the target operation type is "write"; if the I / O request is a permission modification request, the target operation type is "modify permission". Different I / O request types correspond to different operation types, and different types of operations need to match the corresponding I / O operation permissions to be executed. Then, the log storage service matches and verifies the I / O operation permissions possessed by the cluster to which the node belongs with the target operation type of the I / O request, generating the corresponding decision result.
[0099] Optionally, if the ruling is passed, the log storage service performs the I / O operation matching the I / O request. For example, if the I / O request is a write request, the log storage service writes the data to the corresponding storage location; if the I / O request is a read request, the log storage service reads the data from the corresponding storage location and returns it to the requester.
[0100] Optionally, if the ruling fails, the log storage service refuses to execute the I / O operation matching the I / O request and returns a permission denial response to the node that initiated the I / O request. This permission denial response indicates that the node does not have the permission to execute the corresponding I / O operation. By returning a permission denial response, the initiator can promptly recognize the insufficient permission status, facilitating appropriate error handling or retrying. Simultaneously, the log storage service can also record an audit log for this failed ruling. This audit log includes at least one of the following information: initiating node identifier, initiating cluster identifier, target cluster group identifier, I / O request type, ruling timestamp, and reason for rejection. This audit log can be used for subsequent operational troubleshooting and permission auditing.
[0101] The aforementioned I / O permission management method integrates I / O permission management functionality into the log storage service. The log storage service acts as a unified execution entity to centrally maintain and manage I / O operation permissions for multiple clusters within each cluster group. This eliminates the fragmentation of permission management entities and avoids contention and overwriting issues caused by multiple clusters simultaneously modifying permissions. By determining a unique master cluster within each cluster group based on the master-slave relationship, and ensuring that this master cluster has the authority to modify I / O operation permissions, permission modification authority always belongs to the unique master cluster within the cluster group, regardless of changes in the master-slave relationship. This effectively avoids permission contention and state instability caused by multiple entities simultaneously initiating permission modifications. Furthermore, binding master changes to master-slave relationship changes ensures that permission modifications are only triggered when the master-slave relationship switches at the cluster group level. This avoids frequent permission changes caused by non-cluster group level events such as internal node failures or master-slave failover, significantly improving the controllability and predictability of permission changes. Upon receiving an I / O request from any node, the system first determines the target cluster group to which the node belongs, and then makes a decision based on the permission information within that cluster group. This "group-isolated, independent decision-making" mechanism ensures that I / O permission management between different cluster groups is independent and does not interfere with each other. It enables centralized management of I / O permissions across cluster groups, thereby effectively improving data consistency in multi-cluster group shared storage scenarios and ensuring system stability during disaster recovery failover.
[0102] In one optional embodiment, the log storage service serves multiple cluster groups. To meet the differentiated requirements of different cluster groups in terms of business importance, data retention needs, and storage costs, the log storage service can support configuring different log retention policies for different cluster groups. Simultaneously, to improve the utilization efficiency of storage resources, the log storage service can divide the total storage space into multiple storage pools, with each cluster group exclusively occupying one or more storage pools, and dynamically adjusting storage quotas based on the storage utilization rate of each group.
[0103] In practice, the log storage service can configure independent log retention policies for each cluster group. Log retention policies include the following dimensions: retention duration (e.g., logs in cluster group A are retained for 30 days, and logs in cluster group B are retained for 7 days), archiving policy (e.g., whether logs are automatically deleted or archived to cold storage after the retention period is reached), and cleanup policy (e.g., whether cleanup is triggered at fixed intervals or when storage utilization reaches a threshold). By configuring independent log retention policies for different cluster groups, the differentiated needs of different business scenarios can be met. For example, core business cluster groups need to retain logs for a long time to meet compliance audit requirements, so they can be configured with longer retention durations and archiving policies; test or non-core business cluster groups have lower log retention requirements, so they can be configured with shorter retention durations to save storage space.
[0104] Meanwhile, the log storage service divides the total storage space into multiple storage pools, with each cluster group exclusively occupying one or more storage pools. A storage pool is a logical unit for dividing physical storage resources. Storage pools in different cluster groups are isolated from each other, ensuring that log data from one cluster group will not occupy the storage space of other cluster groups, thereby guaranteeing resource and performance isolation between groups.
[0105] Based on the storage pool partitioning, the log storage service also dynamically adjusts the storage quota of each cluster group according to the storage utilization rate and log write frequency of each cluster group. Specifically, the log storage service monitors the following indicators of each cluster group in real time or periodically: current storage usage, storage utilization rate (used space / total quota), and log write frequency (amount of log data written per unit time).
[0106] When the storage utilization rate of a cluster group exceeds a preset threshold (e.g., 80%) and the log write frequency is higher than a preset frequency threshold, it indicates that the log data of that cluster group is still growing rapidly. The log storage service can increase the storage quota of the cluster group to avoid log write failures due to insufficient storage space. After expansion, the log storage service sends a quota change notification to the cluster group so that the cluster group can be aware of the change in storage quota in a timely manner.
[0107] When the storage utilization rate of a cluster group falls below a preset threshold (e.g., 30%) and the log write frequency is lower than a preset frequency threshold, it indicates that the log data growth of that cluster group is slow. The log storage service can automatically reduce the storage quota of that cluster group to free up excess storage space for other cluster groups. After scaling down, the log storage service will also send a quota change notification to that cluster group.
[0108] Through the aforementioned dynamic quota adjustment mechanism, the log storage service can achieve elastic allocation and efficient utilization of storage resources while ensuring the storage needs of each cluster group.
[0109] In one embodiment, the master cluster in any cluster group writes logs to the log storage service and synchronizes these logs to the disaster recovery cluster in the cluster group. For example... Figure 4 As shown, in this embodiment, the I / O permission management method further includes steps 402 to 406. Wherein:
[0110] Step 402: If there is a second cluster group in at least one cluster group where the master-slave relationship has changed, downgrade the master cluster of the second cluster group to a disaster recovery cluster, and determine the candidate master cluster from the disaster recovery clusters of the second cluster group.
[0111] In practical applications, in disaster recovery scenarios with shared database storage, the system is divided into a primary cluster, a disaster recovery cluster, and a log storage service. For example... Figure 5As shown, the primary cluster, acting as the production cluster, writes logs to the log storage service and synchronizes these logs to the disaster recovery cluster. The disaster recovery cluster, acting as a backup cluster, reads and replenishes logs from the log storage service when a failure occurs. When the primary cluster is designated as the master cluster, it writes logs to the log storage service and synchronizes these logs to the disaster recovery cluster within the cluster group.
[0112] When the primary / standby relationship of a cluster group changes—for example, if the original primary cluster fails and needs to be switched to the disaster recovery cluster, or if an administrator actively triggers a disaster recovery upgrade operation—the primary / standby relationship of the second cluster group changes. In response to this change, the log storage service downgrades the original primary cluster of the second cluster group to a disaster recovery cluster, removing its original primary cluster's permissions, and selects a cluster from the disaster recovery clusters in the second cluster group as a candidate primary cluster.
[0113] Optionally, the log storage service can select the disaster recovery cluster with the highest data synchronization progress (i.e., the smallest data difference with the master cluster) as the candidate master cluster based on the data synchronization progress of each disaster recovery cluster. In this way, when reading difference logs later, the candidate master cluster needs to read and replay the least amount of difference logs, and the promotion speed is the fastest, which can effectively shorten the recovery time target of disaster recovery switchover.
[0114] Optionally, the log storage service can also select candidate master clusters based on factors such as the hardware configuration, network latency, or historical stability of each disaster recovery cluster. For example, it can select the disaster recovery cluster with the highest hardware configuration, the lowest network latency, or the most stable historical operation as the candidate master cluster.
[0115] In an exemplary embodiment, the degradation operation is performed before the candidate master cluster begins reading the difference logs. Specifically, after the log storage service responds to the master-slave relationship change event, it first modifies the I / O operation permissions of the original master cluster from read-write permissions to read-only permissions or no permissions, preventing it from continuing to write logs. Then, a candidate master cluster is determined from the disaster recovery cluster. This effectively prevents the original master cluster from continuing to write new logs during the master promotion process, avoids the continuous growth of the difference logs, and thus ensures that the master promotion process is carried out in a stable data state.
[0116] Step 404: Control the candidate master cluster to read the difference logs of the second cluster group from the log storage service and replay them.
[0117] The reading process involves loading the differential logs from the log storage service to the local cluster of the candidate owner, while the replay process involves recording the loaded logs locally and applying them one by one. These two stages work together sequentially.
[0118] Difference logs refer to log data that the primary cluster has written to the log storage service but that the disaster recovery cluster has not yet synchronized and replayed. The log storage service stores complete historical log records, while the difference logs are only the portion that has not yet been synchronized by the candidate master cluster. Under normal conditions, the candidate master cluster has already synchronized most of the log data through the log synchronization mechanism. Therefore, when becoming the primary master, it only needs to pull the difference logs added since the last synchronization for replay to complete the data, without needing to synchronize all historical log data.
[0119] In one exemplary embodiment, the log storage service can control the candidate master cluster to read the difference logs of the second cluster group from the log storage service by sending a promotion notification to the candidate master cluster.
[0120] In an exemplary embodiment, the log storage service can modify the access control list corresponding to the second cluster group to control the candidate master cluster to read the difference logs of the second cluster group from the log storage service. Specifically, in response to a master-slave relationship change event, the log storage service can change the I / O operation permissions of the candidate master cluster from read-only to read-write permissions in the access control list corresponding to the second cluster group, and change the I / O operation permissions of the original master cluster from read-write permissions to read-only permissions or no permissions. After detecting the change in its own I / O operation permissions, the candidate master cluster knows that it has been selected as a candidate master cluster, and then triggers the difference log reading process to read the difference logs of the second cluster group from the log storage service.
[0121] Optionally, the cluster can detect changes in its I / O operation permissions by periodically querying the access control list or receiving permission change notifications pushed by the log storage service.
[0122] Optionally, the log storage service can obtain the sequence number of the currently synchronized logs from the candidate owner cluster, and then determine the starting position for reading the differential logs based on the log sequence number, so as to achieve accurate retrieval and avoid unnecessary data transmission.
[0123] Optionally, each log record stored in the log storage service carries the group identifier of the corresponding cluster group. When the candidate master cluster reads the differential log from the log storage service, it only pulls the log record that matches the group identifier of the second cluster group, thereby ensuring that the logs of each group are isolated from each other and do not interfere with each other.
[0124] Step 406: After the difference log replay is completed, the candidate owner cluster is designated as the new owner cluster of the second cluster group.
[0125] After the difference log replay is complete, the log storage service designates the candidate owner cluster as the new owner cluster for the second cluster group. At this point, the new owner cluster has the authority to modify the I / O operation permissions of each cluster in the second cluster group. Subsequent modifications to I / O operation permissions within the second cluster group will be initiated and managed by this new owner cluster. The original owner cluster has been downgraded to a disaster recovery cluster and no longer possesses owner permissions, thus ensuring the uniqueness of the entity responsible for modifying permissions.
[0126] Optionally, after the candidate master cluster is promoted to master, the disaster recovery clusters in the second cluster group (including the disaster recovery clusters after the original master cluster is downgraded and other disaster recovery clusters) continue to synchronize logs from the new master cluster and continuously pull logs from the log storage service for playback in order to maintain data synchronization with the new master cluster.
[0127] In the above embodiments, before the candidate master cluster becomes the master, it needs to read the difference logs from the log storage service and replay them to ensure that its data status is completely consistent with that of the original master cluster. This can avoid data loss or inconsistency after becoming the master and help to further ensure the consistency of system data.
[0128] It should be noted that, in the above embodiments, the process of determining the candidate master cluster as the new master cluster is decoupled from the modification of I / O operation permissions in terms of timing. That is to say, the change of master cluster and the modification of I / O operation permissions do not need to be strictly synchronized, but different timing coordination methods can be flexibly selected according to the actual application scenario and system architecture.
[0129] Optionally, the change of ownership cluster and the modification of I / O operation permissions can be performed synchronously. That is, the log storage service atomically completes the following two operations simultaneously: first, it identifies the candidate ownership cluster as the new ownership cluster for the second cluster group; second, it modifies the I / O operation permissions of the candidate ownership cluster from read-only or no permissions to read-write permissions, and modifies the I / O operation permissions of the original ownership cluster from read-write permissions to read-only or no permissions. In this method, the ownership change and permission modification are completed within the same transaction, resulting in the shortest switchover time, making it suitable for scenarios with high switchover speed requirements.
[0130] Optionally, the change of ownership cluster and the modification of I / O operation permissions can be performed sequentially. That is, the log storage service first identifies the candidate ownership cluster as the new ownership cluster in the second cluster group. After the ownership change is completed, the I / O operation permissions of each cluster in the access control list are then modified. In this approach, because the ownership change and permission modification are sequential, the intermediate states of the entire switchover process are clearly traceable, making it suitable for scenarios where the system needs to strictly record the switchover process for subsequent auditing or troubleshooting. During the time window after the ownership change is completed but before the permission modification is finished, the new ownership cluster does not yet have actual read / write permissions, but it already has the legitimate identity to initiate permission modification requests. Therefore, there will be no contention for permissions among multiple clusters simultaneously.
[0131] Optionally, changes to the owner cluster and modifications to I / O operation permissions can be implemented using a pre-configuration approach. This involves the log storage service first modifying the I / O operation permissions of the candidate owner cluster to read and write permissions, but at this point, the candidate owner cluster has not yet been officially designated as the new owner cluster. In other words, although the candidate owner cluster has read and write permissions, it has not yet obtained owner status, and its permission modification requests will be rejected by the log storage service, thus having no actual impact on the permission configuration process. After the permission modification is completed, the log storage service then designates the candidate owner cluster as the new owner cluster for the second cluster group. In this approach, permission configuration is completed before owner confirmation, and once the owner change takes effect, the new owner cluster immediately has read and write permissions, eliminating the need to wait for the time-consuming permission modification operation. This is suitable for scenarios where business write operations need to be resumed immediately after the owner change takes effect.
[0132] Regardless of which timing method is used, the final state is consistent: the new owner cluster has read and write permissions, and the original owner cluster is downgraded to read-only permissions or no permissions. The determinism of the unique owner and the uniqueness of the entity modifying permissions are both guaranteed.
[0133] In an optional embodiment, the I / O permission management method further includes: determining, upon detecting a failure in any master cluster, that a primary / standby relationship change has occurred in the second cluster group to which the master cluster belongs. In this embodiment, controlling the candidate master cluster to read the difference logs of the second cluster group from the log storage service includes: sending a promotion notification to the candidate master cluster to control the candidate master cluster to read the difference logs of the second cluster group from the log storage service.
[0134] Specifically, the shared storage service can perform status checks on the master clusters of each cluster group it serves, and determine the master-slave relationship change of the second cluster group to which the master cluster belongs if a failure is detected in any master cluster.
[0135] Optionally, the log storage service receives fault notifications from an external management component, which indicates a failure in a specific master cluster. This external management component could be, for example, a cluster management platform, an arbitration component, or a monitoring component.
[0136] Optionally, the log storage service can establish heartbeat connections with each master cluster to actively detect the operational status of each master cluster through the heartbeat mechanism. When the log storage service does not receive a heartbeat response from a master cluster within several consecutive heartbeat cycles, it is determined that the master cluster has failed.
[0137] After determining that a master-slave relationship change has occurred in the second cluster group, the log storage service can send a promotion notification to the candidate master cluster. This promotion notification instructs the candidate master cluster to initiate the promotion process, which involves reading and replaying the difference logs of the second cluster group from the log storage service.
[0138] Optionally, the promotion notification may include at least one of the following: the group identifier of the second cluster group and the access address of the log storage service. After receiving the promotion notification, the candidate master cluster initiates a log retrieval request to the log storage service based on the information carried in the promotion notification to obtain the difference logs.
[0139] The candidate master cluster is also used to report its own cluster information to the log storage service. Specifically, after receiving the promotion notification, the candidate master cluster reports its own cluster information to the log storage service at any time before, during, or after starting to read the difference logs. This cluster information is used to modify the candidate master cluster's I / O operation permissions.
[0140] Optionally, once the candidate master cluster is ready, it can send cluster information to the log storage service, thereby triggering a permission modification. "Ready" can mean that the candidate master cluster has completed reading and replaying the difference logs, its data state is completely consistent with the original master cluster, and it meets the conditions for becoming the new master.
[0141] In the above embodiments, explicitly triggering the candidate master cluster to initiate the master promotion process via a master promotion notification enables the candidate master cluster to immediately start the difference log reading and replay process upon receiving the notification. This avoids the delay caused by periodic polling of permission change events and helps shorten the response time for disaster recovery failover. Modifying the I / O operation permissions of the candidate master cluster based on the cluster information provided by the candidate master cluster allows the timing of permission modification to be determined by the actual master promotion progress of the candidate master cluster, thus improving the reliability of permission changes.
[0142] In an optional embodiment, the master cluster includes master nodes and slave nodes. In this embodiment, the I / O permission management method further includes: establishing heartbeat connections with the master nodes of each master cluster; if a target master node among the master nodes has a missing heartbeat for N consecutive heartbeat cycles, then entering a waiting window; within the waiting window, if a heartbeat is received from any node in the target master cluster to which the target master node belongs, then it is determined that the master-slave relationship of the target cluster group to which the target master cluster belongs has not changed; if no heartbeat is received from the target master cluster by the end of the waiting window, then it is determined that the master-slave relationship of the target cluster group has changed.
[0143] Specifically, the log storage service monitors the health status of the master nodes in each master cluster group through heartbeat connections. The heartbeat connection can be established in two ways: the log storage service acts as a server listening on the heartbeat port, and the master nodes in each master cluster act as clients periodically sending heartbeat messages to the log storage service; or, the log storage service acts as a client actively sending heartbeat probe messages to the master nodes in each master cluster periodically and waiting for a heartbeat response from the master nodes. This application embodiment does not limit the method or direction of establishing the heartbeat connection.
[0144] N is a natural number. For example, N can be 2 or 3. When the log storage service does not receive a heartbeat from the target master node for N consecutive heartbeat cycles, it determines that the target master node may be abnormal and enters a waiting window.
[0145] Optionally, the value of N can be configured according to the actual system requirements. For systems that are highly sensitive to faults, N can be set to a smaller value (e.g., N=1 or N=2) to detect potential faults more quickly; for systems that have a lower tolerance for false positives, N can be set to a larger value (e.g., N=5 or N=6) to avoid triggering unnecessary waiting processes due to transient anomalies such as network jitter.
[0146] If, after entering the waiting window, the log storage service receives a new heartbeat from the target master node within the waiting window, it indicates that the missing heartbeat from the target master node was a temporary failure (such as a brief process restart or a momentary network fluctuation). The target master cluster as a whole remains healthy, and the master-slave relationship of its cluster group has not changed. In this case, the log storage service does not need to trigger a change in the master cluster, thus avoiding unnecessary failover due to a momentary failure of the master node.
[0147] After entering the waiting window, if the log storage service does not receive a heartbeat from the target master node within the waiting window, but receives heartbeats from other nodes (such as slave nodes) in the target master cluster, it indicates that a master-slave failover has occurred within the target master cluster. That is, after the original master node failed, a slave node was promoted to the new master node. At this time, the target master cluster as a whole is still alive, and the master-slave relationship of its cluster group has not changed. The log storage service does not need to trigger a change of master cluster at the cluster group level; it only needs to record the master-slave failover information within the target master cluster so that it can maintain a heartbeat connection with the new master node of that master cluster in the future.
[0148] If the log storage service does not receive a heartbeat from any node in the target master cluster by the end of the waiting window, it indicates that the entire target master cluster has failed (e.g., all nodes in the cluster are down or the network is completely isolated), and the target master cluster can no longer provide services. At this time, the log storage service determines that the master-slave relationship of the target cluster group to which the target master cluster belongs has changed, and the subsequent master promotion process needs to be triggered, that is, the disaster recovery cluster in the target cluster group is promoted to the new master cluster to take over the services of the original master cluster.
[0149] In the above embodiments, a waiting window mechanism is used to monitor whether a heartbeat is received from any node in the target master cluster within the waiting window. If a heartbeat is received, it indicates that the target master cluster is alive as a whole, and there is no need to trigger a cluster-level master-slave switchover. If no heartbeat is received by the end of the waiting window, it indicates that the target master cluster has failed, and only then is a cluster-level master-slave switchover triggered. This hierarchical fault determination mechanism effectively avoids unnecessary cluster-level disaster recovery switches triggered by temporary failures of master nodes or master-slave failover within the cluster, reducing system jitter and further improving system stability.
[0150] In an optional embodiment, when the log storage service is restarted after being interrupted due to an anomaly, each owner cluster can detect the restart of the log storage service and resend the owner information to the log storage service so that the log storage service can quickly restore the owner status of each cluster group.
[0151] Specifically, the log storage service establishes a two-way heartbeat connection with each master cluster. The log storage service periodically sends heartbeat probe messages to each master cluster, and each master cluster also periodically sends heartbeat response messages to the log storage service. When the log storage service is interrupted and restarted, the log storage service broadcasts a service restart notification to all registered cluster groups after startup. This notification informs each master cluster that the log storage service has resumed normal operation.
[0152] Upon receiving a service restart notification or detecting the recovery of the log storage service through its own heartbeat mechanism, each owner cluster proactively re-reports its owner information to the log storage service. Owner information includes: cluster group identifier, owner identifier, and version number. Each owner cluster already has its own owner information cached locally during normal operation; therefore, upon detecting a log storage service restart, it can directly send the cached owner information to the log storage service without waiting for manual configuration by the administrator or notification from other clusters.
[0153] After receiving owner information reported by each owner cluster, the log storage service restores the owner status of the corresponding cluster group based on the cluster group identifier and owner identifier in the owner information. That is, the received owner information is stored in the metadata area of the log storage service, and the version number and timestamp of the owner information are recorded. In this way, the owner status of each cluster group in the log storage service can be quickly restored.
[0154] Optionally, if the owner cluster of a cluster group also fails or changes during the log storage service outage, the owner cluster of that cluster group may be unable to report owner information normally. In this case, the disaster recovery cluster in that cluster group can report its own cluster information to the log storage service as a candidate owner cluster after detecting the owner cluster failure. The log storage service will then re-determine the owner status of the cluster group based on this cluster information.
[0155] In an optional embodiment, the cluster information of the owner cluster includes an owner identifier and a version number; the version number increments when the owner cluster changes. In this embodiment, as... Figure 6 As shown, step 308 includes steps 602 to 606. Wherein:
[0156] Step 602: If the I / O request is a permission modification request for the first cluster group, obtain the initiating cluster information carried in the request.
[0157] In this context, a permission modification request refers to a request used to modify the I / O operation permissions held by at least one cluster in the first cluster group in the log storage service. The permission modification request is initiated by a node, and the cluster to which that node belongs is the initiating cluster. The permission modification request carries initiating cluster information, which identifies the identity and ownership status of the cluster that initiated the permission modification request.
[0158] Optionally, the initiating cluster information includes at least one of the following fields: cluster identifier (used to uniquely identify the initiating cluster), owner identifier (used to indicate whether the initiating cluster has declared itself as the owner cluster), and version number (used to identify the version of the owner information held by the initiating cluster). The log storage service extracts the above-mentioned initiating cluster information from the received permission modification request for subsequent permission verification.
[0159] Optionally, when the log storage service performs a master cluster switch in response to a change in the master-slave relationship, it increments the version number of the master information by 1 and stores the new master identifier and the new version number together to achieve version number increment.
[0160] Step 604: If the initiator cluster information contains the owner identifier and the version number in the initiator cluster information is consistent with the current version number of the first cluster group, the decision result of the I / O request is determined to be a successful decision.
[0161] The owner identifier is used to indicate that the initiating cluster declares itself as the owner cluster. If the initiating cluster information contains the owner identifier, it means that the initiating cluster has declared itself as the owner; if it does not contain the owner identifier, it means that the initiating cluster has not declared itself as the owner cluster and is not qualified to modify it.
[0162] The log storage service locally stores the current version number of the first cluster group. This current version number records the version information of the first cluster group at the time of the most recent change of ownership. When the log storage service receives a permission modification request, it compares the version number in the initiating cluster information with the currently stored version number. If they match, it means that the initiating cluster holds the latest version of the ownership information; if they do not match, it means that the initiating cluster holds the expired ownership information, and its permission modification request should not be allowed.
[0163] Typical scenarios involving inconsistent version numbers include: after a network partition is restored, the original owner cluster re-initiates a permission modification request with an expired version number; or, due to a system anomaly, owner information fails to synchronize in a timely manner. The log storage service rejects such permission modification requests to prevent the misuse of expired owner information and subsequent permission modification errors.
[0164] If the initiating cluster information contains an owner identifier and its version number matches the current version number of the first cluster group, the log storage service determines that the permission modification request has been approved. At this point, the log storage service allows the execution of I / O operations matching the permission modification request and updates the I / O operation permissions of the corresponding cluster in the first cluster group according to the specific modifications in the permission modification request.
[0165] Step 606: If the initiator cluster information does not contain the owner identifier, or the version number in the initiator cluster information is inconsistent with the current version number of the first cluster group, determine that the I / O request decision is unsuccessful.
[0166] If the initiating cluster information does not contain the owner identifier, or if the version number in the initiating cluster information is inconsistent with the current version number of the first cluster group, the log storage service determines that the permission modification request is rejected and refuses to execute the I / O operation matching the permission modification request.
[0167] Optionally, if the version number in the request is less than the current version number, it indicates that the owner information held by the request initiator has expired, belonging to an old node recovered after the network partition, and its permission modification request should be rejected. If the version number in the request is greater than the current version number, it indicates that the owner information of the log storage service may be outdated due to an anomaly. In this case, the log storage service can proactively initiate an owner information synchronization request to the owner cluster to obtain the latest owner information and then re-verify it.
[0168] Optionally, the log storage service can return a permission denial response to the initiating cluster. This permission denial response indicates that the initiating cluster does not have permission to modify the I / O operation permissions of the first cluster group.
[0169] Optionally, along with returning a permission denial response, the log storage service can also return a reason for the denial. This reason indicates the specific reason why the decision failed. By returning a specific reason for denial, the initiating cluster can promptly understand why the permission modification request was rejected, facilitating appropriate error handling and subsequent operations.
[0170] In the above embodiments, by performing dual verification of the owner identifier and version number, the uniqueness of the subject modifying I / O permissions can be ensured. This effectively avoids the problem of permissions being incorrectly modified due to erroneous operations initiated by expired nodes in abnormal scenarios such as network partitioning and node restarts, thereby improving the security and reliability of I / O permission management.
[0171] In an optional embodiment, determining a unique owner cluster from the cluster group based on the master-slave relationship includes: maintaining an access control list corresponding to the cluster group in the log storage service based on the master-slave relationship, so as to determine a unique owner cluster from the cluster group, as well as disaster recovery clusters other than the owner cluster.
[0172] The log storage service can store the individual Access Control Lists (ACLs) for each cluster group. These ACLs record the I / O operation permissions of each cluster within the group. Specifically, ACLs are maintained at the cluster group level; each cluster group corresponds to an independent ACL, and the ACLs of different cluster groups are isolated and do not affect each other. Each ACL contains at least one permission entry, and each permission entry records the cluster identifier and its corresponding I / O operation permissions. For example, for cluster group A, its corresponding ACL might record the following permission entries: Cluster A1 (master cluster) → read / write permissions; Cluster A2 (disaster recovery cluster) → read-only permissions. The ACLs are stored in the log storage service's metadata area and persistently maintained to ensure that the permission information of each cluster group can be restored after the log storage service restarts.
[0173] Specifically, the log storage service can identify the primary cluster in the primary-standby relationship as the master cluster and assign read and write permissions to the master cluster in the access control list; and identify the disaster recovery cluster in the primary-standby relationship as the non-master cluster and assign read-only permissions to the disaster recovery cluster in the access control list.
[0174] Optionally, permission entries in the access control list can be dynamically updated.
[0175] For example, when the primary / standby relationship of a cluster group changes, the log storage service responds by updating the permission entries in the access control list accordingly. By dynamically updating the access control list, the log storage service can ensure that the permission information recorded in the access control list is consistent with the current primary / standby relationship of the cluster group in real time, avoiding decision errors caused by outdated permission information.
[0176] In practical applications, separate permission entries can be maintained for each cluster within a cluster group to achieve fine-grained permission management for each cluster in that group. For example... Figure 7 In this configuration, cluster A has read and write permissions, cluster A' has read permissions only, and cluster A'' has neither read nor write permissions.
[0177] In an exemplary embodiment, when the log storage service receives an I / O request initiated by a node and determines the first cluster group to which the node belongs, the log storage service uses the cluster identifier of the cluster to which the node belongs as an index to query the access control list corresponding to the first cluster group and obtain the I / O operation permissions corresponding to that cluster. Then, the obtained permissions are matched and verified with the target operation type of the I / O request to generate a decision result.
[0178] Optionally, access control list (ACCL) modification permissions belong only to the owner cluster. Specifically, the log storage service only accepts permission modification requests from the owner cluster; it rejects permission modification requests initiated by non-owner clusters. By restricting ACCL modification permissions to the owner cluster, the uniqueness of the subject modifying the ACCL is ensured, avoiding permission contention and state inconsistencies caused by multiple clusters simultaneously modifying the ACCL.
[0179] In the above embodiments, the I / O operation permissions of each cluster are independently recorded at the cluster group level through the access control list, and the master cluster has exclusive access to modify the access control list. This enables centralized management of permission information and allows for permission groups for multiple clusters, which further improves the controllability and security of permission changes.
[0180] In an optional embodiment, the log storage service includes log storage service instances deployed across multiple regions. In this embodiment, the I / O permission management method further includes: if a change of ownership occurs in any cluster group, and the first region where the current ownership cluster of the cluster group is located is different from the second region where the original ownership cluster of the cluster group was located, switching the log write operation of the cluster group from the log storage service instance in the second region to the log storage service instance in the first region.
[0181] Specifically, log storage services can be deployed across regions, meaning independent log storage service instances can be deployed in different regions. Each region's log storage service instance serves the cluster within that region—meaning clusters within that region can write logs to their local log storage service instance and also read logs from their local log storage service instance for replay. Through cross-region deployment, when the log storage service instance and the cluster are in the same region, network latency between the cluster and the log storage service instance is minimized, resulting in optimal write performance. When the cluster is deployed across multiple regions, clusters in different regions can write logs to their respective region's log storage service instance, achieving localized writing and avoiding cross-regional network latency overhead. Figure 8 As shown, cluster A, as the primary cluster, is deployed in the same region as the log storage service, while cluster A', as the disaster recovery cluster, is deployed in another region.
[0182] Optionally, log storage service instances in different regions can maintain data synchronization through an asynchronous replication mechanism. Specifically, after log data is written to the log storage service instance in the first region, that instance asynchronously replicates the newly written log data to log storage service instances in other regions, so that the log storage service instances in other regions eventually have complete or nearly complete copies of the log data. Asynchronous replication ensures that in the event of a region-level failure, log storage service instances in other regions still retain usable log data, providing a data foundation for cross-region disaster recovery while avoiding the write latency overhead of synchronous replication.
[0183] In its implementation, when the log storage service detects a change in the ownership of a cluster group, it further determines whether the first region where the current ownership cluster is located is the same as the second region where the original ownership cluster was located. If they are the same (i.e., the clusters before and after the ownership change are in the same region), the log storage service does not need to switch the region for log write operations; the new ownership cluster can continue writing to the log storage service instance in the current region. If they are different (i.e., the clusters before and after the ownership change are in different regions, belonging to a disaster recovery and upgrade scenario), the log storage service switches the log write operation from the log storage service instance in the second region to the log storage service instance in the first region.
[0184] like Figure 9 As shown, when cluster A is downgraded to a disaster recovery cluster and cluster A' is upgraded to a master cluster, the new master cluster A' no longer writes logs to the log storage service instance 901 in the original region, but instead switches to the log storage service instance 902 in the current region for log writing. The dashed arrows represent the original log writing path, and the solid arrows represent the new log writing path.
[0185] In the above embodiments, through the regional switching mechanism, the new master cluster can write to the log storage service instance in the current region, avoiding the increased network latency and bandwidth consumption caused by cross-region writing, which helps to shorten the service recovery time after the master is promoted, thereby improving the stability of the system.
[0186] In one embodiment, such as Figure 10 As shown, this application also provides another I / O permission management method applied to a log storage service, which serves multiple cluster groups. In this embodiment, the I / O permission management method includes the following steps:
[0187] Step 1001: For each cluster group, obtain the primary / standby relationship between multiple clusters in that cluster group;
[0188] Each cluster includes at least one node; in the case of multiple nodes, these nodes may include master nodes and slave nodes.
[0189] Step 1002: Based on the primary-backup relationship, maintain the access control list corresponding to the cluster group in the log storage service to identify the unique owner cluster and the disaster recovery cluster other than the owner cluster from the cluster group.
[0190] The access control list is used to record the I / O operation permissions of the master cluster and each disaster recovery cluster in the same cluster group. The master cluster has the right to modify the I / O operation permissions of each cluster in the same cluster group in the log storage service. The master cluster in any cluster group writes logs in the log storage service and synchronizes the logs to the disaster recovery clusters in the same cluster group.
[0191] Step 1003: Establish heartbeat connections with the master nodes of each master cluster;
[0192] Step 1004: If there is a target master node among the master nodes that has missing heartbeats for N consecutive heartbeat cycles, then enter the waiting window;
[0193] Wherein, the target master node belongs to the target master cluster; N is a natural number;
[0194] Step 1005: If a heartbeat is received from any node in the target master cluster within the waiting window, it is determined that the target master cluster as a whole is alive and has not experienced a failure.
[0195] Optionally, if a heartbeat is received from the target master node within the waiting window, it is determined that the target master cluster as a whole is still alive and has not failed; if no heartbeat is received from the target master node, but heartbeats are received from other nodes in the target master cluster besides the target master node, it is determined that a master-slave switchover has occurred within the target master cluster, but the target master cluster as a whole is alive.
[0196] Step 1006: If no heartbeat is received from the target master cluster before the waiting window ends, it is determined that the target master cluster as a whole has failed.
[0197] Step 1007: Determine if the primary / standby relationship of the target cluster group has changed;
[0198] Step 1008: Downgrade the owner cluster of the target cluster group to a disaster recovery cluster, and determine the candidate owner cluster from the disaster recovery clusters of the target cluster group.
[0199] Step 1009: Send a notification to the candidate master cluster to promote it to a higher master, so as to control the candidate master cluster to read the difference logs of the target cluster group from the log storage service and replay them.
[0200] Step 1010: Obtain the cluster information sent by the candidate master cluster, and maintain the access control list of the target master cluster based on the cluster information;
[0201] Among them, the candidate master cluster can report its own cluster information to the log storage service after completing the replay of the difference log;
[0202] Step 1011: After the difference log replay is completed and the access control list is updated, the candidate owner cluster is taken as the new owner cluster of the target cluster group.
[0203] Step 1012: Upon receiving an I / O request initiated by any node, determine the first cluster group to which the node belongs from at least one cluster group;
[0204] Step 1013: Determine the request type of the I / O request; if the request type is a permission modification request for the first cluster group, proceed to steps 1014 to 1016; if the request type is a read / write request, proceed to steps 1017 to 1018.
[0205] Step 1014: Obtain the initiator cluster information carried in the request;
[0206] Step 1015: Determine whether the initiator's cluster information contains the owner identifier; if yes, proceed to step 1016; if no, proceed to step 1020.
[0207] Step 1016: Determine whether the version number in the initiator's cluster information is consistent with the current version number of the first cluster group; if yes, proceed to step 1019; if no, proceed to step 1020.
[0208] Step 1017: Obtain the I / O operation permissions that the node's cluster has in the first cluster group;
[0209] Step 1018: Determine whether the I / O operation permission matches the expected operation type of the I / O request; if yes, proceed to step 1019; if no, proceed to step 1020.
[0210] Step 1019: Determine the outcome of the I / O request as approved;
[0211] Step 1020: Determine the outcome of the I / O request as a rejection.
[0212] If the decision passes, the I / O operation matching the I / O request is executed; if the decision fails, the I / O operation matching the I / O request is refused.
[0213] The above-described I / O access control method, through the coordinated operation of the fence owner uniqueness control mechanism and the I / O adjudication unit, can achieve the following technical effects:
[0214] (i) By using a fence ownership uniqueness control mechanism, permission conflicts can be avoided and the risk of data corruption can be reduced.
[0215] In this application, the log storage service determines a unique owner cluster from each cluster group based on the master-slave relationship. Only this owner cluster has the authority to modify I / O operation permissions. In scenarios where multiple clusters share storage, when a network partition or link anomaly occurs, different clusters may simultaneously believe they still have write permissions to the shared storage. In traditional solutions, multiple clusters may simultaneously modify I / O fence permissions, leading to permission contention and mutual overwriting, resulting in unstable permission states, disordered switching processes, and ultimately potentially compromising access control consistency and the risk of data corruption. This application, by introducing a unique fence owner, ensures the uniqueness and determinism of the source of I / O fence permission modification. That is, at any given time, only the owner cluster explicitly designated by the log storage service has the authority to initiate permission modification operations; non-owner clusters have no right to modify I / O operation permissions. This uniqueness control mechanism fundamentally avoids permission conflicts caused by multiple clusters simultaneously modifying I / O permissions, ensuring the uniqueness and consistency of the source of I / O fence permissions and significantly reducing the risk of data corruption due to write permission contention.
[0216] (ii) By using the I / O arbitration unit, unauthorized writes are blocked immediately to ensure the legitimacy of write operations.
[0217] In this application, before responding to an I / O request initiated by a node, the log storage service first adjudicates the I / O operation permissions of the node's cluster within its cluster group. Only I / O requests that pass the adjudication are allowed to execute. Building upon the fenced owner uniqueness control mechanism that determines "who has the right to modify permissions," the I / O adjudication unit further implements fine-grained control over "who has the permission to execute operations." Unauthorized writes by unauthorized clusters can be immediately blocked by the log storage service at the initiation stage, preventing any actual data from being written. Through this dual mechanism of "owner decision-making + permission execution," this application ensures that write operations are always executed by clusters with legitimate permissions. Permission information is centrally managed and kept consistent throughout the system, effectively preventing unauthorized writes by unauthorized clusters.
[0218] The technical solutions provided in this application are not only applicable to database disaster recovery cluster scenarios, but can also be extended to any distributed system that requires access control of shared resources across multiple clusters, including but not limited to distributed file systems, cloud storage platforms, virtualization platforms, and multi-active data centers.
[0219] For example, in a distributed file system, when multiple computing nodes share the same storage pool, the technical solution of this application can be used to achieve unique control over write permissions; in a cloud storage platform, when multiple tenants or multiple clusters share the same storage backend, the technical solution of this application can be used to achieve I / O permission isolation between different tenants or clusters; in a multi-active data center scenario, when multi-active clusters in different data centers share underlying storage resources, the technical solution of this application can be used to achieve unified management and adjudication of I / O permissions across data centers.
[0220] In one exemplary embodiment, such as Figure 11 As shown, the core execution steps of this application are as follows:
[0221] ① Initialization of disaster recovery relationship establishment
[0222] This step establishes a primary / secondary disaster recovery relationship between primary cluster A and disaster recovery cluster A'. During the establishment process, both primary cluster A and disaster recovery cluster A' register their information with the log storage service. The log storage service records the primary / secondary correspondence between the two clusters, providing a foundation for subsequent I / O permission management and fence ownership management. Primary cluster A includes master and slave nodes, and disaster recovery cluster A' also includes corresponding nodes.
[0223] ② Set the owner of the cluster fence
[0224] This step, performed after the initial establishment of disaster recovery management, involves the cluster I / O fence management module in the log storage service setting the primary cluster A as the cluster fence owner. By default, primary cluster A acts as the owner cluster. By setting the fence owner to primary cluster A, requests from disaster recovery cluster A' to modify I / O permissions can be intercepted. It should be noted that modifying the fence owner only triggers in two scenarios: establishing a disaster recovery relationship and promoting a disaster recovery cluster to primary status. In other scenarios, the fence owner remains unchanged.
[0225] ③ Configure I / O permissions for the local cluster
[0226] This step involves the primary cluster A sending its identity information to the I / O permission management module in the log storage service to grant it I / O operation permissions. Simultaneously, the disaster recovery cluster A' also sends its identity information to the I / O permission management module. Based on the received identity information, the I / O permission management module records the I / O operation permissions of both the primary cluster A and the disaster recovery cluster A' in the access control list. For example, the primary cluster A has read and write permissions, while the disaster recovery cluster A' has read-only permissions. I / O requests initiated by clusters outside the local cluster will not be allowed to execute by the I / O permission management module.
[0227] ④ Trigger log writing
[0228] This step involves the primary cluster A writing its log records to the log storage service. During the process of providing read and write services, primary cluster A continuously writes the generated data change logs to the log storage service. Disaster recovery cluster A' can then replay the logs stored in the log storage service to achieve data synchronization.
[0229] ⑤ Detect the fault and notify the disaster recovery cluster to upgrade to master.
[0230] This step involves the log storage service or external management component detecting a failure in the primary cluster A and notifying the disaster recovery cluster A' to perform a promotion to primary. Specifically, the log storage service can detect the failure through a heartbeat connection with the primary node of the primary cluster A, or by receiving a failure notification from the external management component, to determine if a disaster recovery promotion to primary is necessary.
[0231] ⑥ Modify the owner of the cluster fence
[0232] This step changes the cluster fence owner from the original primary cluster A to the disaster recovery cluster A'. After the fence owner change, the original primary cluster A is isolated and no longer has the ability to preempt I / O modification permissions. Changing the fence owner is only triggered in two scenarios: establishing a disaster recovery relationship and promoting a disaster recovery cluster to primary status; this step falls into the latter category. It should be noted that the fence owner change is executed by the cluster I / O fence management module in the log storage service to ensure the uniqueness and controllability of the modification action.
[0233] ⑦ Modify I / O permissions
[0234] This step involves the I / O permission management module changing the I / O operation permissions of disaster recovery cluster A' from read-only to read-write after the fence owner is changed to disaster recovery cluster A'. Simultaneously, the I / O operation permissions of the original primary cluster A are changed from read-write to read-only or no permissions. After the modification, cluster A' will have permission to perform I / O operations (including writing to logs), while the I / O operations of the original primary cluster A will be rejected by the I / O permission management module.
[0235] ⑧ Read the difference logs to complete the replay and promote the master.
[0236] This step involves cluster A' reading and replaying the difference logs from the log storage service to complete its promotion to master. Specifically, before becoming master, cluster A' needs to pull out the unsynchronized difference logs from the log storage service and replay them one by one according to their sequence numbers to ensure its data state is consistent with that of the original master cluster A before the failure. After the difference log replay is complete, cluster A' officially becomes the new master cluster.
[0237] 9. Triggering log writing
[0238] This step involves cluster A' becoming the new master cluster and continuing to write logs to the log storage service. After the master promotion is complete, cluster A' provides read and write services, and its generated data change logs are continuously written to the log storage service for data synchronization with other disaster recovery clusters (if any). At this point, the entire disaster recovery master promotion process is complete, and the system returns to normal operation.
[0239] In the above embodiments, by integrating the I / O permission management function into the log storage service, a centralized permission decision-making mechanism replaces the traditional node-level competition mechanism, realizing unified management and dynamic adjudication of I / O permissions, and providing broader resource consistency protection capabilities for various distributed systems with multiple clusters sharing resources.
[0240] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0241] Based on the same inventive concept, this application also provides an I / O permission management device for implementing the I / O permission management method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more I / O permission management device embodiments provided below can be found in the limitations of the I / O permission management method described above, and will not be repeated here.
[0242] In one exemplary embodiment, such as Figure 12 As shown, an I / O permission management device is provided for a log storage service, which serves at least one cluster group. The device includes:
[0243] The primary / standby relationship acquisition module 1201 is used to acquire the primary / standby relationship between multiple clusters in each cluster group; each cluster includes at least one node.
[0244] The owner determination module 1202 is used to determine a unique owner cluster from the cluster group based on the master-slave relationship; the owner cluster has the right to modify the I / O operation permissions of multiple clusters in the log storage service; the owner cluster can be changed when the master-slave relationship changes.
[0245] The cluster group matching module 1203 is used to determine the first cluster group to which a node belongs from at least one cluster group when receiving an I / O request initiated by any node.
[0246] The adjudication module 1204 is used to adjudicate I / O requests based on the I / O operation permissions of the cluster to which the node belongs in the first cluster group, and obtain the adjudication result; the adjudication result is used to determine whether to execute the I / O operation that matches the I / O request.
[0247] In one embodiment, the owner cluster in any cluster group writes logs to the log storage service and synchronizes the logs to the disaster recovery cluster in the cluster group. In this embodiment, the owner determination module 1202 includes: a candidate owner selection unit, used to downgrade the owner cluster of the second cluster group to a disaster recovery cluster and determine a candidate owner cluster from the disaster recovery clusters of the second cluster group when there is a second cluster group in at least one cluster group where the master-slave relationship has changed; a log completion unit, used to control the candidate owner cluster to read the difference logs of the second cluster group from the log storage service and perform replay; and an owner update unit, used to set the candidate owner cluster as the new owner cluster of the second cluster group after the difference log replay is completed.
[0248] In one embodiment, the owner determination module 1202 further includes a primary / standby change detection unit, used to determine that a primary / standby relationship change has occurred in the second cluster group to which the owner cluster belongs when a failure of any owner cluster is detected. In this embodiment, the log completion unit is specifically used to: send a promotion notification to the candidate owner cluster to control the candidate owner cluster to read the difference logs of the second cluster group from the log storage service; the candidate owner cluster is also used to feed back its own cluster information to the log storage service; the cluster information is used to modify the I / O operation permissions of the candidate owner cluster.
[0249] In one embodiment, the master cluster includes master nodes and slave nodes. In this embodiment, the master determination module 1202 includes a master-slave change detection unit, used to: establish heartbeat connections with the master nodes of each master cluster; if there is a target master node among the master nodes that has missed heartbeats for N consecutive heartbeat cycles, then enter a waiting window; the target master node belongs to the target master cluster; N is a natural number; within the waiting window, if a heartbeat is received from any node in the target master cluster, then it is determined that the master-slave relationship of the target cluster group to which the target master cluster belongs has not changed; if no heartbeat is received from the target master cluster at the end of the waiting window, then it is determined that the master-slave relationship of the target cluster group has changed.
[0250] In one embodiment, the cluster information of the owner cluster includes an owner identifier and a version number; the version number increments when the owner cluster changes. In this embodiment, the adjudication module 1204 is specifically used to: when the I / O request is a permission modification request for the first cluster group, obtain the initiating cluster information carried in the request; if the initiating cluster information includes an owner identifier and the version number in the initiating cluster information is consistent with the current version number of the first cluster group, determine that the adjudication result of the I / O request is adjudicated as adjudicated; if the initiating cluster information does not include an owner identifier, or the version number in the initiating cluster information is inconsistent with the current version number of the first cluster group, determine that the adjudication result of the I / O request is adjudicated as adjudicated as adjudicated.
[0251] In one embodiment, the owner determination module 1202 is specifically used to: maintain the access control list corresponding to the cluster group in the log storage service based on the master-slave relationship, so as to determine the unique owner cluster and the disaster recovery cluster other than the owner cluster from the cluster group; the access control list is used to record the I / O operation permissions of the owner cluster and each disaster recovery cluster.
[0252] In one embodiment, the log storage service includes log storage service instances deployed in multiple regions. In this embodiment, the I / O permission management device further includes an instance switching module, configured to switch the log write operation of the cluster group from the log storage service instance in the second region to the log storage service instance in the first region when any cluster group experiences a change in its owner cluster and the first region where the current owner cluster of the cluster group is located differs from the second region where the original owner cluster of the cluster group was located.
[0253] Each module in the aforementioned I / O access control device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0254] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 13 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data involved in the implementation of the aforementioned methods. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements an I / O access control method.
[0255] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 14 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements an I / O access control method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0256] Those skilled in the art will understand that Figure 13 or Figure 14 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.
[0257] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0258] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.
[0259] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0260] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0261] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0262] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for I / O access control, characterized in that, Applied to a log storage service for serving at least one cluster group, the method includes: For each of the cluster groups, the primary / standby relationship between multiple clusters in the cluster group is obtained; each of the clusters includes at least one node; Based on the primary / standby relationship, a unique master cluster is determined from the cluster group; the master cluster has the authority to modify the I / O operation permissions of each of the multiple clusters in the log storage service; the master cluster can be changed if the primary / standby relationship changes. Upon receiving an I / O request initiated by any of the nodes, determine the first cluster group to which the node belongs from the at least one cluster group; Based on the I / O operation permissions of the cluster to which the node belongs in the first cluster group, the I / O request is adjudicated to obtain an adjudication result; the adjudication result is used to determine whether to execute an I / O operation that matches the I / O request.
2. The method according to claim 1, characterized in that, The owner cluster in any of the cluster groups writes logs to the log storage service and synchronizes the logs to the disaster recovery cluster in the cluster group. The method further includes: In the case where there is a second cluster group in the at least one cluster group where the master-slave relationship has changed, the master cluster of the second cluster group is downgraded to a disaster recovery cluster, and a candidate master cluster is determined from the disaster recovery cluster of the second cluster group. The candidate owner cluster is controlled to read the difference logs of the second cluster group from the log storage service and replay them; Once the difference log replay is complete, the candidate owner cluster will be designated as the new owner cluster for the second cluster group.
3. The method according to claim 2, characterized in that, The method further includes: If a failure is detected in any of the master clusters, it is determined that a change in the master-slave relationship has occurred in the second cluster group to which the master cluster belongs; The step of controlling the candidate master cluster to read the difference logs of the second cluster group from the log storage service includes: Send a promotion notification to the candidate master cluster to control the candidate master cluster to read the difference logs of the second cluster group from the log storage service; The candidate owner cluster is also used to report its own cluster information to the log storage service; the cluster information is used to modify the I / O operation permissions of the candidate owner cluster.
4. The method according to any one of claims 1 to 3, characterized in that, The master-slave cluster includes master nodes and slave nodes; the method further includes: Establish heartbeat connections with the master nodes of each of the aforementioned master clusters; If any of the aforementioned master nodes has a target master node that has missed heartbeats for N consecutive heartbeat cycles, then a waiting window is entered; the target master node belongs to the target master cluster; N is a natural number; If a heartbeat is received from any node in the target master cluster within the waiting window, it is determined that the master-slave relationship of the target cluster group to which the target master cluster belongs has not changed. If no heartbeat is received from the target master cluster by the end of the waiting window, it is determined that the master-slave relationship of the target cluster group has changed.
5. The method according to any one of claims 1 to 3, characterized in that, The cluster information of the owner cluster includes the owner identifier and version number; the version number increments when the owner cluster changes. The step of adjudicating the I / O request based on the I / O operation permissions of the node's cluster in the first cluster group, and obtaining the adjudication result, includes: If the I / O request is a permission modification request for the first cluster group, obtain the initiating cluster information carried in the request; If the initiator cluster information contains an owner identifier and the version number in the initiator cluster information is consistent with the current version number of the first cluster group, the decision result of the I / O request is determined to be a successful decision. If the initiator cluster information does not contain an owner identifier, or if the version number in the initiator cluster information is inconsistent with the current version number of the first cluster group, the decision result of the I / O request is determined to be a failure.
6. The method according to any one of claims 1 to 3, characterized in that, The step of determining a unique master cluster from the cluster group based on the master-slave relationship includes: Based on the primary-backup relationship, maintain the access control list corresponding to the cluster group in the log storage service, so as to determine the unique owner cluster and the disaster recovery cluster other than the owner cluster from the cluster group. The access control list is used to record the I / O operation permissions of the master cluster and each of the disaster recovery clusters.
7. The method according to any one of claims 1 to 3, characterized in that, The log storage service includes log storage service instances deployed in multiple regions; The method further includes: If any of the cluster groups undergoes a change of ownership cluster, and the first region where the current ownership cluster of the cluster group is located is different from the second region where the original ownership cluster of the cluster group is located, the log writing operation of the cluster group will be switched from the log storage service instance in the second region to the log storage service instance in the first region.
8. An I / O access control device, characterized in that, Applied to a log storage service, the log storage service being used to serve at least one cluster group, the apparatus includes: The primary / standby relationship acquisition module is used to acquire the primary / standby relationship between multiple clusters in each of the cluster groups; each of the clusters includes at least one node; The owner determination module is used to determine a unique owner cluster from the cluster group based on the master-slave relationship; the owner cluster has the right to modify the I / O operation permissions of each of the multiple clusters in the log storage service; the owner cluster can be changed if the master-slave relationship changes. The cluster group matching module is used to determine the first cluster group to which the node belongs from the at least one cluster group when receiving an I / O request initiated by any of the nodes. The adjudication module is used to adjudicate the I / O request based on the I / O operation permissions of the cluster to which the node belongs in the first cluster group, and obtain an adjudication result; the adjudication result is used to determine whether to execute an I / O operation that matches the I / O request.
9. The apparatus according to claim 8, characterized in that, The owner cluster in any of the cluster groups writes logs to the log storage service and synchronizes the logs to the disaster recovery cluster in the cluster group. The owner determination module includes: The candidate owner selection unit is used to downgrade the owner cluster of the second cluster group to a disaster recovery cluster when there is a second cluster group in the at least one cluster group where the master-slave relationship has changed, and to determine the candidate owner cluster from the disaster recovery cluster of the second cluster group. The log completion unit is used to control the candidate owner cluster to read the difference logs of the second cluster group from the log storage service and replay them. The owner update unit is used to designate the candidate owner cluster as the new owner cluster of the second cluster group after the difference log replay is completed.
10. The apparatus according to claim 9, characterized in that, The owner determination module also includes: The primary / standby change detection unit is used to determine, in the event that any of the primary clusters fails, that a primary / standby relationship change has occurred in the second cluster group to which the primary cluster belongs. The log completion unit is specifically used for: A notification to promote a candidate master cluster is sent to control the candidate master cluster to read the difference logs of the second cluster group from the log storage service; the candidate master cluster is also used to report its own cluster information to the log storage service; the cluster information is used to modify the I / O operation permissions of the candidate master cluster.
11. The apparatus according to any one of claims 8 to 10, characterized in that, The owner cluster includes master nodes and slave nodes; the owner determination module includes a master-slave change detection unit, used for: Establish heartbeat connections with the master nodes of each of the aforementioned master clusters; If any of the aforementioned master nodes has a target master node that has missed heartbeats for N consecutive heartbeat cycles, then a waiting window is entered; the target master node belongs to the target master cluster; N is a natural number; If a heartbeat is received from any node in the target master cluster within the waiting window, it is determined that the master-slave relationship of the target cluster group to which the target master cluster belongs has not changed. If no heartbeat is received from the target master cluster by the end of the waiting window, it is determined that the master-slave relationship of the target cluster group has changed.
12. The apparatus according to any one of claims 8 to 10, characterized in that, The cluster information of the owner cluster includes the owner identifier and version number; the version number increments when the owner cluster changes. The adjudication module is specifically used for: If the I / O request is a permission modification request for the first cluster group, obtain the initiating cluster information carried in the request; If the initiator cluster information contains an owner identifier and the version number in the initiator cluster information is consistent with the current version number of the first cluster group, the decision result of the I / O request is determined to be a successful decision. If the initiator cluster information does not contain an owner identifier, or if the version number in the initiator cluster information is inconsistent with the current version number of the first cluster group, the decision result of the I / O request is determined to be a failure.
13. The apparatus according to any one of claims 8 to 10, characterized in that, The owner determination module is specifically used for: Based on the primary-backup relationship, maintain the access control list corresponding to the cluster group in the log storage service, so as to determine the unique owner cluster and the disaster recovery cluster other than the owner cluster from the cluster group. The access control list is used to record the I / O operation permissions of the master cluster and each of the disaster recovery clusters.
14. The apparatus according to any one of claims 8 to 10, characterized in that, The log storage service includes log storage service instances deployed in multiple regions; The device further includes: The instance switching module is used to switch the log writing operation of the cluster group from the log storage service instance in the second region to the log storage service instance in the first region when any of the cluster groups undergoes a change of ownership cluster and the first region where the current ownership cluster of the cluster group is located is different from the second region where the original ownership cluster of the cluster group is located.
15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
