Storage dynamic mounting method and device
By implementing the method of dynamically mounting cloud disks in a database cluster, the problem of wasted storage resources during database failover is solved, and more efficient storage resource utilization is achieved.
Patent Information
- Application Number
- CN202410095065.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-10-13
- Filing Date
- 2024-01-23
- Publication Date
- 2025-04-15
AI Technical Summary
When implementing database failover, two backup nodes are required to mount cloud disks at the same time, resulting in redundancy of computing and storage resources and waste of storage resources.
Through the dynamic mount method, the database nodes in the database cluster allow dynamic mounts of cloud disks to different database nodes, avoiding the cloud disks at the same time on two standby nodes, thereby reducing the use of storage resources.
While ensuring the availability of database clusters, the use of storage resources is reduced and the utilization rate of storage resources is improved.
Smart Images

Figure CN119829327A_ABST
Abstract
Description
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on October 13, 2023, with application number 202311334484.9 and invention name “A data processing method, device and computing device cluster”, all contents of which are incorporated by reference in this application. Technical Field
[0002] The embodiments of the present application relate to the computer field, and in particular to a storage dynamic mounting method and device. Background Art
[0003] Database availability refers to the ability of the database system to remain available in the event of a failure or abnormality, thereby ensuring continuous business operation. In order to improve database availability, failover is an important mechanism in the availability solution, which is used to automatically switch to the standby database node when the primary database node fails, so as to achieve imperceptible failover.
[0004] In the current database availability solution, the database cluster is usually built based on the share-nothing architecture. The data in the database cluster is distributed on multiple nodes, and each node manages its own data independently. Multiple nodes include at least one master node and two standby nodes. Each node is mounted with a cloud disk. The master node is responsible for processing all read and write requests. The two standby nodes serve as replicas of the master node, regularly copying data from the master node and keeping it synchronized. When the master node fails, the database cluster will select a standby node to switch to the new master node and take over the read and write requests of the original master node.
[0005] Since the database cluster in the current solution needs to copy the data of the database master node to the two database standby nodes, both database standby nodes need to mount cloud disks to store data, making the computing and storage of the database standby nodes double redundant, resulting in a waste of storage resources of the database cluster. Summary of the invention
[0006] The embodiment of the present application provides a storage dynamic mounting method, in which the database nodes in the database cluster can dynamically mount the cloud disk to different database nodes, without mounting the cloud disk on two database backup nodes at the same time, thereby reducing the use of storage resources while ensuring the availability of the database cluster. The embodiment of the present application also provides a storage dynamic mounting device, a computing device, a computing device cluster, a computer-readable storage medium, and a computer program product corresponding to the storage dynamic mounting method.
[0007] In the first aspect, an embodiment of the present application provides a method for dynamic storage mounting, which can be executed by a computing device, or by a component of the computing device, such as a processor, chip or chip system of the computing device, or by a logic module or software that can realize all or part of the computing device functions. The method provided in the first aspect is applied to a database cluster, the database cluster includes multiple database nodes, the multiple database nodes are used to deploy database instances, the multiple database nodes include a master node, a slave node and a cold standby node, the slave node is used to replicate and synchronize the data of the master node, the cold standby node does not need to replicate and synchronize the data of the master node, and the master node and the slave node both store the database data by mounting a cloud disk. The method provided in the first aspect includes: the computing device obtains node status information, and the node status information is used to indicate the running status of the master node or the slave node. When the node status information indicates that the target database node fails, the target database node includes a master node and a slave node, the computing device unmounts the target cloud disk mounted on the target database node, and mounts the target cloud disk on the cold standby node. The computing device enables the cold standby node to provide database services.
[0008] In the embodiment of the present application, the database nodes in the database cluster can dynamically mount the cloud disk to different database nodes, thereby eliminating the need to simultaneously mount the cloud disk on multiple database slave nodes to copy the data of the database master node, thereby reducing the use of storage resources while ensuring the availability of the database cluster and improving the utilization of storage resources.
[0009] In one possible implementation, the target database node is a master node. When the node status information indicates that the master node is faulty, the computing device enables the slave node as the new master node before unmounting the cloud disk mounted on the master node, that is, enables the slave node to perform data read and write operations. In the process of enabling the cold standby node to provide database services, the computing device enables the cold standby node as the new slave node and starts the cold standby node to replicate and synchronize the data of the new master node.
[0010] In the embodiment of the present application, when a database master node in a database cluster fails, the computing device can unmount the cloud disk mounted on the database master node and mount the cloud disk on the database cold standby node. The database slave node can be upgraded to the database master node, and the database cold standby node also starts to back up the data of the original database slave node. The computing device reduces the number of redundant copies based on the data cold standby node, thereby improving the utilization rate of storage resources.
[0011] In one possible implementation, the target database node is a slave node. During the process of the computing device enabling the cold standby node to provide database services, the computing device enables the cold standby node as a new slave node and starts the cold standby node to replicate and synchronize the data of the master node.
[0012] In an embodiment of the present application, when a database slave node in a database cluster fails, the computing device can mount the cloud disk of the database slave node to the database cold standby node, and back up the database master node based on the data block cold standby node, thereby improving the availability of the database cluster.
[0013] In a possible implementation, the database cluster includes multiple slave nodes, and when the node status information indicates that the master node fails, the computing device selects a new database master node from the multiple slave nodes of the database cluster.
[0014] In the embodiment of the present application, when a database master node in a database cluster fails, a computing device selects a new database master node from multiple slave nodes in the database cluster, thereby improving the availability of the database cluster.
[0015] In one possible implementation, when the computing device selects a new database master node from multiple slave nodes of a database cluster, the computing device determines the new database master node from the multiple slave nodes based on voting results of the multiple slave nodes and the cold standby nodes.
[0016] In the embodiment of the present application, when the database master node in the database cluster fails, the database cold standby node can participate in the voting of the candidate database node, thereby improving the accuracy of selecting the new database master node. In one possible implementation, when the node status information indicates that the database master node in the database cluster fails, the computing device selects a new database master node based on the candidate database nodes in the database cluster, and the candidate database nodes do not include the cold standby node.
[0017] In the embodiment of the present application, when a database master node in a database cluster fails, the candidate database nodes of the new database master node do not include database cold standby nodes, thereby reducing the number of candidate database nodes and improving the selection efficiency of the new database master node.
[0018] In a possible implementation, when a database master node fails and the candidate database nodes include multiple database slave nodes, the computing device selects one node from the multiple database slave nodes as a new database master node, and the computing device initiates a vote on the multiple database slave nodes. Specifically, when a database slave node is determined to be a candidate database node, the database slave node sends a request message to other nodes, and the request message is used to request whether to agree to it to become the database master node.
[0019] In the embodiment of the present application, when a database master node in a database cluster fails, the database cold standby node can send a request message to other nodes, and other nodes vote to determine whether the standby node becomes the new database master node, thereby improving the accuracy of selecting the new database master node.
[0020] In a possible implementation, if the database slave node does not receive support from the majority of nodes within a specified time, and the majority of nodes support more than half of the total number of nodes, a new election cycle begins, and the next database slave node among the candidate database nodes begins to send request messages, and the database slave node becomes a database slave node again and waits for a new election. If the database slave node receives support from other nodes within a specified time, it becomes a new database node.
[0021] In the embodiment of the present application, when a database master node in a database cluster fails, a database slave node can be upgraded to a database master node only after obtaining support from a majority of other nodes, thereby improving the accuracy of selecting a new database master node.
[0022] In one possible implementation, the computing device collects node status information of each node in the database cluster in real time, triggers the selection logic of the database master node based on the node status information, and sends cloud disk management instructions to the nodes in the database based on the selection logic. The cloud disk management instructions include cloud disk unmounting instructions and cloud disk mounting instructions.
[0023] In the embodiment of the present application, the computing device can collect the node status information of each node in the database cluster in real time, and perform unloading and mounting operations on the cloud disk of the database based on the node status information of each node, thereby improving the availability of the new database cluster.
[0024] In the second aspect, an embodiment of the present application provides a storage dynamic mounting device, which is applied to a database cluster, wherein the database cluster includes multiple database nodes, and the multiple database nodes are used to deploy database instances. The multiple database nodes include a master node, a slave node, and a cold standby node. The slave node is used to replicate and synchronize the data of the master node, and the cold standby node does not need to replicate and synchronize the data of the master node. Both the master node and the slave node store the database data by mounting a cloud disk. The device includes an acquisition unit and a processing unit. Among them, the acquisition unit is used to obtain node status information, and the node status information is used to indicate the operating status of the master node or the slave node. The processing unit is used to unmount the target cloud disk mounted on the target database node and mount the target cloud disk on the cold standby node when the node status information indicates that the target database node has failed. The processing unit is also used to enable the cold standby node to provide database services.
[0025] In one possible implementation, the target database node is a master node, and the processing unit is further used to enable the slave node as a new master node before unmounting the cloud disk mounted on the master node when the node status information indicates that the master node is faulty. The processing unit is specifically used to enable the cold standby node as a new slave node, and start the cold standby node to replicate and synchronize the data of the new master node.
[0026] In a possible implementation, the target database node is a slave node, and the processing unit is specifically used to enable the cold standby node as a new slave node, and start the cold standby node to replicate and synchronize the data of the master node.
[0027] In a possible implementation, the database cluster includes multiple slave nodes, and the processing unit is further configured to select a new database master node from the multiple slave nodes of the database cluster when the node status information indicates that the master node fails.
[0028] In a possible implementation manner, the processing unit is specifically configured to determine a new database master node from the multiple slave nodes according to voting results of the multiple slave nodes and the cold standby node.
[0029] In a third aspect, an embodiment of the present application provides a computing device, comprising a processor, the processor being coupled to a memory, the processor being used to store instructions, and when the instructions are executed by the processor, the computing device executes the method described in the first aspect or any possible implementation manner of the first aspect.
[0030] In a fourth aspect, an embodiment of the present application provides a computing device cluster, the computing device cluster includes one or more computing devices, the computing device includes a processor, the processor is coupled to a memory, the processor is used to store instructions, when the instructions are executed by the processor, the computing device cluster executes the method described in the first aspect or any possible implementation method of the first aspect.
[0031] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium having instructions stored thereon. When the instructions are executed, the computer executes the method described in the first aspect or any possible implementation manner of the first aspect.
[0032] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes instructions. When the instructions are executed, the computer implements the method described in the first aspect or any possible implementation method of the first aspect.
[0033] It can be understood that the beneficial effects that can be achieved by any of the dynamic storage mounting devices, computing devices, computing device clusters, computer-readable media or computer program products provided above can be referred to the beneficial effects in the corresponding methods and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A schematic diagram of the system architecture of a storage dynamic mounting system provided in an embodiment of the present application;
[0035] Figure 2 A flowchart of a storage dynamic mounting method provided in an embodiment of the present application;
[0036] Figure 3 A schematic diagram of dynamic storage mounting provided in an embodiment of the present application;
[0037] Figure 4 A schematic diagram of dynamic storage mounting provided in an embodiment of the present application;
[0038] Figure 5 A schematic diagram of the structure of a storage dynamic mounting device provided in an embodiment of the present application;
[0039] Figure 6 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0040] Figure 7 A schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;
[0041] Figure 8 A schematic diagram of the structure of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] The embodiments of the present application provide a storage dynamic mounting method and device for improving the utilization efficiency of storage resources.
[0043] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0044] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0045] First, some terms involved in the embodiments of the present application are introduced to facilitate technical personnel in this field to understand the technical solution.
[0046] The master-slave replication cluster mode is a database high availability solution. This mode includes a master database and multiple standby databases. The master database is responsible for receiving and processing all read and write requests. The standby database maintains data consistency by replicating the data of the master database and takes over the work of the master database when the master database fails.
[0047] Failover means that when the primary database fails or becomes unavailable, the backup database is automatically switched to the primary database to ensure high availability and continuity of the system.
[0048] In order to make the technical solution of the present application clearer and easier to understand, the system architecture of the present application is introduced below with reference to the accompanying drawings.
[0049] See also Figure 1 , Figure 1 A schematic diagram of the system architecture of a storage dynamic mounting system provided in an embodiment of the present application. Figure 1 In the example shown, the storage dynamic mounting system 10 includes a database cluster 101, a cloud storage module 102, a state collection module 103 and a resource management module 104, wherein the data block cluster 101 includes a database master node 1011, a database slave node 1012 and a database cold standby node 1013. The specific functions of each part of the storage dynamic mounting system 10 are described below.
[0050] The database cluster 101 is used to provide database services to the outside world, and the database services include managing and storing data. The database cluster 101 includes multiple database nodes, and the multiple database nodes collaborate to provide database services. The multiple database nodes include a database master node 1011, a database slave node 1012, and a database cold standby node 1013. Among them, the database master node 1011 and the database slave node 1012 are mounted with a cloud disk, and the database cold standby node 1013 is not mounted with a cloud disk. The cloud disk is used to provide data storage services.
[0051] The database master node 1011 is used to provide external data read and write and storage services, including processing data read and write requests and storing the written data in the cloud disk mounted on the cloud database master node 1011. The database slave node 1012 is used to replicate the data of the database master node 1011 and maintain data consistency with the database master node 1011. When the database master node 1011 fails, the database slave node 1012 is promoted to the database master node to maintain the normal operation of the system.
[0052] The database cold standby node 1013 serves as a cold standby node for the database slave node 1012, on which no cloud disk is mounted and no storage service is provided. Only when the database master node 1011 fails and the database slave node 1012 is promoted to the database master node, or when the database slave node 1012 fails and the database cold standby node 1013 mounts the cloud disk, the database cold standby node 1013 is upgraded to the database slave node and starts to copy the data of the database master node 1011.
[0053] It is understandable that the database cluster 101 may have one database master node 1011 and multiple database slave nodes 1012 , and may also have multiple database cold standby nodes 1013 .
[0054] The cloud storage module 102 includes multiple cloud disks 1021 and a cloud storage management service submodule 1022, wherein the cloud disk 1021 is used to provide data storage services and can expand the storage capacity of the database nodes in the database cluster 101. The cloud disk 1021 is bound to the database nodes in the database cluster 101, that is, the database nodes in the database cluster 101 can mount one or more cloud disks 1021.
[0055] It is understandable that the binding relationship between the cloud disk 1021 and the database nodes in the database cluster 101 can be flexibly controlled, that is, the cloud disk 1021 is unmounted and mounted between different database nodes in the database cluster 101 .
[0056] The cloud storage management service submodule 1022 is used to manage the life cycle of the cloud disk 1021, including applying for and deleting cloud disks, and dynamically unloading and mounting cloud disks 1021. The cloud storage management service submodule 1022 can receive cloud disk unloading and mounting instructions sent by the resource management module 104, and unload and mount the cloud disk 1021 based on the cloud disk unloading and mounting instructions sent by the resource management module 104, and can also independently manage the unloading and mounting of the cloud disk, which is not specifically limited.
[0057] The state collection module 103 is used to collect the state information of each database node in the database cluster 101. Specifically, the state collection module 103 maintains communication with each database node in the database cluster 101, can collect the state information of the database node in real time, and report the state information of each database node in the database cluster 101 to the resource management module 104, and the resource management module 104 detects whether the database node fails according to the state information.
[0058] The resource management module 104 is used to manage the database cluster 101, the cloud storage module 102 and the status acquisition module 103, including real-time detection of the status of different database nodes in the database cluster, election of the database master node, synchronization of the data of the database master node to the database slave node, and mounting and unmounting of the cloud disk and other management operations.
[0059] It should be noted that each module in the storage dynamic mounting system 10 can be a software module deployed in one or more computing devices, or a hardware module in one or more computing devices. The hardware module can be a separate computing device or computing circuit, which is not specifically limited.
[0060] In addition to being applied to database scenarios, the storage dynamic mounting method in the embodiment of the present application can also be applied to other scenarios, such as online document sharing scenarios. In online document sharing scenarios, online documents provide reading, editing and other services to the outside through the host. If the host fails, the data can be switched to a new node to provide service capabilities to the outside again. In addition, the cloud environment to which the storage dynamic mounting method in the embodiment of the present application is applied includes but is not limited to public cloud, hybrid cloud and private cloud.
[0061] based on Figure 1 The storage dynamic mounting system 10 shown in the figure, the present application also provides a storage dynamic mounting method. The storage dynamic mounting method provided by the embodiment of the present application is introduced below in conjunction with the embodiment.
[0062] See also Figure 2 , Figure 2 A flowchart of a storage dynamic mounting method provided in an embodiment of the present application. Figure 2 In the example shown, the method includes the following steps:
[0063] 201. Obtain node status information, where the node status information is used to indicate the running status of the master node or the slave node.
[0064] The storage dynamic mounting system 10 obtains node status information, and the node status information is used to indicate the operating status of one or more database nodes in the database cluster 101. The one or more database nodes include a master node and a slave node. Specifically, the storage dynamic mounting system 10 collects node status information of each database node in the database cluster 101, and monitors whether the database node fails based on the node status information.
[0065] Among them, the database cluster 101 includes multiple database nodes, the database nodes include a database master node 1011, a database slave node 1012 and a database cold standby node 1013, the database master node 1011 and the database slave node 1012 are database nodes with cloud disks mounted, and the database cold standby node 1013 is a database node without cloud disks mounted.
[0066] See also Figure 3 , Figure 3 A schematic diagram of a database master node failure provided in an embodiment of the present application. Figure 3 In the example shown, the master node is the database master node, which can provide database read and write services to the outside world. The slave node is the database slave node, which can receive replicated data from the master node and store it in the cloud disk mounted under the slave node. The slave node acts as a copy of the master node to improve data security.
[0067] exist Figure 3 In the example shown, the offline node is a database cold standby node. The offline node does not save data in a stable state. Only when the master node or slave node fails, the offline node starts to store data after the cloud disk is mounted.
[0068] 202. When the node status information indicates that the target database node fails, the target cloud disk mounted on the target database node is unmounted, and the target cloud disk is mounted on the cold standby node.
[0069] After the storage dynamic mounting system 10 obtains the node status information, when the node status information indicates that the target database node is faulty, the target cloud disk mounted on the target database node is unmounted, and the target cloud disk is mounted on the database cold standby node. The target database node can be a database master node or a database slave node. The storage dynamic mounting system 10 can unmount the cloud disk mounted on the database master node or the database slave node, and mount the cloud disk on the database cold standby node.
[0070] The following describes two situations in which the node status information indicates a target database node failure:
[0071] In the first possible failure scenario, the target database node is the database master node 1011, which is used to process data read and write operations. The database cluster 101 also includes database slave nodes. When the node status information indicates that the database master node 1011 fails, the storage dynamic mounting system 10 responds to the data read and write request based on the database slave node 1012. That is, the database slave node 1012 is promoted to a new database master node and processes data read and write operations.
[0072] Please continue reading Figure 3 ,exist Figure 3 In the example shown, when the master node in the database cluster fails, the master node cannot provide external data read and write services. The database cluster needs to select a new master node. At this time, the slave node can be upgraded to the new master node and resume external data read and write services.
[0073] In the above possible implementation manner, when the node status information indicates that the database master node 1011 fails, the storage dynamic mounting system 10 unmounts the cloud disk mounted on the database master node 1011 and mounts the cloud disk to the database cold standby node 1013 .
[0074] Please continue reading Figure 3 ,exist Figure 3 In the example shown, when a master node in a database cluster fails, the slave node is upgraded to a new master node. At the same time, the storage dynamic mounting system 10 unmounts the cloud disk mounted on the master node and mounts the cloud disk to the offline node.
[0075] Specifically, in Figure 3 In the example shown, the resource management module 104 monitors the status of the database cluster 101 in real time. When the master node failure is detected and the slave node is upgraded to a new master node, the resource management module 104 triggers the automatic cloud disk mounting process. The resource management module 104 issues a command to uninstall the master node cloud disk, uninstalls the cloud disk from the failed master node, and then mounts the cloud disk to the offline node. At this time, the offline node has the conditions to be upgraded to a slave node.
[0076] In the second possible failure scenario, the target database node is the database slave node 1012, which is used to synchronize the data of the database master node. When the node status information indicates that the database slave node 1012 fails, the storage dynamic mounting system 10 continues to process data read and write operations based on the database master node 1011. At the same time, the storage dynamic mounting system 10 unmounts the cloud disk mounted on the database slave node 1012 and mounts the cloud disk on the database cold standby node 1013.
[0077] See also Figure 4 , Figure 4 A schematic diagram of a database slave node failure provided in an embodiment of the present application. Figure 4 In the example shown, when a slave node in the database cluster fails, the master node continues to provide data read and write services to the outside. At this time, the master node's ability to provide data read and write services to the outside is not impaired, but the data of the master node cannot be synchronized to the slave node, and the data security of the master node cannot be guaranteed. Therefore, the database cluster 101 is in a sub-healthy state.
[0078] exist Figure 4 In the example shown, the resource management module 104 monitors the status of the database cluster 101 in real time. When a slave node failure is detected, the resource management module 104 triggers the automatic cloud disk mounting process. The resource management module 104 issues a command to uninstall the slave node cloud disk, uninstalls the cloud disk from the failed slave node, and then mounts the cloud disk to the offline node. At this time, the offline node has the conditions to be upgraded to a slave node.
[0079] In the first possible failure scenario described above, when the node status information indicates that the database master node in the database cluster fails, the storage dynamic mounting system 10 selects a new database master node based on the candidate database nodes in the database cluster, and the candidate database nodes do not include database cold standby nodes. That is, the candidate database nodes only include multiple database slave nodes, and the database cold standby nodes cannot be directly promoted to database master nodes.
[0080] Please continue reading Figure 3 ,exist Figure 3 In the example shown, when there are multiple slave nodes in the database cluster, when a master node in the database cluster fails, the multiple slave nodes are candidate database nodes, and the storage dynamic mounting system 10 selects one node from the multiple slave nodes as a new master node. An offline node cannot be directly promoted to a master node.
[0081] In the first possible failure scenario mentioned above, when the node status information indicates that the database master node in the database cluster has failed, the storage dynamic mounting system 10 needs to select a new database master node based on an election protocol in the process of selecting a new database master node from the candidate database nodes in the database cluster, such as the Raft protocol and the Paxos protocol.
[0082] Specifically, the storage dynamic mounting system 10 determines a new database master node 1011 based on the voting results of the remaining database nodes in the database cluster on the candidate database nodes. The remaining database nodes include a database cold standby node 1013, that is, although the database cold standby node 1013 cannot be directly upgraded to a new database master node, the database cold standby node 1013 can participate in the voting for the selection of candidate database nodes.
[0083] In the embodiment of the present application, when a database master node in a database cluster fails, the database cold standby node cannot directly serve as a candidate database node for the database master node, but can participate in the voting of the candidate database nodes to determine a new database master node, thereby improving the accuracy of selecting a new database master node.
[0084] Please continue reading Figure 3 ,exist Figure 3 In the example shown, when a master node in a database cluster fails and the candidate database nodes include multiple slave nodes, the storage dynamic mounting system 10 needs to select one node from the multiple slave nodes as a new master node. The storage dynamic mounting system 10 initiates a vote for the multiple slave nodes, wherein the offline nodes can also vote. The storage dynamic mounting system 10 selects a slave node as a new master node based on the voting results of the multiple slave nodes.
[0085] Specifically, in Figure 3 In the example shown, when a slave node determines that it is a candidate database node, the slave node will consult other nodes to see if they agree to let it become the database master node. If the slave node does not receive support from the majority of nodes within the specified time, a new election cycle begins, and the slave node becomes a slave node again and waits for a new election. If the slave node receives support from other nodes, it will become the new master node.
[0086] 203. Enable cold standby nodes to provide database services.
[0087] After the database cold standby node 1013 is mounted with the cloud disk, the storage dynamic mounting system 10 enables the database cold standby node 1013 to provide database services, including data backup for the database slave node 1012 and data backup for the database master node 1011. The following introduces the two situations respectively;
[0088] In the first case of enabling the database cold standby node, when the node status information indicates that the database master node 1011 fails, the storage dynamic mounting system 10 unmounts the target cloud disk mounted on the database master node 1011, and mounts the target cloud disk to the database cold standby node 1013. At this time, the database cold standby node 1013 meets the enabling conditions, and the database cold standby node 1013 starts to back up the data of the database slave node 1012, and the database slave node 1012 is upgraded to a new database master node.
[0089] Please continue reading Figure 3 ,exist Figure 3 In the example shown, when a master node in a database cluster fails, the slave node is upgraded to a new master node. At the same time, the storage dynamic mounting system 10 unmounts the cloud disk mounted on the master node and mounts the cloud disk to the offline node. At this time, the offline node can be upgraded to a new slave node, and the offline node begins to synchronize data with the upgraded slave node.
[0090] In the embodiment of the present application, when a database master node in a database cluster fails, the computing device can process data read and write operations based on the database slave node and back up the database slave node based on the data block cold standby node, thereby improving the availability of the database cluster and the utilization rate of storage resources.
[0091] In the second case of enabling the database cold standby node, when the node status information indicates that the database slave node 1012 fails, the storage dynamic mounting system 10 unmounts the cloud disk mounted on the database slave node 1012, and mounts the cloud disk to the database cold standby node 1013. At this time, the database cold standby node 1013 meets the enabling conditions, and the database cold standby node 1013 starts data backup for the database master node 1011. The database cold standby node 1013 is upgraded to a new database slave node.
[0092] Please continue reading Figure 4 ,exist Figure 4In the example shown, when a slave node in the database cluster fails, the storage dynamic mounting system 10 unmounts the cloud disk mounted on the slave node and mounts the cloud disk to the offline node. At this time, the offline node can be upgraded to a new slave node. When the offline node is upgraded to a new slave node, the offline node can start synchronizing data with the master node.
[0093] In an embodiment of the present application, when a database slave node in a database cluster fails, the computing device can mount the cloud disk of the database slave node to the database cold standby node, and back up the database master node based on the data block cold standby node, thereby improving the availability of the database cluster and the utilization rate of storage resources.
[0094] It can be seen from the above method embodiments that the database nodes in the database cluster in the embodiment of the present application can dynamically mount the cloud disk to different database nodes. Therefore, the database slave nodes can be replaced based on the database cold standby nodes, thereby reducing the number of database slave nodes mounted with cloud disks, thereby ensuring the availability of the database cluster while reducing the use of storage resources and improving the utilization rate of storage resources.
[0095] Based on the above method embodiment, the embodiment of the present application also provides a storage dynamic mounting device. The storage dynamic mounting device provided by the embodiment of the present application is specifically introduced below.
[0096] See also Figure 5 , Figure 5 A schematic diagram of the structure of a storage dynamic mounting device provided in an embodiment of the present application. Figure 5 In the example shown, the storage dynamic mounting device 500 is used to implement the various steps performed by the storage dynamic mounting system in the above-mentioned embodiments. The storage dynamic mounting device 500 is applied to a database cluster, and the database cluster includes multiple database nodes. The multiple database nodes are used to deploy database instances. The multiple database nodes include a master node, a slave node and a cold standby node. The slave node is used to replicate and synchronize the data of the master node. The cold standby node does not need to replicate and synchronize the data of the master node. The master node and the slave node both store the database data by mounting a cloud disk. The device 500 includes an acquisition unit 501 and a processing unit 502.
[0097] The acquisition unit 501 is used to acquire node status information, and the node status information is used to indicate the operating status of the master node or the slave node. The processing unit 502 is used to uninstall the target cloud disk mounted on the target database node and mount the target cloud disk on the cold standby node when the node status information indicates that the target database node has failed. The processing unit 502 is also used to enable the cold standby node to provide database services.
[0098] In a possible implementation, the target database node is a master node, and the processing unit 502 is further used to enable the slave node as a new master node before unloading the cloud disk mounted on the master node when the node status information indicates that the master node is faulty. The processing unit 502 is specifically used to enable the cold standby node as a new slave node, and start the cold standby node to replicate and synchronize the data of the new master node.
[0099] In a possible implementation manner, the target database node is a slave node, and the processing unit 502 is specifically configured to enable the cold standby node as a new slave node, and start the cold standby node to replicate and synchronize the data of the master node.
[0100] In a possible implementation, the database cluster includes multiple slave nodes, and the processing unit 502 is further configured to select a new database master node from the multiple slave nodes of the database cluster when the node status information indicates that the master node fails.
[0101] In a possible implementation manner, the processing unit 502 is specifically configured to determine a new database master node from the multiple slave nodes according to voting results of the multiple slave nodes and the cold standby nodes.
[0102] It is understandable that the acquisition unit 501 and the processing unit 502 in the dynamic storage device 500 can be used as functional modules and Figure 1 There is a mapping relationship between the modules in the storage dynamic mounting system 10, so as to realize the functions of the modules in the storage dynamic mounting system 10.
[0103] It should be understood that the division of the units in the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And the units in the device can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some units can also be implemented in the form of software calling through processing elements, and some units can be implemented in the form of hardware. For example, each unit can be a separately established processing element, or it can be integrated in a certain chip of the device. In addition, it can also be stored in the memory in the form of a program, and called and executed by a certain processing element of the device. The function of the unit. In addition, all or part of these units can be integrated together, or they can be implemented independently. The processing element described here can also be a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each unit above can be implemented by an integrated logic circuit of hardware in the processor element or in the form of software calling through a processing element.
[0104] It is worth noting that, for the above method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required for the present application.
[0105] Other reasonable step combinations that can be thought of by those skilled in the art based on the above description also fall within the scope of protection of this application. Secondly, those skilled in the art should also be familiar with the fact that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by this application.
[0106] See also Figure 6 , Figure 6 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. Figure 6 As shown, the computing device 600 includes: a processor 601, a memory 602, a communication interface 603 and a bus 604. The processor 601, the memory 602 and the communication interface 603 are coupled via a bus (not marked in the figure). The memory 602 stores instructions. When the execution instructions in the memory 602 are executed, the computing device 600 executes the method executed by the computing device in the above method embodiment.
[0107] The computing device 600 may be one or more integrated circuits configured to implement the above method, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital signal processors, DSP), or one or more field programmable gate arrays (FPGA), or a combination of at least two of these integrated circuit forms. For another example, when the unit in the device can be implemented in the form of a processing element scheduler, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these units can be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0108] The processor 601 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0109] The memory 602 may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0110] The memory 602 stores executable program codes, and the processor 601 executes the executable program codes to respectively implement the functions of the aforementioned units or modules, thereby implementing the aforementioned storage dynamic mounting method. That is, the memory 602 stores instructions for executing the aforementioned storage dynamic mounting method.
[0111] The communication interface 603 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 600 and other devices or a communication network.
[0112] In addition to the data bus, the bus 604 may also include a power bus, a control bus, a status signal bus, etc. The bus may be a peripheral component interconnect express (PCIe) bus, or an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0113] See also Figure 7 , Figure 7 A schematic diagram of a computing device cluster provided in an embodiment of the present application. Figure 7 As shown, the computing device cluster 700 includes at least one computing device 600 .
[0114] like Figure 7 As shown, the computing device cluster 700 includes at least one computing device 600. The memory 602 in one or more computing devices 600 in the computing device cluster 700 may store the same instructions for executing the above storage dynamic mounting method.
[0115] In some possible implementations, the memory 602 of one or more computing devices 600 in the computing device cluster 700 may also store partial instructions for executing the above-mentioned storage dynamic mounting method. In other words, the combination of one or more computing devices 600 can jointly execute the instructions for executing the above-mentioned storage dynamic mounting method.
[0116] It should be noted that the memory 602 in different computing devices 600 in the computing device cluster 700 can store different instructions, which are respectively used to execute part of the functions of the above-mentioned task processing device. That is, the instructions stored in the memory 602 in different computing devices 600 can realize the functions of one or more modules in the acquisition unit and the processing unit.
[0117] In some possible implementations, one or more computing devices 600 in the computing device cluster 700 may be connected via a network, which may be a wide area network or a local area network.
[0118] See also Figure 8 , Figure 8 A schematic diagram of computer devices in a computer cluster connected via a network provided in an embodiment of the present application. Figure 8 As shown, two computing devices 600A and 600B are connected via a network. Specifically, they are connected to the network via a communication interface in each computing device.
[0119] In a possible implementation, the memory in the computing device 600A stores instructions for executing the functions of the acquisition unit, and the memory in the computing device 600B stores instructions for executing the functions of the processing unit.
[0120] It should be understood that Figure 8 The functions of the computing device 600A shown in FIG. 6A may also be completed by multiple computing devices. Similarly, the functions of the computing device 600B may also be completed by multiple computing devices.
[0121] In another embodiment of the present application, a computer-readable storage medium is provided, in which computer-executable instructions are stored. When the processor of the device executes the computer-executable instructions, the device executes the method executed by the computing device in the above method embodiment.
[0122] In another embodiment of the present application, a computer program product is provided, the computer program product includes computer execution instructions, the computer execution instructions are stored in a computer readable storage medium. When the processor of the device executes the computer execution instructions, the device executes the method executed by the computing device in the above method embodiment.
[0123] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0124] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0125] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0126] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0127] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. A storage dynamic mounting method, characterized in that: Applied to a database cluster, the database cluster includes multiple database nodes, the multiple database nodes are used to deploy database instances, the multiple database nodes include a master node, a slave node and a cold standby node, the slave node is used to replicate and synchronize the data of the master node, the cold standby node does not need to replicate and synchronize the data of the master node, the master node and the slave node both store the database data by mounting a cloud disk, the method includes: Acquire node status information, where the node status information is used to indicate the running status of the master node or the slave node; When the node status information indicates that the target database node fails, unmounting the target cloud disk mounted on the target database node, and mounting the target cloud disk on the cold standby node; The cold standby node is enabled to provide database services.
2. The method according to claim 1, characterized in that The target database node is the master node, and the method further comprises: When the node status information indicates that the master node fails, before unmounting the cloud disk mounted on the master node, enabling the slave node as a new master node; The enabling of the cold standby node to provide database services includes: Enabling the cold standby node as a new slave node; The cold standby node replicates and synchronizes the data of the new primary node.
3. The method according to claim 1, characterized in that The target database node is the slave node, and enabling the cold standby node to provide database services includes: Enabling the cold standby node as a new slave node; The cold standby node replicates and synchronizes the data of the primary node.
4. The method according to claim 1, characterized in that: The database cluster includes a plurality of slave nodes, and the method further includes: When the node status information indicates that the master node fails, a new database master node is selected from the multiple slave nodes of the database cluster.
5. The method according to claim 4, characterized in that The selecting a new database master node from the multiple slave nodes of the database cluster includes: According to the voting results of the multiple slave nodes and the cold standby node, the new database master node is determined from the multiple slave nodes.
6. A storage dynamic mounting device, characterized in that: Applied to a database cluster, the database cluster includes multiple database nodes, the multiple database nodes are used to deploy database instances, the multiple database nodes include a master node, a slave node and a cold standby node, the slave node is used to replicate and synchronize the data of the master node, the cold standby node does not need to replicate and synchronize the data of the master node, the master node and the slave node both store the database data by mounting a cloud disk, and the device includes: An acquiring unit, used for acquiring node status information, wherein the node status information is used for indicating the running status of the master node or the slave node; a processing unit, configured to, when the node status information indicates that the target database node is faulty, unmount the target cloud disk mounted on the target database node, and mount the target cloud disk on the cold standby node; The processing unit is further configured to enable the cold standby node to provide database services.
7. The device according to claim 6, characterized in that The target database node is the master node, and the processing unit is further used for: When the node status information indicates that the master node fails, before unmounting the cloud disk mounted on the master node, enabling the slave node as a new master node; The processing unit is specifically used for: Enabling the cold standby node as a new slave node; The cold standby node replicates and synchronizes the data of the new primary node.
8. The device according to claim 6, characterized in that The target database node is the slave node, and the processing unit is specifically used for: Enabling the cold standby node as a new slave node; The cold standby node replicates and synchronizes the data of the primary node.
9. The device according to claim 6, characterized in that The database cluster includes a plurality of slave nodes, and the processing unit is further used for: When the node status information indicates that the master node fails, a new database master node is selected from the multiple slave nodes of the database cluster.
10. The device according to claim 9, characterized in that The processing unit is specifically used for: According to the voting results of the multiple slave nodes and the cold standby node, the new database master node is determined from the multiple slave nodes.
11. A computing device cluster, characterized in that: The system comprises at least one computing device, wherein the computing device comprises a processor, wherein the processor is coupled to a memory, and the processor is used to store instructions. When the instructions are executed by the processor, the computing device cluster executes the method according to any one of claims 1 to 5.
12. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed, the computer is caused to perform the method according to any one of claims 1 to 5.
13. A computer program product, comprising instructions, characterized in that: When the instructions are executed, the computer implements the method according to any one of claims 1 to 5.