Node deployment method and apparatus, and electronic device

By deploying multiple master nodes in the first area and deploying corresponding slave nodes in the second area, and using physical isolation and voting mechanisms, the problems of node group availability and data disaster recovery in the event of master node failure are solved, and high availability and Reliable data synchronization.

WO2025035930A1PCT designated stage expired Publication Date: 2025-02-20LENOVO (BEIJING) LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/098614
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-15
Filing Date
2024-06-12
Publication Date
2025-02-20

AI Technical Summary

Technical Problem

The prior art is difficult to ensure the availability of node groups and the reliability of data disaster recovery when a master node fails.

Method used

By deploying a first node group in the first area, including M first master nodes, and deploying a first slave node corresponding to at least one first master node in the second area, the deployment conditions are met to ensure that the master node switches to the slave node. At the same time, physical isolation and voting mechanisms are used to determine the target slave nodes to ensure high availability of the node cluster in the event of failure.

Benefits of technology

It realizes high availability and data disaster recovery reliability in the event of a master node failure, ensuring the continuous operation of the node group and the normal synchronization of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024098614_20022025_PF_FP_ABST
    Figure CN2024098614_20022025_PF_FP_ABST
Patent Text Reader

Abstract

The present application discloses a node deployment method and apparatus, and an electronic device. The method comprises: deploying a first node group in a first area, wherein the first node group comprises M first master nodes, M being a positive integer such that when a fault occurs in the first node group, the number of master nodes in other node groups meets a deployment condition; and deploying a second node group in a second area, wherein the second node group comprises at least one first slave node corresponding to the first master node, the deployment condition being met represents that the number of master nodes in the other node groups is sufficient for determining to switch from the first master node to the first slave node, and the first area and the second area are physically isolated.
Need to check novelty before this filing date? Find Prior Art

Description

Node deployment method, device and electronic equipment

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on August 15, 2023, with application number 202311029173.1 and invention name “A Node Deployment Method, Device and Electronic Device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of data processing technology, and more specifically to a node deployment method, device and electronic device. Background Art

[0003] In order to ensure data security, a node group disaster recovery solution is usually adopted, in which the node group can include a master node and slave nodes. How to ensure the availability of the node group when the master node fails has become a problem that needs to be solved.

[0004] Summary of the Invention

[0005] In view of this, this application provides the following technical solutions:

[0006] A node deployment method, comprising:

[0007] Deploy a first node group in a first area; the first node group includes M first master nodes; M is a positive integer, and when the first node group fails, the number of master nodes in other node groups meets the deployment condition;

[0008] Deploy a second node group in a second area, where the second node group includes at least one first slave node corresponding to the first master node;

[0009] Among them, satisfying the deployment condition indicates that the number of master nodes in other node groups is sufficient to determine that the first master node is switched to the first slave node; and the first area and the second area are physically isolated.

[0010] Optionally, it also includes:

[0011] If the slave node corresponding to the first master node determines that the operating state of the first master node meets the switching condition, the operation of the first master node is switched to the target slave node corresponding to the first master node.

[0012] Optionally, it also includes:

[0013] If the operating status of the first master node meets the switching conditions, the slave node corresponding to the first master node initiates voting, votes through other master nodes except the first master node, and determines the target slave node among the slave nodes corresponding to the first master node based on the voting results.

[0014] Optionally, it also includes:

[0015] If after the switching, the sum of the number of the second master nodes in working state and the target slave nodes is greater than M, the operation of at least one other second master node except the target slave node is switched to the corresponding slave node.

[0016] Optionally, the second node group includes N second master nodes; N is a positive integer, and when the second node group fails, the number of master nodes in other node groups meets the deployment conditions, wherein meeting the deployment conditions indicates that the number of master nodes in other node groups is sufficient to determine that the second master node will be switched to the second slave node corresponding to the second master node.

[0017] Optionally, it also includes:

[0018] A third node group is deployed in a third area, the third node group including at least one first slave node corresponding to the first master node; wherein the third area is physically isolated from the first area, and the third area is physically isolated from the second area.

