Cluster upgrade control method and device, equipment, medium and program product
By replacing exception slave nodes and using candidate nodes for data synchronization during cluster upgrade, combined with the master-slave handover strategy, the problem of difficult business continuity in the traditional cluster upgrade method is solved, and the stability of the upgrade process and business continuity are achieved. sex.
Patent Information
- Application Number
- CN202411521162.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2024-12-27
AI Technical Summary
Traditional cluster upgrade methods cannot ensure business continuity, especially when the non-stop upgrade of open source software such as redis clusters is prone to abnormalities, resulting in business interruption.
By obtaining the master node and slave node of the target cluster, determine the target master node to be upgraded, and replace the abnormal slave node during the upgrade process, use the candidate node for data synchronization until the upgraded node is detected and the master node is connected, and then the upgrade is resumed. Process; After the master-slave switch, upgrade the master node after the master-slave switch to ensure business continuity.
The business continuity during the cluster upgrade process is achieved, interruptions caused by upgrade exceptions are avoided, and the normal operation of the target cluster after upgrading is ensured.
Smart Images

Figure CN119201180A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data processing technology, and in particular to a cluster upgrade control method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] Open source software is usually used in software systems to implement cache functions, such as redis cluster. Redis cluster is an open source memory data storage system with persistence function, which can be widely used in system development scenarios such as cache, message queue, distributed lock, etc. In order to meet the needs of use, open source software usually releases new versions regularly for optimization and upgrade. However, if there is a long downtime or upgrade abnormality during the version upgrade process, it will affect the normal operation of the software system.
[0003] In traditional technology, to ensure a smooth upgrade, you can choose to stop the upgrade. After backing up the data, stop the software system, uninstall the old version and install the new version. However, stopping the upgrade will cause business interruption during the upgrade process. If you choose to upgrade without stopping, because open source software (such as redis cluster) is usually deployed in the form of a cluster in the software system, involving many master and slave nodes, the upgrade process is more complicated, and exceptions are prone to occur during the upgrade without stopping. Once an exception occurs, it will also cause business interruption. Therefore, the traditional cluster upgrade method cannot ensure the business continuity of the cluster during the upgrade process. Summary of the invention
[0004] Based on this, it is necessary to provide a cluster upgrade control method, apparatus, computer equipment, computer-readable storage medium and computer program product that can ensure the business continuity of the cluster during the upgrade process in response to the above technical problems.
[0005] In a first aspect, the present application provides a cluster upgrade control method, comprising: when an upgrade request for a target cluster is received, obtaining at least one master node in the target cluster and at least one slave node associated with each master node, determining the target master node to be upgraded from the at least one master node, and upgrading the target slave node associated with the target master node; if there is an abnormal slave node with an upgrade abnormality in the target slave node, obtaining a target candidate node matching the abnormal slave node, replacing the abnormal slave node with the target candidate node and pausing the upgrade process until it is detected that an upgraded node is connected to the target master node, replacing the target candidate node with the upgraded node, and resuming the upgrade process; when all target slave nodes associated with the target master node have been upgraded, performing a master-slave switch between any one of the target slave nodes and the target master node, upgrading the target master node after the master-slave switch, and switching the upgraded target master node back to the master node.
[0006] In one of the embodiments, a target master node to be upgraded is determined from at least one master node, and a target slave node associated with the target master node is upgraded, including: determining a master node upgrade order of a target cluster; determining a target master node to be upgraded from at least one master node according to the master node upgrade order, and obtaining a slave node upgrade order of at least one target slave node associated with the target master node; and upgrading at least one target slave node associated with the target master node in sequence according to the slave node upgrade order.
[0007] In one of the embodiments, at least one target slave node associated with the target master node is upgraded in sequence according to a slave node upgrade sequence, including: determining a first slave node to be upgraded from at least one target slave node according to the slave node upgrade sequence; isolating the first slave node from the target cluster, and upgrading the isolated first slave node; when the first slave node completes the upgrade, connecting the upgraded first slave node to the target cluster as a target slave node associated with the target master node; determining a second slave node to be upgraded from at least one target slave node according to the slave node upgrade sequence, until at least one target slave node completes the upgrade.
[0008] In one of the embodiments, any one of the target slave nodes is switched between the target master node and the target master node, the target master node after the master-slave switching is upgraded, and the upgraded target master node is switched back to the master node, including: any one of the upgraded target slave nodes is switched between the target master node and the target master node, and the target master node after the master-slave switching is used as a temporary slave node, and the target slave node after the master-slave switching is used as a temporary master node; the temporary slave node is isolated from the target cluster, and the isolated temporary slave node is upgraded; when the temporary slave node completes the upgrade, the temporary slave node and the temporary master node are switched between the master and slave nodes to switch the upgraded target master node back to the master node.
[0009] In one of the embodiments, the cluster upgrade control method also includes: when the target master node is upgraded, determining the next target master node according to the upgrade order of the master nodes of the target cluster; upgrading the next target master node and at least one target slave node associated with the next target master node until all nodes to be upgraded in the target cluster have been upgraded, thereby obtaining an upgraded target cluster.
[0010] In one of the embodiments, the cluster upgrade control method further includes: isolating the candidate nodes connected to the target cluster from the upgraded target cluster.
[0011] In one of the embodiments, the cluster upgrade control method also includes: in the process of controlling the target cluster upgrade, sending test data to the target cluster so that the target cluster processes the test data during the upgrade process, and monitoring the node data generated by each node in the target cluster due to processing the test data; after the target cluster completes the upgrade, comparing the node data generated by each node in the target cluster to obtain a data consistency comparison result; based on the data consistency comparison result, determining the availability detection result of the upgrade process for the target cluster.
[0012] In the second aspect, the present application also provides a cluster upgrade control device, including: a node determination module for upgrading, which is used to obtain at least one master node in the target cluster and at least one slave node associated with each master node when an upgrade request for the target cluster is received, determine the target master node to be upgraded from the at least one master node, and upgrade the target slave node associated with the target master node; an abnormal slave node processing module, which is used to obtain a target candidate node matching the abnormal slave node if there is an abnormal slave node with an upgrade abnormality in the target slave node, replace the abnormal slave node with the target candidate node and suspend the upgrade process until it is detected that there is an upgraded node connected to the target master node, replace the target candidate node with the upgraded node, and resume the upgrade process; a master node upgrade processing module, which is used to switch any one of the target slave nodes with the target master node for master-slave switching when all the target slave nodes associated with the target master node have been upgraded, upgrade the target master node after the master-slave switching, and switch the upgraded target master node back to the master node.
[0013] In one of the embodiments, the module for determining nodes to be upgraded includes: a master node sequence determination unit, used to determine the master node upgrade sequence of the target cluster; a master node upgrade processing unit, used to determine the target master node to be upgraded from at least one master node according to the master node upgrade sequence, and obtain the slave node upgrade sequence of at least one target slave node associated with the target master node; a slave node upgrade processing unit, used to upgrade at least one target slave node associated with the target master node in sequence according to the slave node upgrade sequence.
[0014] In one of the embodiments, the master node upgrade processing unit is specifically used to: determine a first slave node to be upgraded from at least one target slave node according to a slave node upgrade sequence; isolate the first slave node from the target cluster, and upgrade the isolated first slave node; when the first slave node completes the upgrade, connect the upgraded first slave node to the target cluster as a target slave node associated with the target master node; determine a second slave node to be upgraded from at least one target slave node according to the slave node upgrade sequence, until at least one target slave node completes the upgrade.
[0015] In one of the embodiments, the master node upgrade processing module includes: a first master-slave switching unit, used to perform master-slave switching on any one of the upgraded target slave nodes and the target master node, and use the target master node after the master-slave switching as a temporary slave node, and use the target slave node after the master-slave switching as a temporary master node; a slave node isolation upgrade unit, used to isolate the temporary slave node from the target cluster, and upgrade the isolated temporary slave node; a second master-slave switching unit, used to perform master-slave switching on the temporary slave node and the temporary master node when the temporary slave node completes the upgrade, so that the upgraded target master node is switched back to the master node.
[0016] In one of the embodiments, the cluster upgrade control device also includes: a next master node determination module, which is used to determine the next target master node according to the master node upgrade order of the target cluster when the target master node is upgraded; a next master node upgrade module, which is used to upgrade the next target master node and at least one target slave node associated with the next target master node until all nodes to be upgraded in the target cluster have been upgraded to obtain an upgraded target cluster.
[0017] In one of the embodiments, the cluster upgrade control device further includes: a candidate node isolation module, configured to isolate the candidate nodes connected to the target cluster from the upgraded target cluster.
[0018] In one of the embodiments, the cluster upgrade control device also includes: a cluster testing module, which is used to send test data to the target cluster during the process of controlling the target cluster upgrade, so that the target cluster processes the test data during the upgrade process, and monitors the node data generated by each node in the target cluster due to processing the test data; a consistency comparison module, which is used to compare the node data generated by each node in the target cluster after the target cluster completes the upgrade, and obtain a data consistency comparison result; a detection result determination module, which is used to determine the availability detection result of the upgrade process for the target cluster based on the data consistency comparison result.
[0019] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned cluster upgrade control method when executing the computer program.
[0020] In a fourth aspect, the present application further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned cluster upgrade control method is implemented.
[0021] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the above-mentioned cluster upgrade control method when executed by a processor.
[0022] The cluster upgrade control method, device, computer equipment, computer-readable storage medium and computer program product first obtain at least one master node in the target cluster indicated by the upgrade request, and at least one slave node associated with each master node, and determine the target master node to be upgraded from at least one master node, and then upgrade the target slave node associated with the target master node. If there is an abnormal slave node with an upgrade abnormality in the target slave node, the target candidate node matching the abnormal slave node is obtained, the abnormal slave node is replaced with the target candidate node and the upgrade process is suspended, so that the target candidate node replaces the abnormal slave node to maintain the normal operation of the target cluster, ensuring the business continuity of the upgrade process, until it is detected that there is an upgraded node connected to the target master node, and then the target candidate node is replaced with the upgraded node to replace the target candidate node, restore the original architecture of the target cluster, and resume the upgrade process. When the target slave nodes associated with the target master node have been upgraded, any one of the target slave nodes can be switched from the target master node to the master-slave node, so that the upgraded target slave node replaces the target master node to maintain the normal operation of the target cluster, ensuring the business continuity of the upgrade process, and then the target master node after the master-slave switch is upgraded, and the upgraded target master node is switched back to the master node. By adopting the above method, the business continuity of the target cluster during the upgrade process can be ensured through the replacement of the target candidate node and the master-slave switching between the target master node and the target slave node. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0024] FIG1 is an application environment diagram of a cluster upgrade control method in one embodiment;
[0025] FIG2 is a schematic diagram of a flow chart of a cluster upgrade control method in one embodiment;
[0026] FIG3 is a schematic diagram of a process of upgrading a target master node and at least one target slave node associated with the target master node in one embodiment;
[0027] FIG4 is a schematic diagram of a process for implementing cluster upgrade control according to a master node upgrade sequence and a slave node upgrade sequence in a target cluster in one embodiment;
[0028] FIG5 is a schematic diagram of a process for implementing cluster upgrade control by isolating and upgrading slave nodes in sequence in one embodiment;
[0029] FIG6 is a schematic diagram of a process for implementing cluster upgrade control through master-slave switching in one embodiment;
[0030] FIG7 is a schematic diagram of a process for implementing cluster upgrade control by sequentially upgrading master nodes in a cluster in one embodiment;
[0031] FIG8 is a schematic diagram of a process for testing the availability of a cluster upgrade control method in one embodiment;
[0032] FIG9 is a schematic diagram of a target cluster including candidate nodes in one embodiment;
[0033] FIG10 is a schematic flow chart of a cluster upgrade control method in another embodiment;
[0034] FIG11 is a structural block diagram of a cluster upgrade control device in one embodiment;
[0035] FIG. 12 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. It should be noted that in the embodiments of the present application, certain software, groups, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0037] 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, stored data, displayed data, 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 relevant data must comply with relevant regulations. The acquisition, storage, use, and processing of data in the technical solution of this application are in compliance with relevant provisions of national laws and regulations.
[0038] The cluster upgrade control method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 102 can communicate with the main server 104 through the network. The terminal 102 can be, but not limited to, various personal computers, laptops, smart phones, tablet computers, etc. The main server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. The main server 104 can be deployed with a software system, a database cluster 1041 for storing persistent data in the software system, and at least one cache cluster 1042 for implementing the cache function of the software system to relieve the load pressure of the database cluster 1041. The cache cluster 1042 includes but is not limited to at least one of the redis cluster, Memcached cluster, and Tair cluster, and needs to be upgraded regularly. The redis cluster is an open source memory data storage system with persistence function, which can be widely used in system development scenarios such as cache, message queue, and distributed lock. The Memcached cluster is a free, open source, high-performance cache system with distributed memory objects. The Tair cluster is a cloud-native memory database that can provide rich data models and enterprise-level capabilities to help build real-time online scenarios on the basis of being compatible with the redis cluster. Based on this, the user can use the terminal 102 to trigger an upgrade request for any cache cluster 1042 to the main server 104, and the main server 104 can use the cache cluster 1042 indicated by the upgrade request as the target cluster. In addition, for each cache cluster 1042, the main server 104 can also deploy candidate nodes (not shown in FIG. 1) that match each cache cluster 1042, so that in the process of upgrading any cache cluster 1042, if a node upgrade exception occurs, the candidate nodes can be used to maintain the normal operation of the cluster.
[0039] Specifically, when the main server 104 receives an upgrade request for the target cluster, the main server 104 can first obtain at least one master node in the target cluster, and at least one slave node associated with each master node, and determine the target master node to be upgraded from at least one master node, and upgrade the target slave node associated with the target master node. If there is an abnormal slave node with an upgrade abnormality in the target slave node, the main server 104 can obtain the target candidate node matched by the abnormal slave node, replace the abnormal slave node with the target candidate node and suspend the upgrade process until it is detected that there is an upgraded node connected to the target master node, replace the target candidate node with the upgraded node, and resume the upgrade process. When the target slave nodes associated with the target master node have been upgraded, the main server 104 switches any one of the target slave nodes with the target master node, upgrades the target master node after the master-slave switch, and switches the upgraded target master node back to the master node to complete the upgrade of the target master node and the target slave node associated with the target master node.
[0040] In an exemplary embodiment, as shown in FIG2 , a cluster upgrade control method is provided, which is described by taking the method applied to the main server 104 in FIG1 as an example, and includes the following steps 202 to 208. Among them:
[0041] Step 202, when an upgrade request for a target cluster is received, obtain at least one master node in the target cluster and at least one slave node associated with each master node, determine the target master node to be upgraded from the at least one master node, and upgrade the target slave node associated with the target master node.
[0042] The nodes in the cluster can be computers for processing data / tasks assigned to the cluster. The target cluster can include at least one master-multiple slave node architecture. In the same master-multiple slave node architecture, the master node is responsible for coordinating and controlling the allocation, scheduling and monitoring of tasks. It receives task requests and assigns tasks to slave nodes for execution according to certain strategies. The slave nodes are responsible for executing the tasks assigned to them by the master node and returning the execution results to the master node. The master node and its associated slave node have the same device model, operating system, and configuration content, and data synchronization is maintained between the two.
[0043] Optionally, when the main server receives an upgrade request for a cache cluster, the main server may use the cache cluster indicated by the upgrade request as the target cluster, and obtain at least one master node in the target cluster, and at least one slave node associated with each master node. Further, the main server may determine the target master node to be upgraded from at least one master node according to the master node upgrade rule in the target cluster, and upgrade the target slave nodes associated with the target master node in sequence according to the slave node upgrade rule for the target slave node associated with the target master node.
[0044] Step 204: If there is an abnormal slave node with an upgrade abnormality among the target slave nodes, a target candidate node matching the abnormal slave node is obtained.
[0045] Among them, the target candidate node matched by the abnormal slave node specifically refers to: the device model, operating system, configuration content, etc. of the target candidate node are consistent with the matched abnormal slave node, and since the candidate node is connected to the target cluster, the candidate node always keeps data synchronization with the matched abnormal slave node. In addition, the target candidate node is a node that has been upgraded and configured with the latest version. The number or name of the candidate node matched by each slave node can be associated with the number or name of the matched slave node, so that the main server can quickly determine the target candidate node that matches the abnormal slave node from the candidate node.
[0046] Optionally, for the target cluster, the user can configure a matching candidate node for each slave node in the target cluster, so that the candidate node has the same device model, operating system, and configuration content as the matched slave node, and has completed the upgrade, and connect the candidate nodes that match each slave node in the target cluster to the target cluster, so that the candidate nodes can maintain data synchronization with their respective matched slave nodes, so that when an upgrade anomaly occurs later, the candidate nodes can be flexibly used to replace the abnormal slave nodes and successfully temporarily take over the data processing tasks in the target cluster. Based on this, in the process of the main server controlling the sequential upgrade of the target slave nodes associated with the target master node, if an abnormal slave node with an upgrade anomaly is detected in the target slave node, the main server can quickly determine the target candidate node that matches the abnormal slave node from each candidate node based on the names of the candidate nodes connected to the target cluster.
[0047] Step 206, replace the abnormal slave node with the target candidate node and suspend the upgrade process until it is detected that there is an upgraded node connected to the target master node, replace the target candidate node with the upgraded node, and resume the upgrade process.
[0048] Optionally, the main server may replace the abnormal slave node with the target candidate node and suspend the upgrade process until it detects that there is an upgraded node connected to the target master node, that is, until it detects that there is an upgraded node that can replace the target candidate node, then the target candidate node is replaced with the upgraded node, so that the upgraded node becomes the upgraded target slave node associated with the target master node, and resumes the upgrade process, that is, continues to upgrade the next target slave node. If there is no next target slave node, it is determined that all target slave nodes associated with the target master node have been upgraded.
[0049] It should be noted that the upgraded node can be any of the following: (1) an upgraded new device connected to the target cluster after the equipment represented by the abnormal slave node fails to be repaired; (2) an upgraded and repaired abnormal slave node connected to the target cluster after the equipment represented by the abnormal slave node is successfully repaired (it can be manually upgraded after successful repair).
[0050] Exemplarily, taking the case where a target master node is associated with multiple target slave nodes, if the i-th target slave node associated with the target master node is being upgraded, and there is an upgrade abnormality in the i-th target slave node, the main server can treat the i-th target slave node as an abnormal slave node, replace the abnormal slave node with a target candidate node, and suspend the upgrade process until it detects that an upgraded node is connected to the target master node, replaces the target candidate node with the upgraded node, makes the upgraded node serve as the upgraded i-th target slave node, and then resumes the upgrade of the next target slave node associated with the target master node.
[0051] Step 208, when all target slave nodes associated with the target master node have been upgraded, any one of the target slave nodes is switched with the target master node, the target master node after the master-slave switch is upgraded, and the upgraded target master node is switched back to the master node.
[0052] The master-slave switch specifically refers to: switching the master node in the original one-master-multiple-slave architecture to a slave node, and switching the slave node to the master node. Considering that the master node needs to take on the work of responding to task processing requests, once the master node is abnormal, it will have a great impact on the cluster. Therefore, when upgrading the master node in the future, consider downgrading the master node to a slave node before upgrading.
[0053] Optionally, when all the target slave nodes associated with the target master node have been upgraded, the main server can perform a master-slave switch between any of the target slave nodes and the target master node, so as to downgrade the target master node to a temporary slave node and then upgrade the target master node, so that during the upgrade of the original target master node, the target slave node switched to a temporary master node can replace the target master node to maintain the stable operation of the target cluster. Further, when it is detected that the target master node is successfully upgraded after the master-slave switch, the upgraded target master node is switched back to the master node.
[0054] It should be noted that during the upgrade of the temporary slave node, if an upgrade exception occurs (the temporary slave node can be regarded as an abnormal slave node with an upgrade exception), any candidate node associated with the master-slave architecture to which the temporary slave node belongs can also be used to replace the temporary slave node. In the case where the temporary slave node is replaced, the upgrade process will also be suspended until it is detected that the upgraded node is connected to the temporary master node (that is, connected to the target cluster), then the candidate node used to replace the temporary slave node will be replaced by the upgraded node, so that the upgraded node becomes the temporary slave node. Further, the temporary master node and the temporary slave node are switched from master to slave, so that the upgraded node, as a temporary slave node, returns to the position of the master node, and the temporary master node returns to the position of the slave node. Among them, the upgraded node can be any of the following: (1) After the temporary slave node (that is, the target master node after the master-slave switch) fails to be repaired, the upgraded new device connected to the target cluster, the new device is consistent with the device model, operating system, and configuration content of the target master node; (2) After the temporary slave node is successfully repaired (it can be manually upgraded after the repair is successful), the repaired and upgraded temporary slave node connected to the target cluster. In addition, during the node replacement process, data synchronization is required between nodes.
[0055] Based on the above steps 202 to 208, as shown in FIG3, a schematic diagram of a process for upgrading a target master node and at least one target slave node associated with the target master node is provided, which mainly includes the following steps:
[0056] Step 302, receiving an upgrade request for a target cluster;
[0057] Step 304, obtaining at least one master node in the target cluster and at least one slave node associated with each master node, and determining a target master node to be upgraded from the at least one master node;
[0058] Step 306, upgrading the target slave node associated with the target master node;
[0059] If there is an abnormal slave node with an upgrade abnormality among the target slave nodes, execute step 308 to obtain a target candidate node matching the abnormal slave node; then execute step 310 to replace the abnormal slave node with the target candidate node and suspend the upgrade process; if during the process of suspending the upgrade process, it is not detected that an upgraded node is connected to the target master node, execute step 312 to continue to suspend the upgrade process; if during the process of suspending the upgrade process, it is detected that an upgraded node is connected to the target master node, execute step 314 to replace the target candidate node with the upgraded node, and resume the upgrade process; wherein, after executing step 314, the upgraded node becomes the target slave node associated with the target master node; further, after resuming the upgrade process, it is necessary to determine whether all the target slave nodes associated with the target master node have been upgraded;
[0060] If there is no abnormal slave node with an upgrade abnormality among the target slave nodes, during the process of upgrading the target slave nodes, it is also necessary to determine whether all the target slave nodes associated with the target master node have been upgraded;
[0061] Furthermore, if all the target slave nodes associated with the target master node have been upgraded, execute step 316, perform master-slave switching of any one of the target slave nodes with the target master node, upgrade the target master node after the master-slave switching, and switch the upgraded target master node back to the master node; otherwise, return to step 306 to continue upgrading the target slave node.
[0062] The above cluster upgrade control method first obtains at least one master node in the target cluster indicated by the upgrade request, and at least one slave node associated with each master node, and determines the target master node to be upgraded from at least one master node, and then upgrades the target slave node associated with the target master node. If there is an abnormal slave node with an upgrade abnormality in the target slave node, the target candidate node matching the abnormal slave node is obtained, the abnormal slave node is replaced with the target candidate node and the upgrade process is suspended, so that the target candidate node replaces the abnormal slave node to maintain the normal operation of the target cluster, ensuring the business continuity of the upgrade process, until it is detected that there is an upgraded node connected to the target master node, and then the target candidate node is replaced with the upgraded node to replace the target candidate node, restore the original architecture of the target cluster, and resume the upgrade process. When the target slave nodes associated with the target master node have been upgraded, any one of the target slave nodes can be switched from the master to the slave with the target master node, so that the upgraded target slave node replaces the target master node to maintain the normal operation of the target cluster, ensuring the business continuity of the upgrade process, and then the target master node after the master-slave switch is upgraded, and the upgraded target master node is switched back to the master node. By adopting the above method, the business continuity of the target cluster during the upgrade process can be ensured through the replacement of the target candidate node and the master-slave switching between the target master node and the target slave node.
[0063] In an exemplary embodiment, based on FIG. 2 , as shown in FIG. 4 , a flow chart of implementing cluster upgrade control according to the master node upgrade sequence and the slave node upgrade sequence in the target cluster is provided, which mainly includes the following steps:
[0064] Step 402: When an upgrade request for a target cluster is received, at least one master node in the target cluster and at least one slave node associated with each master node are obtained to determine an upgrade order of the master nodes of the target cluster.
[0065] Among them, each cache cluster has its own corresponding master node upgrade order, and the slave node upgrade order of the slave nodes associated with each master node in the cluster, which can be flexibly configured according to the actual application scenario.
[0066] Optionally, when receiving an upgrade request for the target cluster, the main server may first determine at least one master node in the target cluster, and at least one slave node associated with each master node. Each node in the target cluster may have its own number or name so that the main server can identify the node. Based on this, the main server may pre-store the master node upgrade order of all master nodes in the target cluster, and the slave node upgrade order of the slave nodes associated with each master node, and the master node upgrade order may specifically be in the following form: the sorting result of the numbers or names of all master nodes in the target cluster, and the slave node upgrade order of the slave nodes associated with a certain master node may specifically be in the following form: the sorting result of the numbers or names of all slave nodes associated with the master node.
[0067] Exemplarily, the master node upgrade sequence and slave node upgrade sequence of the target cluster pre-configured in the main server can be configured in the following manner: (1) The user can pre-build the corresponding master node upgrade sequence according to the number or name of each master node in the target cluster and the upgrade requirements, and associate the constructed master node upgrade sequence with the target cluster, for example, associate the master node upgrade sequence with the number or name of the target cluster, and then store the associated master node upgrade sequence for subsequent acquisition. Based on this, the main server can subsequently query and obtain the master node upgrade sequence corresponding to the target cluster according to the number or name of the target cluster. (2) For the slave nodes associated with each master node in the target cluster, the user can pre-build the slave node upgrade sequence of each slave node associated with the master node for each master node in the target cluster according to the number or name of each slave node associated with the master node, and associate the constructed slave node upgrade sequence with the number or name of the corresponding master node, and then store the associated slave node upgrade sequence. That is, each master node in the target cluster has a slave node upgrade sequence associated with the number or name of the master node. Based on this, the subsequent main server can query and obtain the slave node upgrade order of each target slave node associated with the target master node according to the number or name of the target master node.
[0068] Step 404: determine a target master node to be upgraded from at least one master node according to the master node upgrade sequence, and obtain a slave node upgrade sequence of at least one target slave node associated with the target master node.
[0069] Optionally, after determining the upgrade order of the master nodes corresponding to the target cluster, the main server can determine the master nodes in the target cluster as the target master nodes to be upgraded in sequence according to the master node upgrade order, that is, determine the target master node to be upgraded from at least one master node, and according to the number or name of the target master node, obtain the slave node upgrade order of at least one target slave node associated with the target master node from the data stored on the main server.
[0070] Step 406: upgrade at least one target slave node associated with the target master node in sequence according to the slave node upgrade sequence.
[0071] Optionally, the main server can upgrade at least one target slave node associated with the target master node in sequence according to the order of the number or name of each target slave node in the slave node upgrade sequence, that is, first upgrade each target slave node in the one-master-multiple-slave architecture to which the target master node belongs, so that the target master node can be subsequently downgraded to a slave node through a master-slave switch, and then upgraded, thereby quickly completing the upgrade of each node in the one-master-multiple-slave architecture to which the target master node belongs. Instead of first upgrading the master node in the one-master-multiple-slave architecture to which the target master node belongs, and then upgrading each target slave node in the one-master-multiple-slave architecture to which the target master node belongs in turn through multiple master-slave switches, compared with this method that requires multiple master-slave switches to upgrade the master node, the cluster upgrade control method in this embodiment can improve the cluster upgrade efficiency and reduce the probability of cluster upgrade anomalies caused by frequent master-slave switches.
[0072] In this embodiment, each node in the target cluster can be accurately upgraded in sequence according to the preset upgrade sequence, avoiding target cluster upgrade failure due to disordered upgrade sequence, thereby ensuring the stability of the target cluster upgrade control process and further ensuring the business continuity of the target cluster upgrade process.
[0073] In some embodiments, as shown in FIG5 , a schematic diagram of a process for implementing cluster upgrade control by isolating and upgrading slave nodes in sequence is provided, which mainly includes the following steps:
[0074] Step 502: Determine a first slave node to be upgraded from at least one target slave node according to the upgrade sequence of the slave nodes.
[0075] Optionally, the main server may traverse each target slave node according to the order of numbers or names of each target slave node in the slave node upgrade sequence to determine a first slave node to be upgraded from at least one target slave node.
[0076] Step 504: isolate the first slave node from the target cluster, and upgrade the isolated first slave node.
[0077] Optionally, to avoid interference of the upgrade process with the operation of the target cluster, after determining the first slave node to be upgraded, the main server can automatically trigger a node deletion instruction for the first slave node to isolate the first slave node from the target cluster, and then upgrade the isolated first slave node.
[0078] Exemplarily, after triggering the node deletion instruction for the first slave node, the main server can check the information recorded in the log of the main server within a preset time period to determine whether the first slave node is successfully isolated from the target cluster. If there is prompt information in the log indicating that the first slave node has exited from the target cluster, it is determined that the first slave node is successfully isolated from the target cluster.
[0079] Step 506: When the first slave node completes the upgrade, the upgraded first slave node is connected to the target cluster as a target slave node associated with the target master node.
[0080] Optionally, when it is detected that the first slave node has completed upgrading, the main server may automatically trigger a node adding instruction for the upgraded first slave node to connect the upgraded first slave node to the target cluster as a target slave node associated with the target master node.
[0081] Exemplarily, after triggering the node adding instruction for the first slave node, the main server can check the information recorded in the log of the main server within a preset time period to determine whether the upgraded first slave node is successfully reconnected to the target cluster. If there is prompt information in the log indicating that the first slave node is added to the target cluster as a target slave node of the target master node, it is determined that the upgraded first slave node is successfully reconnected to the target cluster.
[0082] It should be noted that during the upgrade of the first slave node, the main server needs to monitor whether there is an upgrade anomaly in the first slave node. If so, determine the target candidate node that matches the first slave node (abnormal slave node), use the target candidate node that matches the first slave node to replace the first slave node, and suspend the upgrade process, so that during the process of suspending the upgrade, the target candidate node that matches the first slave node can replace the first slave node to maintain the normal operation of the target cluster. Furthermore, during the process of suspending the upgrade process, if it is detected that there is an upgraded node connected to the target master node, the upgraded node can be used to replace the target candidate node that matches the first slave node, so that the upgraded node can access the target cluster as the upgraded first slave node.
[0083] Step 508: Determine a second slave node to be upgraded from at least one target slave node according to the upgrade sequence of the slave nodes.
[0084] Optionally, after the upgrade of the first slave node is completed, the main server can determine whether there are any target slave nodes that have not been upgraded according to the upgrade order of the slave nodes. If so, the main server will use the next target slave node in the upgrade order of the first slave node as the second slave node, and isolate the second slave node from the target cluster to upgrade the isolated second slave node. When the upgrade of the second slave node is completed, it is determined whether there are any target slave nodes that have not been upgraded.
[0085] It should be noted that during the upgrade of the second slave node, the main server also needs to monitor whether there is an upgrade anomaly in the second slave node. If so, determine the target candidate node that matches the second slave node (abnormal slave node), use the target candidate node that matches the second slave node to replace the second slave node, and suspend the upgrade process, so that during the process of suspending the upgrade, the target candidate node that matches the second slave node can replace the second slave node to maintain the normal operation of the target cluster. Furthermore, during the process of suspending the upgrade process, if it is detected that there is an upgraded node connected to the target master node, the upgraded node can be used to replace the target candidate node that matches the second slave node, so that the upgraded node can be connected to the target cluster as the upgraded second slave node, and then determine whether there are any target slave nodes that have not been upgraded.
[0086] When all the target slave nodes have completed upgrading, the main server may execute step 510 to perform a master-slave switch between any one of the target slave nodes and the target master node; otherwise, the process returns to step 502.
[0087] In this embodiment, the target slave nodes associated with the target master node can be upgraded in sequence to ensure the stable operation of the cluster upgrade control process, thereby ensuring the stable progress of the target cluster upgrade control process and further ensuring the business continuity of the target cluster upgrade process.
[0088] In a possible implementation, based on FIG. 3 , as shown in FIG. 6 , a flow chart of implementing cluster upgrade control through master-slave switching is provided, which mainly includes the following steps:
[0089] Step 602: Perform a master-slave switch between any of the upgraded target slave nodes and the target master node, and use the target master node after the master-slave switch as a temporary slave node and the target slave node after the master-slave switch as a temporary master node.
[0090] Optionally, after all target slave nodes associated with the target master node have been upgraded, the main server can perform a master-slave switch between any of the upgraded target slave nodes and the target master node, and use the target master node after the master-slave switch as a temporary slave node.
[0091] Step 604: isolate the temporary slave node from the target cluster, and upgrade the isolated temporary slave node.
[0092] Optionally, the main server can automatically trigger a node deletion instruction for the temporary slave node to isolate the temporary slave node from the target cluster, and then upgrade the isolated temporary slave node. After triggering the node deletion instruction for the temporary slave node, the main server can check the information recorded in the log of the main server within a preset time period to determine whether the temporary slave node is successfully isolated from the target cluster.
[0093] Step 606: When the temporary slave node completes the upgrade, the temporary slave node and the temporary master node are switched from master to slave, so that the upgraded target master node is switched back to the master node.
[0094] Optionally, when it is detected that the temporary slave node has completed the upgrade, the main server can reconnect the temporary slave node to the target cluster, for example, establish a connection between the temporary slave node and the temporary master node, and then perform a master-slave switch on the temporary slave node and the temporary master node, so that the temporary slave node (that is, the upgraded target master node) switches back to the master node, and the temporary master node switches back to the slave node.
[0095] It should be noted that during the upgrade of the temporary slave node (that is, the target master node after the master-slave switch), the main server needs to monitor whether there is an upgrade anomaly in the temporary slave node. If it occurs, any candidate node in the one-master-multiple-slave architecture to which the temporary slave node belongs can be used to replace the temporary slave node, and the upgrade process can be suspended, so that during the suspension of the upgrade, the candidate node can replace the temporary slave node to maintain the normal operation of the target cluster and ensure the business continuity of the upgrade process. Furthermore, during the suspension of the upgrade process, if it is detected that there is an upgraded node connected to the temporary master node, the upgraded node can be used to replace the candidate node used to temporarily replace the temporary slave node, so that the upgraded node can be connected to the target cluster as an upgraded temporary slave node, and then the temporary master node and the upgraded temporary slave node can be switched from master to slave.
[0096] In this embodiment, after completing the upgrade of all target slave nodes in the one-master-multiple-slave architecture to which the target master node belongs, the target master node in the one-master-multiple-slave architecture can be downgraded to a temporary slave node for upgrade through a master-slave switch, thereby avoiding the impact on the normal operation of the cluster due to the direct upgrade of the target master node in the master node position. In addition, the business continuity of the cluster upgrade process can be ensured by flexibly replacing the candidate node during the upgrade of the temporary slave node.
[0097] In one embodiment, based on FIG. 6 , as shown in FIG. 7 , a schematic diagram of a process for implementing cluster upgrade control by sequentially upgrading the master nodes in the cluster is provided, wherein:
[0098] When the target master node is upgraded, if there are still master nodes to be upgraded, step 702 is executed to determine the next target master node according to the upgrade sequence of the master nodes of the target cluster.
[0099] Optionally, the main server may determine the next master node to be upgraded, that is, the next target master node, according to the upgrade sequence of the master nodes of the target cluster.
[0100] Then execute step 704 to upgrade the next target master node and at least one target slave node associated with the next target master node.
[0101] Optionally, the main server can upgrade at least one target slave node associated with the next target master node according to the upgrade order of the slave nodes associated with the next target master node, and during the upgrade process, if an upgrade exception occurs, the matched candidate node is used for flexible replacement. After completing the upgrade of the target slave node associated with the next target master node, the next target master node is upgraded through another master-slave switch, and during the upgrade process, if an upgrade exception occurs, the matched candidate node is used for flexible replacement. Based on this, the business continuity of the upgrade process can be ensured.
[0102] Until all nodes to be upgraded in the target cluster (including the master node to be upgraded and slave nodes associated with the master node to be upgraded) have been upgraded, step 706 is executed to obtain the upgraded target cluster; otherwise, it is continued to determine whether there is still a master node to be upgraded.
[0103] In this embodiment, the master node and the slave nodes in the target cluster may be upgraded in sequence by repeating the above upgrade steps, and the business continuity of the target cluster may be ensured during the upgrade process.
[0104] In one of the embodiments, the cluster upgrade control method further includes: isolating the candidate nodes connected to the target cluster from the upgraded target cluster.
[0105] Optionally, after the upgrade is completed, the main server can automatically trigger a node deletion instruction for candidate nodes that have not been used, or candidate nodes that have been used and replaced, so as to isolate all candidate nodes connected to the target cluster from the upgraded target cluster. In addition, after the node deletion instruction is triggered for all candidate nodes, the main server can check the information recorded in the log in the main server within a preset time to determine whether all candidate nodes have been successfully isolated from the target cluster. If there is a prompt message in the log indicating that all candidate nodes have exited the target cluster, it is determined that all candidate nodes have been successfully isolated from the target cluster.
[0106] In this embodiment, after completing the upgrade of the target cluster, the original architecture of the target cluster can be restored by isolating all candidate nodes from the target cluster. That is, in each embodiment of the above-mentioned cluster upgrade control method, the candidate nodes are mainly used as auxiliary devices or temporary devices to assist the cluster upgrade process, provide a backup for nodes with upgrade exceptions, and ensure business continuity during the cluster upgrade process.
[0107] In one embodiment, as shown in FIG8 , a flow chart of testing the availability of a cluster upgrade control method is provided, which mainly includes the following steps:
[0108] In the process of controlling the target cluster upgrade, step 802 is executed to send test data to the target cluster so that the target cluster processes the test data during the upgrade process and monitors the node data generated by each node in the target cluster due to processing the test data.
[0109] Optionally, during the upgrade process of the target cluster, the main server can simulate the daily work process of the target cluster through a stress simulator deployed on the main server to test the processing of external tasks by the target cluster in the process of controlling the upgrade without downtime, that is, the stress simulator generates test data that can simulate daily data processing tasks, and sends the test data to the target cluster so that the target cluster processes the test data during the upgrade process. Furthermore, the main server can monitor the node data generated by each node in the target cluster due to processing the test data through a preset monitoring program.
[0110] Step 804: after the target cluster is upgraded, the node data generated by each node in the target cluster is compared to obtain a data consistency comparison result.
[0111] Optionally, after the target cluster is upgraded, for each one-master-multiple-slave architecture in the target cluster, the main server can compare the node data monitored throughout the upgrade process to determine whether the master node and the slave node in the one-master-multiple-slave architecture have maintained node data synchronization in real time during the upgrade process, and whether the final node data synchronization and data structure synchronization have been achieved after the upgrade is completed, so as to obtain the data consistency comparison result of each one-master-multiple-slave architecture in the target cluster. Further, for the entire target cluster, the main server can also monitor the node data generated by each node in the target cluster due to processing test data throughout the process, and monitor the TPS (Transaction Per second, the number of transactions or transactions that the target cluster can process per second) curve of the entire target cluster to monitor whether the data level processed by the entire target cluster after the upgrade is consistent with that before the upgrade, and whether it also responds well to data processing instructions during the upgrade, so as to obtain the data processing performance consistency comparison result of the entire target cluster. Based on this, the main server can collect the data consistency comparison results of each one-master-multiple-slave architecture in the target cluster, and the data processing performance consistency comparison results for the entire target cluster, and obtain the data consistency comparison result of the target cluster.
[0112] Step 806: Determine the availability detection result of the upgrade process for the target cluster according to the data consistency comparison result.
[0113] Optionally, if the data consistency comparison results of each one-master-multiple-slave architecture in the target cluster indicate that the one-master-multiple-slave architecture maintains good data consistency during the upgrade process, and the data processing performance consistency comparison results indicate that the target cluster maintains data processing performance that is almost consistent with that before the upgrade during and after the upgrade, then the main server can determine that the target cluster also maintains good availability during the upgrade process. Otherwise, it is determined that the target cluster cannot maintain good availability during the upgrade process, and the cluster upgrade control process needs to be further optimized.
[0114] It should be noted that if there are small data differences between a small number of nodes (a small amount of data cannot be synchronized), or the data processing performance consistency comparison results indicate that there are a small number of errors when a node is replaced or upgraded in the target cluster, but the error results are within the failure indicator tolerance range (there are normal fluctuations), considering that the replaced or upgraded nodes can instantly resume data processing, the main server can still determine that the target cluster maintains good high availability during the upgrade process.
[0115] In this embodiment, during the upgrade process of the target cluster, the correctness of the above-mentioned cluster upgrade control method can be tested by simulating the daily data processing process of the target cluster. For example, the consistency of real-time data synchronization of each node in the target cluster, the consistency of data structure, the consistency of cluster performance, etc. can be tested during the upgrade process to verify whether the above-mentioned cluster upgrade control method meets the business continuity indicators, so as to ensure that the cluster upgrade control method can maintain business continuity during the cluster upgrade process.
[0116] In a specific application scenario, as shown in FIG9 , a schematic diagram of a target cluster including candidate nodes is provided. It is assumed that the target cluster needs to be upgraded from the old version to the target version, and the target cluster includes three master nodes (Master1, Master2, and Master3), each of which is associated with two slave nodes, and each slave node has its own candidate node, that is, there are a total of six slave nodes (Slave11, Slave12, Slave21, Slave22, Slave31, and Slave32) and six candidate nodes (Slave11', Slave12', Slave21', Slave22', Slave31', and Slave32'). For example, each candidate node is consistent with the matched slave node in terms of device model, operating system, and configuration content. The main server can upgrade the target cluster through the following steps:
[0117] (1) First determine the infrastructure of the target cluster, then select six devices as six candidate nodes based on the device model and operating system of each node in the target cluster, install the target version on the six candidate nodes, and modify the configuration contents in the configuration files of the six candidate nodes to be consistent with the configuration contents of the matched slave nodes, so that the device model, operating system, and configuration contents of the six candidate nodes are consistent with those of the matched slave nodes.
[0118] (2) By automatically triggering the node addition instruction, the six candidate nodes are connected to the target cluster. For example, the IP and port of the six candidate nodes are added to the configuration file list of the target cluster. Then, each candidate node is connected to its matching slave node and the master node associated with the matching slave node, so that each master node is associated with two slave nodes and two candidate nodes. For example, Master1 is associated with Slave11, Slave12, Slave11', Slave12', and Slave11' is associated with Slave11, and Slave12' is associated with Slave12. In addition, during and after the connection process, the candidate nodes will synchronize data with the connected nodes. This data synchronization process can also verify the feasibility of data synchronization between the new version nodes (candidate nodes) and the old version nodes (master nodes or slave nodes) of the target cluster.
[0119] (3) According to the upgrade order of the master nodes in the target cluster (for example, upgrade in order from small to large node numbers), first isolate the slave node Slave11 of Master1 from the target cluster, upgrade Slave11, and if there are no abnormalities in the upgrade process, reconnect the upgraded Slave11 to the cluster. If an upgrade abnormality occurs in Slave11, the upgrade is suspended and Slave11' is used to replace Slave11 until it is detected that the upgraded node is reconnected to the target cluster as the slave node of Master1. Then, Slave11' is replaced with the upgraded node, so that the upgraded node becomes the upgraded Slave11, and the upgrade process is resumed to upgrade Slave12.
[0120] (4) If all the slave nodes of Master1 have been upgraded, Master1 and the upgraded slave node (Slave11 or Slave12) will be switched between master and slave, and then isolated from the target cluster to upgrade the Master1 after the master-slave switch. If an upgrade exception occurs in Master1, the upgrade will be suspended, and either Slave11' or Slave12' will be used to replace Master1 until the upgraded node is detected to be connected to the target cluster. In this case, the upgraded node will be used to replace any candidate node used to temporarily replace Master1, so that the upgraded node becomes the upgraded Master1, and the upgrade process will be resumed to upgrade Master2.
[0121] (5) Repeat (1) to (4) to upgrade Master2, Slave21 and Slave22 associated with Master2, Master3, Slave31 and Slave32 associated with Master3 in sequence.
[0122] (6) After all nodes to be upgraded in the target cluster are upgraded, the six candidate nodes can be removed from the target cluster, that is, the six candidate nodes are isolated from the target cluster to restore the original architecture of the target cluster.
[0123] In an alternative embodiment, as shown in FIG10 , based on the above embodiments, a flow chart of another cluster upgrade control method is provided, which mainly includes the following steps:
[0124] (1) Obtain multiple master nodes and slave nodes in the target cluster, and deploy multiple upgraded candidate nodes for the target cluster;
[0125] (2) Connect multiple candidate nodes to the target cluster and synchronize the data in the target cluster to multiple candidate nodes;
[0126] (3) According to the rule of first upgrading the slave nodes associated with the master node, and then upgrading the master node through master-slave switching, the nodes in the target cluster are upgraded in sequence. If an abnormality occurs during the upgrade process, the abnormal node is replaced with a candidate node;
[0127] (4) After the target cluster is upgraded, multiple candidate nodes are removed from the target cluster;
[0128] (5) During the execution of steps (1) to (4), the working process of the target cluster is simulated by the stress simulator, and the node data generated by the target cluster during the upgrade process due to the processing of test data is recorded to verify the data consistency of each node in the target cluster during the upgrade process and the consistency of the data processing capability of the entire target cluster. Therefore, after executing steps (1) to (4), the data consistency of each node in the target cluster before and after the upgrade and the consistency of the data processing performance of the target cluster can be verified based on the node data of the target cluster monitored during the upgrade process.
[0129] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0130] Based on the same inventive concept, the embodiment of the present application also provides a cluster upgrade control device for implementing the cluster upgrade control method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more cluster upgrade control device embodiments provided below can refer to the limitations of the cluster upgrade control method above, and will not be repeated here.
[0131] In an exemplary embodiment, as shown in FIG11 , a cluster upgrade control device is provided, including: a to-be-upgraded node determination module 1102, an abnormal slave node processing module 1104, and a master node upgrade processing module 1106, wherein:
[0132] The node determination module to be upgraded is used for, when receiving an upgrade request for a target cluster, obtaining at least one master node in the target cluster and at least one slave node associated with each master node, determining a target master node to be upgraded from the at least one master node, and upgrading a target slave node associated with the target master node;
[0133] The abnormal slave node processing module is used to obtain the target candidate node matched by the abnormal slave node if there is an abnormal slave node with an upgrade abnormality among the target slave nodes, replace the abnormal slave node with the target candidate node and suspend the upgrade process until it is detected that there is an upgraded node connected to the target master node, replace the target candidate node with the upgraded node, and resume the upgrade process;
[0134] The master node upgrade processing module is used to switch any of the target slave nodes with the target master node for master-slave switching when all the target slave nodes associated with the target master node have been upgraded, upgrade the target master node after the master-slave switching, and switch the upgraded target master node back to the master node.
[0135] The cluster upgrade control device first obtains at least one master node in the target cluster indicated by the upgrade request, and at least one slave node associated with each master node, and determines the target master node to be upgraded from the at least one master node, and then upgrades the target slave node associated with the target master node. If there is an abnormal slave node with an upgrade abnormality in the target slave node, the target candidate node matching the abnormal slave node is obtained, the abnormal slave node is replaced with the target candidate node and the upgrade process is suspended, so that the target candidate node replaces the abnormal slave node to maintain the normal operation of the target cluster, ensuring the business continuity of the upgrade process, until it is detected that there is an upgraded node connected to the target master node, and then the target candidate node is replaced with the upgraded node to replace the target candidate node, restore the original architecture of the target cluster, and resume the upgrade process. When the target slave nodes associated with the target master node have been upgraded, any one of the target slave nodes can be switched from the target master node to the master-slave node, so that the upgraded target slave node replaces the target master node to maintain the normal operation of the target cluster, ensuring the business continuity of the upgrade process, and then the target master node after the master-slave switch is upgraded, and the upgraded target master node is switched back to the master node. By adopting the above method, the business continuity of the target cluster during the upgrade process can be ensured through the replacement of the target candidate node and the master-slave switching between the target master node and the target slave node.
[0136] In one of the embodiments, the module for determining nodes to be upgraded includes: a master node sequence determination unit, used to determine the master node upgrade sequence of the target cluster; a master node upgrade processing unit, used to determine the target master node to be upgraded from at least one master node according to the master node upgrade sequence, and obtain the slave node upgrade sequence of at least one target slave node associated with the target master node; a slave node upgrade processing unit, used to upgrade at least one target slave node associated with the target master node in sequence according to the slave node upgrade sequence.
[0137] In one of the embodiments, the master node upgrade processing unit is specifically used to: determine a first slave node to be upgraded from at least one target slave node according to a slave node upgrade sequence; isolate the first slave node from the target cluster, and upgrade the isolated first slave node; when the first slave node completes the upgrade, connect the upgraded first slave node to the target cluster as a target slave node associated with the target master node; determine a second slave node to be upgraded from at least one target slave node according to the slave node upgrade sequence, until at least one target slave node completes the upgrade.
[0138] In one of the embodiments, the master node upgrade processing module includes: a first master-slave switching unit, used to perform master-slave switching on any one of the upgraded target slave nodes and the target master node, and use the target master node after the master-slave switching as a temporary slave node, and use the target slave node after the master-slave switching as a temporary master node; a slave node isolation upgrade unit, used to isolate the temporary slave node from the target cluster, and upgrade the isolated temporary slave node; a second master-slave switching unit, used to perform master-slave switching on the temporary slave node and the temporary master node when the temporary slave node completes the upgrade, so that the upgraded target master node is switched back to the master node.
[0139] In one of the embodiments, the cluster upgrade control device also includes: a next master node determination module, which is used to determine the next target master node according to the master node upgrade order of the target cluster when the target master node is upgraded; a next master node upgrade module, which is used to upgrade the next target master node and at least one target slave node associated with the next target master node until all nodes to be upgraded in the target cluster have been upgraded to obtain an upgraded target cluster.
[0140] In one of the embodiments, the cluster upgrade control device further includes: a candidate node isolation module, configured to isolate the candidate nodes connected to the target cluster from the upgraded target cluster.
[0141] In one of the embodiments, the cluster upgrade control device also includes: a cluster testing module, which is used to send test data to the target cluster during the process of controlling the target cluster upgrade, so that the target cluster processes the test data during the upgrade process, and monitors the node data generated by each node in the target cluster due to processing the test data; a consistency comparison module, which is used to compare the node data generated by each node in the target cluster after the target cluster completes the upgrade, and obtain a data consistency comparison result; a detection result determination module, which is used to determine the availability detection result of the upgrade process for the target cluster based on the data consistency comparison result.
[0142] Each module in the above cluster upgrade control device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0143] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG12. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store cluster upgrade control data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a cluster upgrade control method is implemented.
[0144] Those skilled in the art will understand that the structure shown in FIG. 12 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0145] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above cluster upgrade control method when executing the computer program.
[0146] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above cluster upgrade control method are implemented.
[0147] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above cluster upgrade control method when executed by a processor.
[0148] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present 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. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0149] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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.
[0150] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A cluster upgrade control method, characterized in that: The method comprises: When an upgrade request for a target cluster is received, at least one master node in the target cluster and at least one slave node associated with each master node are obtained, a target master node to be upgraded is determined from the at least one master node, and a target slave node associated with the target master node is upgraded; If there is an abnormal slave node with an upgrade abnormality among the target slave nodes, obtain a target candidate node matching the abnormal slave node, replace the abnormal slave node with the target candidate node and suspend the upgrade process until it is detected that an upgraded node is connected to the target master node, replace the target candidate node with the upgraded node, and resume the upgrade process; When all target slave nodes associated with the target master node have been upgraded, any one of the target slave nodes is switched with the target master node as a master-slave node, the target master node after the master-slave switching is upgraded, and the upgraded target master node is switched back to the master node.
2. The method according to claim 1, characterized in that The step of determining a target master node to be upgraded from the at least one master node, and upgrading a target slave node associated with the target master node includes: Determine the upgrade order of the master nodes of the target cluster; According to the master node upgrade sequence, determine a target master node to be upgraded from the at least one master node, and obtain a slave node upgrade sequence of at least one target slave node associated with the target master node; According to the slave node upgrade sequence, at least one target slave node associated with the target master node is upgraded in sequence.
3. The method according to claim 2, characterized in that The step of sequentially upgrading at least one target slave node associated with the target master node according to the slave node upgrade sequence includes: Determining a first slave node to be upgraded from the at least one target slave node according to the slave node upgrade sequence; Isolating the first slave node from the target cluster, and upgrading the isolated first slave node; When the first slave node completes the upgrade, the upgraded first slave node is connected to the target cluster as a target slave node associated with the target master node; According to the slave node upgrade sequence, a second slave node to be upgraded is determined from the at least one target slave node until the at least one target slave node is upgraded.
4. The method according to claim 1, characterized in that The step of performing a master-slave switching between any one of the target slave nodes and the target master node, upgrading the target master node after the master-slave switching, and switching the upgraded target master node back to the master node includes: Performing a master-slave switch between any one of the upgraded target slave nodes and the target master node, and using the target master node after the master-slave switch as a temporary slave node, and using the target slave node after the master-slave switch as a temporary master node; Isolating the temporary slave node from the target cluster, and upgrading the isolated temporary slave node; When the temporary slave node completes the upgrade, the temporary slave node and the temporary master node are switched from a master node to a slave node, so that the upgraded target master node is switched back to a master node.
5. The method according to claim 1, characterized in that: The method further comprises: When the target master node is upgraded, the next target master node is determined according to the upgrade sequence of the master nodes of the target cluster; The next target master node and at least one target slave node associated with the next target master node are upgraded until all nodes to be upgraded in the target cluster are upgraded, thereby obtaining the upgraded target cluster.
6. The method according to claim 5, characterized in that The method further comprises: The candidate nodes connected to the target cluster are isolated from the upgraded target cluster.
7. The method according to claim 1, characterized in that The method further comprises: In the process of controlling the target cluster to upgrade, sending test data to the target cluster so that the target cluster processes the test data during the upgrade process, and monitoring node data generated by each node in the target cluster due to processing the test data; After the target cluster is upgraded, the node data generated by each node in the target cluster is compared to obtain a data consistency comparison result; According to the data consistency comparison result, an availability detection result of the upgrade process for the target cluster is determined.
8. A cluster upgrade control device, characterized in that: The device comprises: The node determination module to be upgraded is used for, when receiving an upgrade request for a target cluster, obtaining at least one master node in the target cluster and at least one slave node associated with each master node, determining a target master node to be upgraded from the at least one master node, and upgrading a target slave node associated with the target master node; The abnormal slave node processing module is used for obtaining a target candidate node matching the abnormal slave node if there is an abnormal slave node with an upgrade abnormality among the target slave nodes, replacing the abnormal slave node with the target candidate node and suspending the upgrade process until it is detected that there is an upgraded node connected to the target master node, replacing the target candidate node with the upgraded node, and resuming the upgrade process; The master node upgrade processing module is used to switch any one of the target slave nodes with the target master node as a master-slave when all the target slave nodes associated with the target master node have been upgraded, upgrade the target master node after the master-slave switching, and switch the upgraded target master node back to the master node.
9. The device according to claim 8, characterized in that The node to be upgraded determination module includes: A master node sequence determination unit, used to determine the upgrade sequence of the master nodes of the target cluster; A master node upgrade processing unit, configured to determine a target master node to be upgraded from the at least one master node according to the master node upgrade sequence, and obtain a slave node upgrade sequence of at least one target slave node associated with the target master node; The slave node upgrade processing unit is used to upgrade at least one target slave node associated with the target master node in sequence according to the slave node upgrade sequence.
10. The device according to claim 9, characterized in that The master node upgrade processing unit is specifically used to: Determining a first slave node to be upgraded from the at least one target slave node according to the slave node upgrade sequence; Isolating the first slave node from the target cluster, and upgrading the isolated first slave node; When the first slave node completes the upgrade, the upgraded first slave node is connected to the target cluster as a target slave node associated with the target master node; According to the slave node upgrade sequence, a second slave node to be upgraded is determined from the at least one target slave node until the at least one target slave node is upgraded.
11. The device according to claim 8, characterized in that The master node upgrade processing module includes: A first master-slave switching unit is used to perform a master-slave switching between any one of the upgraded target slave nodes and the target master node, and use the target master node after the master-slave switching as a temporary slave node and the target slave node after the master-slave switching as a temporary master node; A slave node isolation and upgrading unit, used to isolate the temporary slave node from the target cluster and upgrade the isolated temporary slave node; The second master-slave switching unit is used to perform master-slave switching on the temporary slave node and the temporary master node when the temporary slave node completes the upgrade, so that the upgraded target master node is switched back to the master node.
12. The device according to claim 8, characterized in that The device also includes: A next master node determination module, used to determine the next target master node according to the master node upgrade sequence of the target cluster when the target master node has completed the upgrade; The next master node upgrade module is used to upgrade the next target master node and at least one target slave node associated with the next target master node until all nodes to be upgraded in the target cluster have been upgraded to obtain the upgraded target cluster.
13. The device according to claim 12, characterized in that The device also includes: The candidate node isolation module is used to isolate the candidate nodes connected to the target cluster from the upgraded target cluster.
14. The device according to claim 8, characterized in that The device also includes: A cluster testing module, used for sending test data to the target cluster during the process of controlling the target cluster upgrade, so that the target cluster processes the test data during the upgrade process, and monitoring the node data generated by each node in the target cluster due to processing the test data; A consistency comparison module is used to compare the node data generated by each node in the target cluster after the target cluster is upgraded to obtain a data consistency comparison result; The detection result determination module is used to determine the availability detection result of the upgrade process for the target cluster according to the data consistency comparison result.
15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Storage node upgrading method, system and device, storage medium and electronic equipment
CN120523496A
Cluster node upgrading method and electronic equipment
CN121056326A