[0019] Optionally, it also includes:

[0020] If the transmission delay between the third area and the first area is higher than a threshold, deploying a first number of nodes corresponding to the first node group in the third area;

[0021] If the transmission delay between the third area and the first area is not higher than the threshold, deploying a second number of nodes corresponding to the first node group in the third area;

[0022] The first number is smaller than the second number.

[0023] Optionally, it also includes:

[0024] A master database is deployed on the first master node, and a slave database synchronized with the master database data is deployed on a first slave node corresponding to the first master node.

[0025] A node deployment device, comprising:

[0026] A first deployment module is configured to deploy a first node group in a first area; the first node group includes M first master nodes; M is a positive integer, and ensures that when a failure occurs in the first node group, the number of master nodes in other node groups meets a deployment condition;

[0027] a second deployment module, configured to deploy a second node group in a second area, the second node group including at least one first slave node corresponding to the first master node;

[0028] Among them, satisfying the deployment condition indicates that the number of master nodes in other node groups is sufficient to determine that the first master node is switched to the first slave node; and the first area and the second area are physically isolated.

[0029] An electronic device, comprising:

[0030] A memory, used to store applications and data generated by the execution of the applications;

[0031] A processor is used to execute the application program to implement the node deployment method as described in any one of the above.

[0032] Through the above technical solution, it can be seen that the present application discloses a node deployment method, device and electronic device, which includes: deploying a first node group in a first area; the first node group includes M first master nodes; M is a positive integer, and when the first node group fails, the number of master nodes of other node groups meets the deployment conditions; deploying a second node group in a second area, the second node group includes at least one first slave node corresponding to the first master node; wherein, satisfying the deployment conditions indicates that the number of master nodes of other node groups is sufficient to determine that the first master node is switched to the first slave node; the first area and the second area are physically isolated. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.

[0034] FIG1 is a schematic diagram of a process flow of a node deployment method provided in an embodiment of the present application;

[0035] FIG2 is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0036] FIG3 is a schematic diagram of the structure of a node deployment device provided in an embodiment of the present application;

[0037] FIG4 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0038] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0039] The terms "first", "second", etc. in the specification, claims, and above-mentioned drawings of the present application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0040] The embodiment of the present application provides a node deployment method, which can be applied in scenarios such as data storage, data disaster recovery, and data processing, wherein each node is a service (instance) that can implement the functions of storing data, indexing, and searching. A node group can be composed of multiple nodes, which provide resources to users as a whole. Specifically, a node can be a server, and a corresponding node group can be a computer room composed of multiple servers. The node deployment method provided by the embodiment of the present application can effectively ensure the availability of the node group and the reliability of data disaster recovery.

[0041] Specifically, referring to FIG1 , which is a flow chart of a node deployment method provided in an embodiment of the present application, the method may include the following steps:

[0042] S101. Deploy a first node group in a first area.

[0043] The first node group includes M first master nodes, where M is a positive integer, and when the first node group fails, the number of master nodes in other node groups meets the deployment conditions.

[0044] S102: Deploy a second node group in a second area.

[0045] The second node group includes at least one first slave node corresponding to the first master node.

[0046] Among them, satisfying the deployment condition indicates that the number of master nodes in other node groups is sufficient to determine that the first master node is switched to the first slave node; and the first area and the second area are physically isolated.

[0047] In the embodiment, two node groups can be used for illustration, and other node groups may also participate in the corresponding operation, which will be described in the corresponding application scenarios later. The first node group and the second node group each include multiple nodes, wherein corresponding nodes can be selected from the nodes of each node group as master nodes and slave nodes, respectively, and the slave nodes serve as data synchronization nodes for the master node. Taking the first node group as an example, the master database can be deployed on the first master node, and the slave database synchronized with the master database data can be deployed on the first slave node corresponding to the first master node. In this way, the slave node can synchronize the data in the master node in real time, so that when the master node fails or due to changes in business needs, the work of the master node can be switched to the corresponding slave node for operation. In the embodiment of the present application, the slave node backs up the data of the master node in real time, that is, synchronizes the data. Compared with the processing method of asynchronously copying the master node data from the slave node, the slave node backs up the master node data in real time, which can better maintain the consistency of the master and slave node data, and facilitates the switching of the master node work to the slave node at any time, thereby ensuring the effectiveness of the node group. Among them, the processing method of the slave node asynchronously assisting the master node data includes but is not limited to the slave node completing the processing of copying the master node data by executing the data synchronization instructions issued by the central control area; or, the slave node copies the master node data according to a certain data copying cycle.

[0048] Usually the master node and the slave node can be deployed in the same node group, but if the entire node group fails, the work switching between the nodes will not be completed. Therefore, in an embodiment of the present application, at least one first slave node corresponding to the first master node in the first node group can be deployed in the second node group, and the second area where the second node group is located is physically isolated from the first area where the first node group is located. Physical isolation can be achieved by deploying the master node (first area) and the slave node (second area) in different computer rooms in the same city, or in computer rooms in different cities, so that even if the first node group in the entire first area fails, the first master node can be replaced by the slave node corresponding to the first master node deployed in the second area to ensure the normal operation of the data. Furthermore, the first node group and the second node group can be deployed separately in different locations, and remote mutual backup and disaster recovery can also be achieved.

[0049] In an embodiment of the present application, the number of master nodes in each node group is a positive integer, and when the node group where the master node is located fails, the number of master nodes of other node groups meets the deployment condition, and the deployment condition indicates that the number of master nodes of other node groups is sufficient to determine that the master node of the failed node group is switched to the corresponding slave node. When the master node of a node group fails, in order to ensure the normal operation of the master node, it is usually necessary to switch the work of the master node to the slave node. Furthermore, since the master node usually corresponds to one or more slave nodes, in order to determine that the slave node with better performance will take over the work of the master node and avoid frequent node replacement, the slave node to which the work of the failed master node can be migrated will be determined through other master nodes. Taking the method of voting through the master nodes of other node groups as an example, voting can refer to voting for the status of a node, or voting for the slave node to which the master node is to be switched. For example, when the first node group fails, the master nodes of other node groups can determine the fault type of the first node group by voting. For another example, when the first master node corresponds to multiple slave nodes, when the first master node needs to switch its work to the slave node, the master nodes of other nodes can determine the target slave node that will replace the first master node from the slave nodes of the first master node by voting. The determination of the voting result can be set according to the specific application scenario. For example, the voting result can be determined by a minority-subordinate-majority voting method. In this way, in the embodiment of the present application, when a node group fails, it can be guaranteed that more than half of the master nodes can vote normally, such as more than half of the master nodes can be normal and vote for the corresponding slave nodes, so that normal master-slave switching can be performed and the entire node group can operate normally.

[0050] It should be noted that the reason why voting is used in the embodiment of the present application to determine the slave node to which the failed master node can be switched is that the status of each current node group can be determined by the master node of other node groups, so that the current work of the failed master node can be processed and the work of each node group can be guaranteed not to be affected. For example, if the failed master node is directly switched to a corresponding slave node at random, the workload of the slave node may be too heavy, resulting in the inability to operate the master node normally, and also affecting the processing of the original work of the slave node, such as affecting the real-time synchronization of data by the slave node, and further causing the unavailability of other node groups, thereby being unable to switch and causing large-scale failures. However, the present application uses the master nodes of other node groups to vote, and can select a node group with a better status to take over the work of the failed node group. Correspondingly, it can also select a slave node with a better status corresponding to the failed master node based on the voting results, so that the slave node takes over the work of the master node and ensures the availability of the cluster.

[0051] Specifically, taking voting as an example, the corresponding voting rules in the deployment conditions can be determined according to the requirements of different scenarios. For example, in some scenarios, if it can be determined that the number of votes required to switch the first master node to the first slave node is at least one-half, then the number of first master nodes M in the first node group needs to be less than or equal to one-half. Correspondingly, if it can be determined that the number of votes required to switch the first master node to the first slave node is at least one-third, then M needs to be less than or equal to two-thirds. In this regard, the present application implements various examples. As long as the number of deployed first master nodes satisfies the deployment conditions when a failure occurs in the first node group, the number of master nodes in other node groups meets the deployment conditions.

[0052] During the application of node groups, in some application scenarios, in addition to deploying node groups, some nodes or devices that can perform monitoring, control or scheduling can also be deployed, such as a central control area, a scheduler, or a server monitoring device. However, this deployment method increases the power of the entire application scenario or cluster system and reduces work efficiency due to the addition of an intermediate link for monitoring the nodes. Therefore, in an embodiment of the present application, a method is proposed that does not require the above-mentioned intermediate device to determine the node status, that is, in an embodiment of the present application, the node status can be automatically determined by the node group, such as determining whether the master node meets the current operating requirements through the slave node in the node group, and then automatically switching the master and slave nodes, thereby reducing the power consumption of the deployed intermediate devices and improving the efficiency of the node group.

[0053] Specifically, in one implementation of the embodiment of the present application, it also includes: if the slave node corresponding to the first master node determines that the operating status of the first master node meets the switching conditions, the operation of the first master node is switched to the target slave node corresponding to the first master node.

[0054] The slave node that monitors the first master node can be any slave node corresponding to the first master node, or a slave node with better performance can be selected as the monitoring node. The slave node can determine the operating status of the first master node by monitoring the performance information of the first master node, wherein the performance information of the first master node can include one or more of the load information, working operation information or transmission efficiency of the first master node. Then, the performance information of the monitored first master node can be used to determine whether the operating status of the first master node meets the switching condition. The switching condition can be determined based on the performance of the master node, the business processing capability or the status of the device where the master node is located. For example, the switching condition can represent the condition of the master node failure, the condition of the first master node business change, or the condition of the device where the first master node is located being in maintenance. That is, when the slave node corresponding to the first master node determines that the first master node has failed, the operation of the first master node is switched to the target slave node corresponding to the first master node.

[0055] Furthermore, it also includes: if the operating status of the first master node meets the switching conditions, the slave node corresponding to the first master node initiates voting, votes through other master nodes except the first master node, and determines the target slave node among the slave nodes corresponding to the first master node based on the voting results.

[0056] After the slave node initiates voting, each of the other master nodes can vote based on the operating status of each slave node corresponding to the first master node. Specifically, after each master node among the other master nodes except the first master node receives the voting request, it can vote for each slave node within the voting cycle and reply with voting response information to the slave node that initiated the vote. After the slave node receives the voting response information returned by the master node, it counts the voting results. If the voting count obtained from the slave node statistics exceeds half of the master nodes, the slave node corresponding to the voting result will be determined as the target slave node, and the work of the first master node will be switched to the target slave node. Correspondingly, the target slave node can also notify all other connected nodes by broadcasting that it has currently replaced the first master node as the new master node.

[0057] When the target slave node is used as the master node, it will affect the number of master nodes in the node group where the target slave node is located. Taking the status of other nodes determined by the voting of the master node as an example, in order to ensure that the voting of the master node is effective, it is necessary to make the number of master nodes in the node group where the target slave node is located meet the deployment conditions when the node group fails. For example, the condition for determining whether the first master node is switched to the first slave node is that the number of votes of the master nodes of other node groups must be at least one-half, and M can be a positive integer greater than or equal to 1 and less than or equal to one-half of the total number of master nodes. For example, when the target slave node is in the second node group, the embodiment of the present application also includes: if after the switch, the sum of the number of the second master node and the target slave node in the working state is greater than M, the work of at least one other second master node except the target slave node is switched to the corresponding slave node. Specifically, in order to ensure the switching effect, the work of other second master nodes with smaller workloads can be selected to switch to the corresponding slave node, or a second master node with fewer master nodes in the node group where the slave node corresponding to a certain second master node is located can be selected as the target second master node, that is, the work of the target second master node is switched to the corresponding slave node.

[0058] It should be noted that, in order to ensure that the votes of the master nodes of other node groups remain effective when a node group fails, the number of master nodes in each node group deployed in the embodiment of the present application is a positive integer, and when the node group fails, the number of master nodes in the other node groups meets the deployment conditions. For example, the second node group includes N second master nodes; N is a positive integer, and when the second node group fails, the number of master nodes in the other node groups meets the deployment conditions, wherein meeting the deployment conditions indicates that the number of master nodes in the other node groups is sufficient to determine that the second master node will be switched to the second slave node corresponding to the second master node.

[0059] In an embodiment of the present application, the number of node groups can be determined according to actual application requirements, that is, it is not limited to the first node group and the second node group described in the above embodiment, and can also include a third node group, a fourth node group, etc. Specifically, it is determined according to actual needs. For example, when the node group is used in a distributed storage scenario, the number of node groups and the area where the node group is to be deployed can be determined based on the amount of data to be stored or the data distribution. In one embodiment, a third node group is deployed in a third area, and the third node group includes at least a first slave node corresponding to the first master node, wherein the third area is physically isolated from the first area, and the third area is physically isolated from the second area.

[0060] Correspondingly, when deploying a node cluster in a certain area, the number of nodes to be deployed in that area can be determined based on the transmission performance of that area to ensure efficient data transmission on the nodes. Taking the deployment of nodes in a third area as an example, the method further includes: if the transmission delay between the third area and the first area is higher than a threshold, deploying a first number of nodes corresponding to the first node cluster in the third area; if the transmission delay between the third area and the first area is not higher than the threshold, deploying a second number of nodes corresponding to the first node cluster in the third area; wherein the first number is less than the second number.

[0061] If the slave node corresponding to the master node of the third area is in the first node group of the first area, and the slave node corresponding to the master node of the first node group is in the third node group of the third area, when the transmission delay between the third area and the first area is high, and when more nodes are deployed in the third area, there will be data synchronization between the master and slave nodes, data interaction between the master nodes, or data broadcasting between the nodes. The more nodes there are, the more transmission resources are occupied when data is transmitted between the nodes, such as the more network bandwidth is occupied, which will further cause a large amount of data delay. Therefore, in an embodiment of the present application, the number of nodes deployed in the corresponding area can be determined based on the transmission delay between areas. Specifically, the threshold corresponding to the transmission delay can be determined based on the actual application scenario, for example, it can be 10ms. Among them, the nodes deployed in this area can be slave nodes of the master nodes deployed in other areas, and can include master nodes corresponding to other slave nodes. For example, the first area and the third area can be remote areas. In order to reduce the amount of data in remote areas and avoid more delays, a small number of nodes corresponding to the first node group can be deployed in the third area when the transmission delay is high to reduce the occupation of transmission resources and avoid a large amount of data delay.

[0062] A node deployment method provided in an embodiment of the present application can be applied in the field of data disaster recovery, and can also be applied in the field of distributed clusters. In the field of distributed clusters, it can be implemented based on ZooKeeper technology, which is a software that provides consistency services for distributed applications, and provides functions including: configuration maintenance, domain name services, distributed synchronization, group services, etc. It can also be based on a Redis Cluster cluster solution using multiple Redis (Remote Dictionary Server, i.e., remote dictionary service) nodes. For a Redis Cluster cluster, data and services can be dispersed to multiple master nodes (master), and each master node also has a corresponding slave node, which is used to synchronize the data of the master node.

[0063] The node deployment method provided by this application is described below using the Redis Cluster solution as an example. The Redis Cluster represents the node group in the embodiment of this application. In this scenario, when the master node needs to be switched, it is determined by voting by the master nodes of other node groups.

[0064] Redis Cluster solutions can distribute data and write services to multiple master nodes. However, in conventional Redis Cluster disaster recovery mechanisms, if more than half of the master nodes in a Redis Cluster fail, even if these master nodes have slave nodes, no failover will occur, rendering the cluster unavailable. Therefore, this application proposes a solution for partitioning Redis Cluster into regions and deploying node clusters with a specific number of master nodes.

[0065] Different geographical locations are used as node deployment areas, the node group is represented by a computer room, and each node in the node group is represented by a server. Referring to Figure 2, it shows a schematic diagram of an application scenario provided by an embodiment of the present application. In order to ensure the availability of the node group, and also to avoid city-level disasters that cause all servers to be paralyzed, in this application scenario, computer rooms are deployed in different cities. Furthermore, if the city is large, corresponding computer rooms can also be deployed in different areas of the city. For example, a city is affected by natural disasters and the entire city is out of power. When all nodes in the city's computer room are unable to receive data and copy data, data paralysis occurs. Therefore, in an embodiment of the present application, the slave nodes corresponding to the master node are deployed in cities different from the city where the master node is located. For example, as shown in Figure 2, there can be three node groups (i.e., computer rooms), including Shenyang Computer Room, Beijing Computer Room A, and Beijing Computer Room B. Specifically, 5 groups of master-slave nodes can be deployed according to scenario requirements to form a 10-node cluster across three computer rooms. For example, redis08 in the Shenyang computer room and redis07 in the Beijing computer room A are master-slave nodes to each other, redis10 in the Shenyang computer room and redis09 in the Beijing computer room B are master-slave nodes to each other, redis01 in the Beijing computer room A and redis02 in the Beijing computer room B are master-slave nodes to each other, redis03 in the Beijing computer room A and redis04 in the Beijing computer room B are master-slave nodes to each other, and redis05 in the Beijing computer room A and redis06 in the Beijing computer room B are master-slave nodes to each other.

[0066] Furthermore, if the dedicated line latency between Beijing Data Center A and Beijing Data Center B is 2-3ms, and the Shenyang Data Center is remote from Beijing Data Center A, the transmission latency between the two is 13ms, and the Shenyang Data Center is remote from Beijing Data Center B, the transmission latency between the two is 18ms. Clearly, the Shenyang Data Center is remote from the Beijing Data Center, and the transmission latency between the two is significant. Therefore, to reduce the amount of remote data and avoid further latency, fewer servers (and, consequently, fewer Redis instances) can be deployed in the Shenyang Data Center.

[0067] The Redis cluster requires more than half of the votes to work properly. 5 groups of master-slave nodes, i.e. 5 master nodes, require at least 3 votes to ensure the validity of the cluster vote. At the same time, in an embodiment of the present application, a monitoring system can be deployed on the slave node to enable the cluster itself to monitor the status of each node without the help of an intermediate device. For example, when the slave node corresponding to the master node monitors that the master node has failed, the slave node can initiate a vote on other master nodes to determine whether the corresponding slave node can take over the work of the master node. At the same time, the slave node can also monitor the age of the master node in the cluster after the master-slave switch to ensure that there are no 3 votes in a single computer room. If this situation exists, automatic switching can be performed, that is, the corresponding master node is switched to a slave node to ensure overall high availability. Taking the Shenyang computer room in Figure 2 as an example, redis08 and redis10 only allocate one node as the master node, which can ensure that there are no more than two master nodes in a single computer room. If it is found that there are more than two master nodes, the corresponding master node will be switched to a slave node, thereby ensuring that when any computer room is down, there are still a corresponding number of master nodes participating in the vote, thereby not affecting the overall performance of the cluster.

[0068] In an embodiment of the present application, a node deployment device is further provided. Referring to FIG3 , the device may include:

[0069] A first deployment module 201 is configured to deploy a first node group in a first area; the first node group includes M first master nodes; M is a positive integer such that when a failure occurs in the first node group, the number of master nodes in other node groups meets a deployment condition;

[0070] A second deployment module 202 deploys a second node group in a second area, where the second node group includes at least one first slave node corresponding to the first master node;

[0071] Among them, satisfying the deployment condition indicates that the number of master nodes in other node groups is sufficient to determine that the first master node is switched to the first slave node; and the first area and the second area are physically isolated.

[0072] Optionally, it also includes:

[0073] The first switching module is configured to switch the operation of the first master node to the target slave node corresponding to the first master node if the slave node corresponding to the first master node determines that the operation status of the first master node meets the switching condition.

[0074] Optionally, it also includes:

[0075] The first determination module is used to initiate voting by the slave node corresponding to the first master node if the operating status of the first master node meets the switching conditions, vote through other master nodes except the first master node, and determine the target slave node among the slave nodes corresponding to the first master node based on the voting results.

[0076] Optionally, it also includes:

[0077] The second switching module is configured to switch the operation of at least one other second master node except the target slave node to the corresponding slave node if the sum of the number of the second master nodes and the target slave nodes in working state is greater than M after the switching.

[0078] Optionally, the second node group includes N second master nodes; N is a positive integer, and when the second node group fails, the number of master nodes in other node groups meets the deployment conditions, wherein meeting the deployment conditions indicates that the number of master nodes in other node groups is sufficient to determine that the second master node will be switched to the second slave node corresponding to the second master node.

[0079] Optionally, it also includes:

[0080] A third deployment module is used to deploy a third node group in a third area, where the third node group includes at least a first slave node corresponding to the first master node; wherein the third area is physically isolated from the first area, and the third area is physically isolated from the second area.

[0081] Optionally, the third deployment module includes:

[0082] a first deployment submodule, configured to deploy a first number of nodes corresponding to the first node group in the third area if a transmission delay between the third area and the first area is higher than a threshold;

[0083] a second deployment submodule, configured to deploy a second number of nodes corresponding to the first node group in the third area if the transmission delay between the third area and the first area is not higher than the threshold;

[0084] The first number is smaller than the second number.

[0085] Optionally, it also includes:

[0086] The database deployment module is used to deploy a master database on the first master node, and to deploy a slave database synchronized with the master database data on a first slave node corresponding to the first master node.

[0087] It should be noted that the specific implementation of each module and sub-module in this embodiment can refer to the corresponding content in the previous text and will not be described in detail here.

[0088] In another embodiment of the present application, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the node deployment method as described in any one of the above items is implemented.

[0089] In another embodiment of the present application, an electronic device is provided. Referring to FIG4 , the electronic device may include:

[0090] Memory 401, used to store applications and data generated by the application;

[0091] The processor 402 is configured to execute the application program to implement:

[0092] Deploy a first node group in a first area; the first node group includes M first master nodes; M is a positive integer, and when the first node group fails, the number of master nodes in other node groups meets the deployment condition;

[0093] Deploy a second node group in a second area, where the second node group includes at least one first slave node corresponding to the first master node;

[0094] Among them, satisfying the deployment condition indicates that the number of master nodes in other node groups is sufficient to determine that the first master node is switched to the first slave node; and the first area and the second area are physically isolated.

[0095] Optionally, it also includes:

[0096] If the slave node corresponding to the first master node determines that the operating state of the first master node meets the switching condition, the operation of the first master node is switched to the target slave node corresponding to the first master node.

[0097] Optionally, it also includes:

[0098] If the operating status of the first master node meets the switching conditions, the slave node corresponding to the first master node initiates voting, votes through other master nodes except the first master node, and determines the target slave node among the slave nodes corresponding to the first master node based on the voting results.

[0099] Optionally, it also includes:

[0100] If after the switching, the sum of the number of the second master nodes in working state and the target slave nodes is greater than M, the operation of at least one other second master node except the target slave node is switched to the corresponding slave node.

[0101] Optionally, the second node group includes N second master nodes; N is a positive integer, and when the second node group fails, the number of master nodes in other node groups meets the deployment conditions, wherein meeting the deployment conditions indicates that the number of master nodes in other node groups is sufficient to determine that the second master node will be switched to the second slave node corresponding to the second master node.

[0102] Optionally, it also includes:

[0103] A third node group is deployed in a third area, the third node group including at least one first slave node corresponding to the first master node; wherein the third area is physically isolated from the first area, and the third area is physically isolated from the second area.

[0104] Optionally, it also includes:

[0105] If the transmission delay between the third area and the first area is higher than a threshold, deploying a first number of nodes corresponding to the first node group in the third area;

[0106] If the transmission delay between the third area and the first area is not higher than the threshold, deploying a second number of nodes corresponding to the first node group in the third area;

[0107] The first number is smaller than the second number.

[0108] Optionally, it also includes:

[0109] A master database is deployed on the first master node, and a slave database synchronized with the master database data is deployed on a first slave node corresponding to the first master node.

[0110] It should be noted that the specific implementation of the processor in this embodiment can refer to the corresponding content in the previous text and will not be described in detail here.

[0111] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.

[0112] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0113] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0114] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A node deployment method, comprising: Deploy a first node group in a first area; The first node group includes M first master nodes; M is a positive integer, and when the first node group fails, the number of master nodes of other node groups meets the deployment conditions; Deploy a second node group in a second area, wherein the second node group includes at least one first slave node corresponding to the first master node; Wherein, satisfying the deployment condition indicates that the number of master nodes of other node groups is sufficient to determine that the first master node is switched to the first slave node; The first area is physically isolated from the second area.

2. The method according to claim 1, further comprising: If the slave node corresponding to the first master node determines that the operating state of the first master node meets the switching condition, the operation of the first master node is switched to the target slave node corresponding to the first master node.

3. The method according to claim 2, further comprising: If the running status of the first master node meets the switching conditions, the slave node corresponding to the first master node initiates voting, votes through other master nodes except the first master node, and determines the target slave node among the slave nodes corresponding to the first master node based on the voting results.

4. The method according to claim 2, further comprising: If after the switching, the sum of the number of the second master nodes in working state and the target slave nodes is greater than M, the operation of at least one other second master node except the target slave node is switched to the corresponding slave node.

5. The method according to claim 1, wherein the second node group includes N second master nodes; N is a positive integer, and when the second node group fails, the number of master nodes of other node groups meets the deployment condition, wherein: Meeting the deployment condition indicates that the number of master nodes in other node groups is sufficient to determine that the second master node is switched to the second slave node corresponding to the second master node.

6. The method according to claim 1, further comprising: A third node group is deployed in a third area, wherein the third node group includes at least one first slave node corresponding to the first master node; wherein the third area is physically isolated from the first area, and the third area is physically isolated from the second area.

7. The method according to claim 6, further comprising: If the transmission delay between the third area and the first area is higher than a threshold, deploying a first number of nodes corresponding to the first node group in the third area; If the transmission delay between the third area and the first area is not higher than the threshold, deploying a second number of nodes corresponding to the first node group in the third area; Wherein, the first number is smaller than the second number.

8. The method according to claim 1, further comprising: A master database is deployed on the first master node, and a slave database synchronized with the master database data is deployed on a first slave node corresponding to the first master node.

9. A node deployment device, comprising: A first deployment module, used to deploy a first node group in a first area; The first node group includes M first master nodes; M is a positive integer, and when the first node group fails, the number of master nodes of other node groups meets the deployment conditions; A second deployment module, configured to deploy a second node group in a second area, wherein the second node group includes at least one first slave node corresponding to the first master node; Wherein, satisfying the deployment condition indicates that the number of master nodes of other node groups is sufficient to determine that the first master node is switched to the first slave node; The first area is physically isolated from the second area.

10. An electronic device, comprising: A memory, used to store applications and data generated by the operation of the applications; A processor, configured to execute the application program to implement the node deployment method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method and device for switching master node in distributed master-slave system and computer equipment

    CN112865992A

  • Distributed cache system and deployment method thereof

    CN114172917A

  • Cluster deployment method and device, electronic equipment and computer readable medium

    CN116302716A

  • Node deployment method and device and electronic equipment

    CN116781711A

  • Reaching a quorum with a number of master nodes

    US20230164215A1