Data synchronization cluster, method and device, computer equipment, storage medium and computer program product
By adopting a combination scheme of raft cluster and listening nodes in the business system, the monitoring node joins the raft cluster when the node is removed, solving the business unavailability problem caused by data synchronization after the new node is launched, and achieving high availability of the data synchronization cluster.
Patent Information
- Application Number
- CN202510004864.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-04-18
AI Technical Summary
In the business system, after the new node is launched, the business data needs to be synchronized from other nodes, which causes the business system to be temporarily unavailable before the new node synchronizes the business data, affecting business availability.
The combination scheme of raft cluster and listening nodes is adopted to monitor nodes periodically synchronize business data from any node in the raft cluster, and determine whether the replacement conditions are met when the node is removed, and join the raft cluster to maintain the normal operation of the cluster.
Through the rapid joining of the listening node and data synchronization, the time for data synchronization after new nodes is shortened, the high availability of the data synchronization cluster is ensured, and the service unavailability caused by node updates is reduced.
Smart Images

Figure CN119848141A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data synchronization cluster, method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] In order to prevent the system from slowing down or even crashing due to receiving a large number of requests in a short period of time, multiple computer devices (i.e., business nodes) are often used to form a distributed business system. At this time, since different business requests from users may be processed by different business nodes, data synchronization is required between the nodes to ensure that the business data related to the business on each node is consistent.
[0003] In a business system with a small number of nodes that does not use centralized services such as Redis, each node can ensure data synchronization by sending data to each other. If the business system is updated, each old business node needs to be offline in turn, and the business system replaces the offline node with the updated new node. Since the new node needs to synchronize business data from other nodes after it goes online, the business system will be temporarily unavailable before the new node synchronizes the business data, and the availability of the business system cannot be guaranteed. Summary of the invention
[0004] Based on this, it is necessary to provide a data synchronization cluster, method, apparatus, computer equipment, storage medium and computer program product to address the above technical issues.
[0005] In a first aspect, the present application provides a data synchronization cluster. The data synchronization cluster includes a raft cluster and a listening node, and the raft cluster includes a leader node and a follower node, wherein:
[0006] The monitoring node is used to periodically synchronize business data from any node in the raft cluster;
[0007] The listening node is further configured to join the raft cluster when it is detected that any node in the raft cluster is removed from the data synchronization cluster and the listening node meets a replacement condition.
[0008] In one of the embodiments, the listening node is further used to send a joining request to the leader node when it is heard that a follower node in the raft cluster is removed from the data synchronization cluster and the listening node meets a replacement condition;
[0009] The leader node is used to modify the raft cluster configuration stored in the leader node in response to the joining request, and synchronize the modified raft cluster configuration to each of the follower nodes and the listening node; wherein the modified raft cluster configuration is used to indicate that the listening node is a follower node.
[0010] In one embodiment, the listening node is further used to send a voting request to each of the follower nodes when it is heard that the leader node in the raft cluster is removed from the data synchronization cluster and the listening node meets the replacement condition;
[0011] The follower node is used to respond to the voting request and perform a raft cluster election based on each of the follower nodes and the listening node.
[0012] In one of the embodiments, the listening node is further used to send a data synchronization request to the leader node based on the business data stored in the listening node after joining the raft cluster;
[0013] The leader node is further configured to update the service data stored in the leader node based on the data synchronization request, and perform data synchronization with each of the follower nodes and the listening node based on the service data updated by the leader node.
[0014] In one of the embodiments, the listening node is further used to receive a service request, and send a service processing request to the leading node based on the service request;
[0015] The leader node is used to respond to the service processing request, determine the service processing result based on the service data stored in the leader node, and send the service processing result to the monitoring node;
[0016] The monitoring node is further configured to process the service request based on the service processing result.
[0017] In one of the embodiments, after a new node joins the data synchronization cluster, the new node is used to obtain the number of nodes in the data synchronization cluster. If the number of nodes is 1, the raft cluster configuration stored in the new node is modified to a first configuration, and the first configuration is used to indicate that the listening node is a leader node; or if the number of nodes is greater than 1, and the number of nodes is less than or equal to a raft cluster node number threshold, the new node sends the joining request to the leader node; or if the number of nodes is greater than the raft cluster node number threshold, the raft cluster configuration stored in the new node is modified to a second configuration, and the second configuration is used to indicate that the new node is a listening node.
[0018] In one of the embodiments, the newly added node is further used to send the joining request to the leader node when the number of nodes is greater than 1, the number of nodes is less than or equal to the threshold number of raft cluster nodes, and the number of nodes is an odd number; or when the number of nodes is greater than 1, the number of nodes is less than or equal to the threshold number of raft cluster nodes, and the number of nodes is an even number, modify the raft cluster configuration stored in the newly added node to a third configuration, and the third configuration is used to indicate that the newly added node is a temporary listening node;
[0019] The temporary listening node is also used to monitor the number of nodes in the data synchronization cluster, and send the joining request to the leader node when the number of nodes changes to an odd number and the changed number of nodes is less than or equal to the raft cluster node number threshold.
[0020] In one embodiment, the data synchronization cluster has a node list, and the node information of each node in the node list is arranged according to the order in which each node joins the data synchronization cluster;
[0021] The listening node is further used to determine the node information of the listening node, the target arrangement order in the node list, and determine that the listening node meets the replacement condition when the target arrangement order is less than or equal to the raft cluster node quantity threshold.
[0022] In a second aspect, the present application also provides a data synchronization method. The data synchronization cluster includes a raft cluster and a listening node, the raft cluster includes a leader node and a follower node, and the method is applied to the listening node, including:
[0023] Periodically synchronize business data from any node in the raft cluster;
[0024] When it is detected that any node in the raft cluster is removed from the data synchronization cluster and the monitoring node meets the replacement condition, the monitoring node joins the raft cluster.
[0025] In a third aspect, the present application further provides a data synchronization device. The data synchronization cluster includes a raft cluster and a listening node, the raft cluster includes a leader node and a follower node, and the device is applied to the listening node, including:
[0026] A synchronization module, used to periodically synchronize business data from any node in the raft cluster;
[0027] The joining module is used to join the raft cluster when it is detected that any node in the raft cluster is removed from the data synchronization cluster and the listening node meets the replacement condition.
[0028] In a fourth aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any one of the above methods is implemented.
[0029] In a fifth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any of the above methods is implemented.
[0030] In a sixth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, any of the above methods is implemented.
[0031] The above-mentioned data synchronization cluster, method, device, computer equipment, storage medium and computer program product form each node into a raft cluster, use the raft algorithm to ensure strong data synchronization between nodes, and set up a new listening node to periodically synchronize business data from the raft cluster. In the case where the listening node detects that a node in the raft cluster has been removed, if the listening node determines that it has been replaced in the raft cluster, the listening node joins the raft cluster to maintain the normal operation of the raft cluster. At this time, since the previously synchronized business data has been stored in the listening node, the time for data synchronization between the listening node and other raft cluster nodes based on the raft algorithm can be greatly shortened. While ensuring the consistency of data of each node in the data synchronization cluster based on the raft algorithm, the impact of the node going offline due to updates and other reasons on business availability can be reduced, ensuring the high availability of the data synchronization cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A schematic diagram of a data synchronization cluster in one embodiment;
[0033] Figure 2 is a schematic diagram of a node in an embodiment;
[0034] Figure 3 A schematic diagram of a process in which a listening node joins a raft cluster when a following node is removed in one embodiment;
[0035] Figure 4 A schematic diagram of a process in which a listening node joins a raft cluster when a leader node is removed in one embodiment;
[0036] Figure 5A schematic diagram of changing a monitoring node to an election node in an embodiment;
[0037] Figure 6 A schematic diagram of synchronizing data after a listening node joins a raft cluster in one embodiment;
[0038] Figure 7 A schematic diagram of a flow chart of a data synchronization method in an embodiment;
[0039] Figure 8 A schematic diagram of a process for establishing a gateway current limiting system in an embodiment;
[0040] Fig. 9 A schematic diagram of changing to different states when a new node is added to the gateway current limiting system in an embodiment;
[0041] Fig.10 A schematic diagram of a process of executing a service by a gateway current limiting system in one embodiment;
[0042] Fig.11 A schematic diagram of a process of adding a listening node to a raft cluster in one embodiment;
[0043] Fig.12 is a structural block diagram of a data synchronization device in an embodiment;
[0044] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, 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.
[0046] In one embodiment, Figure 1 As shown, a data synchronization cluster is provided. The data synchronization cluster includes a raft cluster and a listening node, the raft cluster includes a leader node and a follower node, wherein the listening node is used to periodically synchronize business data from any node in the raft cluster; the listening node is also used to join the raft cluster when it is detected that any node in the raft cluster is removed from the data synchronization cluster and the listening node meets the replacement condition.
[0047] In the embodiment of the present application, the nodes in the data synchronization cluster are divided into three categories: leader nodes, follower nodes, and listener nodes. The number of leader nodes is 1, and the number of follower nodes and listener nodes can be any value including 0. Each node is provided with a business module and a consensus module, such as Figure 2 shown.
[0048] The business module is used to process business requests. The embodiment of the present application does not limit which specific nodes can be used to process business requests. In one embodiment, in accordance with the relevant provisions of the raft protocol, only the leader node is allowed to process business requests, and other nodes forward the business requests to the leader node for processing when receiving the business requests. In this way, the business data stored in the leader node must be the latest data in the entire cluster. In another embodiment, each node can process business requests, and after processing the business requests, it can update its own business data and synchronize the updated business data to the leader node. The leader node determines whether it is necessary to synchronize the updated business data to the follower nodes in the raft cluster based on the relevant rules of the raft protocol. This can also ensure that the business data stored in the leader node is most likely the latest data in the entire cluster.
[0049] The consensus module is used to store business data (that is, data that the raft cluster needs to synchronize), configure the raft cluster, and execute the raft protocol. The role played by each node in the data synchronization cluster is not fixed, and the node can change itself to a node in another state by modifying its own raft cluster configuration.
[0050] The leader node and the follower node form a raft (Replication And Fault Tolerant) cluster, and the consistency of the business data stored in the nodes is maintained through the raft protocol. Business data refers to business-related data in the application scenario of the data synchronization cluster. For example, when the data synchronization cluster is applied to the database, business data can refer to the data that the database needs to save. When the data synchronization cluster is applied to the gateway current limiting system, business data can refer to the current limiting rules configured for network traffic.
[0051] The listening node does not join the raft cluster, and periodically synchronizes service data from any node of the raft cluster. The embodiment of the present application does not specifically limit which node the listening node selects to synchronize service data.
[0052] In one embodiment, to ensure load balancing among nodes in the raft cluster, each node in the raft cluster can add 1 to the number of listening nodes corresponding to any listening node when any listening node requests to synchronize data from the node. The listening node can obtain the number of listening nodes corresponding to each node in the raft cluster, and select the node with the least number of corresponding listening nodes as the node from which the listening node synchronizes business data.
[0053] In another embodiment, since the leader node in the raft cluster is responsible for business processing and the load pressure is relatively large, the listening node can synchronize business data from any follower node of the raft cluster. The standard for selecting the follower node can be random selection, or it can be to select the node with the least number of corresponding listening nodes, or when the listening node has the ability to obtain the node list of the data synchronization cluster, the listening node can determine the follower node according to the arrangement order of itself in the node list and the arrangement order of each follower node in the node list, according to the preset arrangement order corresponding rule. For example, there are 10 nodes in the node list, of which the nodes arranged in the 2nd and 3rd are follower nodes, and the preset rule is that the follower node corresponding to the nodes arranged in 4-7 is 2, and the follower node corresponding to the nodes arranged in 8-10 is 3. Then, when the listening node determines that its own arrangement order is 6, it can select the follower node with an arrangement order of 2 as the node from which to synchronize data.
[0054] The data synchronization period is not specifically limited in the present embodiment and can be any value such as 1 minute or 5 minutes, which can be determined according to the application environment of the data synchronization cluster and the frequency of receiving service requests from the data synchronization cluster.
[0055] In addition to periodically synchronizing data from nodes in the raft cluster, the monitoring node also needs to monitor the status of each node in the raft cluster. The embodiment of the present application does not specifically limit how the monitoring node determines the status of each node in the raft cluster.
[0056] In one embodiment, a control node may be set up to manage and control each node in the data synchronization cluster. After determining that any node in the raft cluster cannot continue to process business due to various reasons such as network disconnection, update or failure, the control node actively removes the node from the data synchronization cluster and notifies the listening node.
[0057] In another embodiment, a separate control node is not set up, and the leader node records each node in the data synchronization cluster and synchronizes the information of each node to each follower node. When a follower node does not respond to any request of the leader node for a long time, the leader node can determine that the follower node has been removed from the data synchronization cluster and notify the listening node. If the leader node itself is removed from the data synchronization cluster, according to the relevant rules of the raft protocol, a follower node will be transformed into an election node to initiate a raft cluster election. The election node can notify the listening node when initiating a raft cluster election.
[0058] In another embodiment, when the listening node has the ability to obtain the node list of the data synchronization cluster, the listening node can monitor the node list. After any node is removed from the data synchronization cluster, the node information of the node will also be removed from the node list. The listening node can predetermine which node information in the node list corresponds to the nodes in the raft cluster, and when the node information is removed from the node list, it is determined that the nodes in the raft cluster are removed from the data synchronization cluster.
[0059] If any node in the raft cluster is removed from the data synchronization cluster, in order to maintain the strong data synchronization capability of the raft cluster, a listening node needs to be selected to be replaced in the raft cluster. Since there may be more than one listening node in the data synchronization cluster, each listening node needs to determine whether it meets the replacement conditions, and finally determine a listening node that meets the replacement conditions for replacement. The embodiment of the present application does not specifically limit the replacement conditions, and how the listening node determines that it meets the replacement conditions, and can be set according to actual business needs.
[0060] In one embodiment, after the control node, the leader node, or the election node determines that a node in the raft cluster is removed from the data synchronization cluster, it only notifies one listening node, and the listening node that receives the notification is the listening node that meets the replacement condition. The control node, the leader node, or the election node can determine the listening node that needs to be notified based on any rule. For example, randomly select a listening node, select the listening node with the smallest current load, select the listening node with the best network status, select the node whose last synchronization time from the raft cluster is closest to the current time, etc.
[0061] In another embodiment, the control node, the leader node or the election node does not actively select the listening node. And each listening node can know which other listening nodes exist in the data synchronization cluster besides itself. The information of other listening nodes can be notified to the listening node by the control node, the leader node or the election node when notifying the listening node, or it can be determined by the listening node according to the node list when the node list can be obtained. Each listening node can communicate with each other and determine an optimal listening node as a listening node that meets the replacement condition based on a certain rule. For example, each listening node can calculate a score for itself based on its own load, network status and the most recent data synchronization time, and each listening node exchanges scores with each other. After receiving the scores of all other listening nodes, determine that its own score is the highest among all listening nodes, and determine that it is a listening node that meets the replacement condition. For another example, each listening node can refer to the election mechanism in the raft cluster, initiate an election in each listening node, and the listening node finally elected is the listening node that meets the replacement condition.
[0062] In another embodiment, when the listening node has the ability to obtain the node list of the data synchronization cluster, the replacement condition can be set to the arrangement order of the node information of the listening node in the node list, which is a preset arrangement order. For example, the preset arrangement order is 5. Each listening node obtains the arrangement order of its own node information in the node list. If the arrangement order is not 5, the listening node determines that it does not meet the replacement condition. If the arrangement order is 5, the listening node determines that it meets the replacement condition.
[0063] When the listening node meets the replacement conditions, the listening node joins the raft cluster. If the listening node is selected by the control node, the leader node or the election node, the process of joining the raft cluster can refer to the process of adding nodes to the raft cluster in the prior art, and the embodiments of the present application will not be repeated here. If the control node, the leader node or the election node does not actively select the listening node, the listening node needs to notify the leader node that it needs to join the raft cluster. If the listening nodes that are fixed in the preset arrangement order are replaced to the raft cluster, the listening node does not need to notify the leader node. The leader node can determine which listening node corresponds to the node information arranged in the preset arrangement order, regard the node as a follower node in the raft cluster, and start data synchronization to the node in accordance with the relevant provisions of the raft protocol.
[0064] After the listening node confirms that it has joined the raft cluster, it can modify its own raft cluster configuration and set itself to follower node status. After that, the listening node acts as a follower node and executes the steps that the follower node needs to perform in the raft protocol.
[0065] The data synchronization cluster provided in the embodiment of the present application groups each node into a raft cluster, adopts the raft algorithm to ensure strong data synchronization between nodes, and at the same time newly sets up a listening node to periodically synchronize business data from the raft cluster. In the case where the listening node detects that a node in the raft cluster has been removed, if the listening node determines that it has been replaced in the raft cluster, the listening node joins the raft cluster to maintain the normal operation of the raft cluster. At this time, since the previously synchronized business data has been stored in the listening node, the time for data synchronization between the listening node and other raft cluster nodes based on the raft algorithm can be greatly shortened. While ensuring the consistency of data of each node in the data synchronization cluster based on the raft algorithm, the impact of the node going offline due to updates and other reasons on business availability can be reduced, ensuring the high availability of the data synchronization cluster.
[0066] In one embodiment, Figure 3As shown, the listening node is also used to send a joining request to the leading node when it is detected that the follower node in the raft cluster is removed from the data synchronization cluster and the listening node meets the replacement conditions; the leading node is used to modify the raft cluster configuration stored in the leading node in response to the joining request, and synchronize the modified raft cluster configuration to each follower node and the listening node; wherein the modified raft cluster configuration is used to indicate that the listening node is a follower node.
[0067] In the embodiment of the present application, if the node removed is a follower node, there is still a leader node in the data synchronization cluster. Since the listening node is not selected by the leader node, the leader node does not know which node meets the replacement condition. Therefore, when the listening node determines that it meets the replacement condition, it needs to notify the leader node through a joining request that it needs to join the raft cluster.
[0068] After receiving the joining request, the leader node can modify the raft cluster configuration stored by the leader node so that the modified raft cluster configuration indicates that the listening node currently belongs to a follower node in the raft cluster. The leader node then synchronizes the raft cluster configuration to all follower nodes and listening nodes. After receiving the raft cluster configuration, each follower node modifies its own raft cluster configuration accordingly. After receiving the raft cluster configuration, the listening node can determine that it has joined the raft cluster and change its status to a follower node.
[0069] In one embodiment, Figure 4 As shown, the listening node is also used to send a voting request to each follower node when it detects that the leader node in the raft cluster is removed from the data synchronization cluster and the listening node meets the replacement conditions; the follower node is used to respond to the voting request and perform a raft cluster election based on each follower node and the listening node.
[0070] In the embodiment of the present application, if the leader node is removed, the data synchronization cluster needs to start the raft cluster election. When the listening node hears that the leader node is removed from the data synchronization cluster, it can modify its own raft cluster configuration and set itself to the election node (Candidate) state, such as Figure 5 As shown, based on the election rules in the raft protocol, a voting request is sent to other follower nodes, requesting other follower nodes to vote for the listening node to become the leader node.
[0071] After each follower node receives a voting request, it determines whether to vote for the listening node based on the election rules of the raft protocol. The specific judgment criteria can refer to the relevant provisions of the raft protocol for raft cluster elections, which will not be repeated in the embodiments of this application. If the listening node is successfully elected as the leader node, the listening node modifies its own raft cluster configuration, sets itself to the leader node state, and becomes the new leader node in the raft cluster. If the listening node is not successfully elected, the listening node modifies its own raft cluster configuration and sets itself to the follower node state. At this time, since there is no leader node in the raft cluster, a follower node will be transformed into an election node again when the relevant provisions of the raft protocol are met and initiate a raft cluster election until a leader node is elected.
[0072] The data synchronization cluster provided in the embodiment of the present application, when the follower node is removed, enables the listening node to request the leader node to join the raft cluster and become a follower node in the raft cluster. When the leader node is removed, the listening node is transformed into an election node, and requests other follower nodes to vote for the raft cluster election, so that the listening node can join the raft cluster as a leader node or a follower node. Therefore, the listening node can be successfully joined to the raft cluster in different ways under different circumstances.
[0073] In one embodiment, Figure 6 As shown, the listening node is also used to send a data synchronization request to the leading node based on the business data stored in the listening node after joining the raft cluster; the leading node is also used to update the business data stored in the leading node based on the data synchronization request, and synchronize data with each follower node and the listening node based on the business data updated by the leading node.
[0074] In an embodiment of the present application, after joining the raft cluster, the listening node needs to synchronize its own data with the data of other nodes in the raft cluster. Since the listening node periodically synchronizes business data from the nodes in the raft cluster, during the period from the last time the listening node synchronized data from the raft cluster to the time the listening node joins the raft cluster, the nodes of the raft cluster may have newly added data that the listening node has not yet synchronized, and this part of the data needs to be synchronized to the listening node. At the same time, although there is a high probability that there is no business data in the listening node that the leading node does not have, when the listening node can handle the business on its own, and the listening node does not synchronize the business data to the leading node in time due to reasons such as network flash disconnection, there may be business data in the listening node that the leading node has not yet recorded, so the data in the listening node can also be synchronized to the nodes of the raft cluster.
[0075] After the listening node joins the raft cluster, it can send a data synchronization request to the leader node based on its own stored business data. The data synchronization request can carry all the business parameters in the listening node, or because the listening node regularly synchronizes data from the raft cluster, the listening node can determine which part of its stored business data must have been stored by the leader node and which part may not be stored by the leader node based on the data it synchronized last time, and send the business data that may not be stored by the leader node to the leader node.
[0076] The leader node can check whether its own business data needs to be updated based on the data synchronization request. If the listening node indicates that the data that needs to be synchronized are all stored in the leader node, the leader node does not need to update its own business data, and can initiate data synchronization in the raft protocol to the listening node based on the leader node's current business data. If the listening node indicates that the data that needs to be synchronized contains data that the leader node does not store, the leader node updates its own business data based on the data that it does not store, and then initiates data synchronization in the raft protocol to all follower nodes and listening nodes to ensure data consistency in the raft cluster.
[0077] The data synchronization cluster provided in the embodiment of the present application enables the listening node to synchronize its own data to the leading node after the listening node joins the raft cluster. The leading node can then update its own business data and synchronize data with other follower nodes and the listening node based on the updated business data, thereby ensuring the consistency of data in the raft cluster.
[0078] In one embodiment, the listening node is also used to receive business requests and send business processing requests to the leading node based on the business requests; the leading node is used to respond to the business processing requests, determine the business processing results based on the business data stored in the leading node, and send the business processing results to the listening node; the listening node is also used to process the business request based on the business processing results.
[0079] In the embodiment of the present application, the listening node can receive a service request from a client. To ensure that the service data in the leading node is the latest data in the entire cluster, the listening node does not determine the service processing result locally, but sends a service processing request to the leading node based on the service request, indicating that the leading node needs to determine the service processing result of the service request.
[0080] The business processing request is generated based on the part of the business request that involves modifying the business data. For example, when the data synchronization cluster is applied to the database and the business request is a write request, the listening node may use the business request as a business processing request. When the business request is a read request, since the read request does not involve the modification of the data in the database, the listening node may not send a business processing request. When the data synchronization cluster is applied to the gateway current limiting system, since the business data includes the access times corresponding to each client, the process of determining whether the business request is allowed to pass through the gateway involves the modification of the access times. Therefore, the listening node can generate a request to the request leader node to determine whether to allow the business request to pass through the gateway as a business processing request based on the identity of the client.
[0081] After receiving the business processing request, the leader node determines the business processing result based on the business data stored in the leader node. For example, when the data synchronization cluster is applied to the database and the business request is a write request, the business processing result can refer to a successful write or a write failure. When the data synchronization cluster is applied to the gateway current limiting system, the business processing result can refer to allowing the business request to pass through the gateway or not. The leader node feeds back the business processing result to the listening node. The leader node also needs to update the business data stored in itself according to the business processing result and synchronize data with each follower node.
[0082] After receiving the service processing result, the listening node performs subsequent processing on the service request based on the service processing result. For example, if the service processing result is that the service request is not allowed to pass through the gateway, the service request is discarded and a response indicating access denial or error information is fed back to the client. If the service processing result is that the service request is allowed to pass through the gateway, the service request is forwarded to the destination address of the service request, etc.
[0083] It should be noted that the follower node may also perform service processing by referring to the logic of the listening node in processing services, which will not be elaborated in the embodiments of the present application.
[0084] The data synchronization cluster provided in the embodiment of the present application allows the listening node to receive business requests. The part involving the determination of business processing results and therefore the change of business data is placed on the leading node for processing, and the business processing results are fed back to the listening node so that the listening node can perform subsequent processing on the business request based on the business processing results. While ensuring that the business data stored in the leading node is the latest business data, the pressure on the leading node to process business can be reduced.
[0085] In one embodiment, after a newly added node joins the data synchronization cluster, the newly added node is used to obtain the number of nodes in the data synchronization cluster. If the number of nodes is 1, the raft cluster configuration stored in the newly added node is modified to a first configuration, and the first configuration is used to indicate that the listening node is a leading node; or if the number of nodes is greater than 1, and the number of nodes is less than or equal to a raft cluster node number threshold, the newly added node sends a joining request to the leading node; or if the number of nodes is greater than the raft cluster node number threshold, the raft cluster configuration stored in the newly added node is modified to a second configuration, and the second configuration is used to indicate that the newly added node is a listening node.
[0086] In an embodiment of the present application, it may be necessary to add new nodes to the data synchronization cluster according to actual business needs. After the new node joins the data synchronization cluster, it determines which type of node it needs to be transformed into based on the number of nodes in the data synchronization cluster. The new node can determine how many nodes there are in the data synchronization cluster by obtaining the node list of the data synchronization cluster, or a control node or a leader node can be set to monitor the newly added nodes in the data synchronization cluster. When the control node or the leader node detects that a new node has been added, the number of nodes in the data synchronization cluster is sent to the new node.
[0087] If the newly added node determines that the number of nodes in the data synchronization cluster is 1, that is, there is only one newly added node in the data synchronization cluster, the newly added node modifies its own raft cluster configuration and sets itself to the leader node state.
[0088] If the newly added node determines that the number of nodes in the data synchronization cluster is greater than 1, but less than or equal to the raft cluster node number threshold, the newly added node can determine that there is already a leader node in the data synchronization cluster (according to the rules defined in the embodiment of the present application, the node that first joins the data synchronization cluster becomes the leader node, so if there is a node that joins the data synchronization cluster before the newly added node, there is already a leader node in the data synchronization cluster). The newly added node can join the raft cluster and become a follower node by sending a join request to the leader node. The reason for setting the raft cluster node number threshold is that using a small number of nodes (such as 3-5) to form a raft cluster can ensure that there are enough copies of business data, and can also ensure that the raft cluster has sufficient stability when some nodes are accidentally disconnected or removed. On this basis, adding additional nodes to the raft cluster will make the data synchronization process of the raft cluster too complicated, and will make the data synchronization cluster unavailable for a long time during the data synchronization process within the raft cluster, and at the same time, the stability of the raft cluster will not be greatly improved. Therefore, the number of raft cluster node number thresholds can be set to a small value, allowing only a small number of follower nodes in the data synchronization cluster.
[0089] If the newly added node determines that the number of nodes in the data synchronization cluster is greater than the raft cluster node number threshold, the newly added node can determine that there is already a leader node and enough follower nodes in the data synchronization cluster. The newly added node can modify its own raft cluster configuration and set itself to the listening node state.
[0090] In one embodiment, the newly added node is also used to send a join request to the leader node when the number of nodes is greater than 1, the number of nodes is less than or equal to the threshold number of raft cluster nodes, and the number of nodes is an odd number; or when the number of nodes is greater than 1, the number of nodes is less than or equal to the threshold number of raft cluster nodes, and the number of nodes is an even number, modify the raft cluster configuration stored in the newly added node to a third configuration, and the third configuration is used to indicate that the newly added node is a temporary listening node; the temporary listening node is also used to monitor the number of nodes in the data synchronization cluster, and send a join request to the leader node when the number of nodes changes to an odd number and the number of nodes after the change is less than or equal to the threshold number of raft cluster nodes.
[0091] In an embodiment of the present application, when the newly added node determines that the number of nodes is greater than 1 but less than or equal to the threshold number of nodes in the raft cluster, it is also necessary to determine whether the number of nodes is an odd number or an even number. Because in the data synchronization mechanism of the raft cluster, the condition for a piece of data to be deemed to be written successfully by the raft cluster is that the data is successfully sent to at least more than half of the nodes in the cluster. Therefore, for example, when the number of nodes in the raft cluster is 4, the condition for determining that the write is successful is that the data is successfully sent to 3 nodes. When the number of nodes in the raft cluster is 5, the condition for determining that the write is successful is still that the data is successfully sent to 3 nodes. It can be seen that when the number of nodes in the raft cluster is an odd number, the condition for determining that the data is written successfully is more relaxed than when the number of nodes is an even number, and the data processing speed of the raft cluster is faster. Therefore, when the number of nodes is an odd number, the newly added node can join the raft cluster and become a follower node.
[0092] When the number of nodes is an even number, the raft cluster can modify its own raft cluster configuration and set itself to a temporary listening node state. A temporary listening node is a listening node and can perform all the functions of a listening node, including synchronizing data and monitoring the status of raft cluster nodes. At the same time, compared with ordinary listening nodes, temporary listening nodes also need to monitor the number of nodes in the data synchronization cluster. When the number of nodes changes to an odd number and the number of nodes after the change is less than or equal to the threshold number of raft cluster nodes (that is, another new node joins the raft cluster and becomes a follower node at this time), a joining request is sent to the leader node to become a follower node in the raft cluster.
[0093] The data synchronization cluster provided in the embodiment of the present application sets a raft cluster node number threshold, so that the newly added node determines whether it is specifically transformed into a leader node, a follower node, or a listener node based on whether the current number of nodes in the data synchronization cluster exceeds the raft cluster node number threshold, and if it does not exceed, whether the number of nodes is an odd number or an even number. The number of raft cluster nodes in the data synchronization cluster can be maintained at a smaller value that does not exceed the raft cluster node number threshold and is an odd number, which can improve the data synchronization speed of each node in the raft cluster and also improve the speed of the data synchronization cluster processing business.
[0094] In one embodiment, the data synchronization cluster has a node list, and the node information of each node in the node list is arranged in the order in which each node joins the data synchronization cluster; the listening node is also used to determine the node information of the listening node, the target arrangement order in the node list, and when the target arrangement order is less than or equal to the raft cluster node number threshold, it is determined that the listening node meets the replacement condition.
[0095] In the embodiment of the present application, each node in the data synchronization cluster can read the node list, and the node information of each node in the node list is arranged in the order in which each node joins the data synchronization cluster. In the embodiment of the present application, when a node joins the data synchronization cluster, it will become a raft cluster node first, and when the number of nodes in the data synchronization cluster exceeds the raft cluster node number threshold, it will become a listening node. Therefore, each node can be assumed to be arranged in the node list in an order less than or equal to the raft cluster node number threshold as a node in the raft cluster, and a node greater than the raft cluster node number threshold is a listening node.
[0096] When any node in the raft cluster is removed from the data synchronization cluster, the node information of the node will also be removed from the node list, and the node information originally arranged after the node information will be moved forward. Each listening node can determine the target arrangement position of its own node information in the node list after the update. If the target arrangement position is less than or equal to the threshold of the number of nodes in the raft cluster, the listening node determines that it meets the replacement conditions and joins the raft cluster.
[0097] In one embodiment, Figure 7 As shown, a data synchronization method is provided. The present application embodiment is described by applying the method to a listening node in a data synchronization cluster in any of the above embodiments, including the following steps:
[0098] Step 702: Periodically synchronize business data from any node in the raft cluster;
[0099] Step 704: When it is detected that any node in the raft cluster is removed from the data synchronization cluster and the monitoring node meets the replacement condition, the raft cluster is added.
[0100] In the embodiment of the present application, the listening node needs to periodically synchronize business data from any node in the raft cluster and monitor the status of the nodes in the raft cluster. If the listening node detects that any node in the raft cluster is removed, the listening node determines whether it meets the replacement conditions, and if the replacement conditions are met, it is replaced in the raft cluster to maintain the normal operation of the raft cluster. Among them, the specific methods of synchronizing business data, monitoring each node in the raft cluster, and determining whether the replacement conditions are met can be found in the above embodiments, and the embodiments of the present application will not be repeated.
[0101] The data synchronization method provided in the embodiment of the present application groups each node into a raft cluster, adopts the raft algorithm to ensure strong data synchronization between nodes, and at the same time newly sets up a listening node to periodically synchronize business data from the raft cluster. In the case where the listening node detects that a node in the raft cluster has been removed, if the listening node determines that it has been replaced in the raft cluster, the listening node joins the raft cluster to maintain the normal operation of the raft cluster. At this time, since the previously synchronized business data has been stored in the listening node, the time for data synchronization between the listening node and other raft cluster nodes based on the raft algorithm can be greatly shortened. While ensuring the consistency of data of each node in the data synchronization cluster based on the raft algorithm, the impact of the node going offline due to updates and other reasons on business availability can be reduced, ensuring the high availability of the data synchronization cluster.
[0102] In one embodiment, a gateway current limiting system is provided, including a data synchronization cluster as in any of the above embodiments, and also including a gateway control plane device, a storage medium (such as ETCD (Extended Distributed Key Value) distributed storage medium), a relational database (such as MySQL) and a registration center. Figure 8 The following is the process of building a gateway current limiting system, including:
[0103] Step 801: The gateway control plane device configures gateway current limiting service data and pushes the service data to a storage medium.
[0104] Step 802: After the newly added node in the data synchronization cluster is started, the node number and node IP information of the current data synchronization cluster are obtained from the registration center, and the business data is pulled from the persistent storage medium, and the business data is stored in its own raft module.
[0105] Step 803a, when the number of nodes is 1, the newly added node is changed to a leader node and monitors the node list in the registration center.
[0106] Among them, the specific method of changing to a leading node can refer to the relevant description of the aforementioned embodiment, and the embodiments of this application will not be repeated.
[0107] Step 803b: When the number of nodes is 2, the newly added node is changed to a temporary listening node and listens to the node list in the registration center. When the number of nodes becomes 3, it is changed to a following node.
[0108] In the embodiment of the present application, since 3 nodes can achieve the stability of the raft cluster, the raft cluster node number threshold is set to 3. In this case, the number of nodes is greater than 1, the number of nodes is less than or equal to the raft cluster node number threshold, and the only case where the number of nodes is an even number is 2.
[0109] The specific method of changing the newly added node to a temporary listening node can refer to the relevant description of the aforementioned embodiment, and will not be repeated in the embodiment of the present application.
[0110] Step 803c: When the number of nodes is 3, the newly added node is changed to a follower node and monitors the node list in the registration center.
[0111] Step 803d: When the number of newly added nodes is greater than 3, the newly added node is changed to a listening node and listens to the node list in the registration center.
[0112] In the embodiment of the present application, the leader node assumes that if the number of nodes in the node list is greater than or equal to 3, the nodes ranked in the first 3 are nodes in the raft cluster, and the data synchronization of the raft cluster is performed based on the nodes ranked in the first 3. Therefore, when the newly added node determines that it has changed to a follower node, the leader node can also independently determine that the newly added node is a follower node. Therefore, when the newly added node changes to a follower node, it only needs to modify its own raft cluster configuration without notifying the leader node.
[0113] like Fig. 9 As shown, it is a diagram showing that when the number of nodes is 1, 2, 3, or more than 3, the newly added nodes become different types of nodes.
[0114] Step 804: When the leader node detects that a new node is added to the node list, it sends a heartbeat packet to the new node. The heartbeat packet is used to indicate the node information of the leader node.
[0115] like Fig.10 As shown in the figure, the process of executing business by the gateway current limiting system includes:
[0116] Step 1001a, when receiving a service request, the leader node obtains the current limiting count corresponding to the client sending the service request from its own raft module;
[0117] Step 1002a, the leader node determines whether the service request is current limited according to the current limit count;
[0118] Step 1003a: The leading node processes the service request according to whether the service request is flow-limited.
[0119] Step 1001b, when receiving the service request, the follower node or the listener node sends an RPC request (Remote Procedure Call) to the leader node based on the client sending the service request;
[0120] Step 1002b, the leader node obtains the current limiting count corresponding to the client based on the RPC request, determines whether the service request is current limited according to the current limiting count, and sends a message to the follower node or the listening node to determine whether the service request is current limited;
[0121] Step 1003b: The follower node or the listener node processes the service request according to whether the service request is current limited.
[0122] Step 1004: The leader node updates its own service parameters according to whether the service request is current limited, and synchronizes the service parameters to each follower node based on the raft protocol.
[0123] Step 1005: The listening node synchronizes service parameters from any follower node.
[0124] like Fig.11 As shown in the figure, it is the process of adding the listening node to the raft cluster when the gateway current limiting system removes the node during the update or removes the node for other reasons, including:
[0125] Step 1101: When the listening node detects that the node information of any node in the raft cluster is removed from the listening node list, the listening node obtains the target arrangement order of the listening node in the listening list.
[0126] If a node in the raft cluster is temporarily offline or down due to network fluctuations, the node will still be in the node list of the registration center, so the replacement process of the listening node will not be started. If a node in the raft cluster disappears from the node list, it means that the node has been removed from the raft cluster.
[0127] Step 1102a: If the node to be removed is a follower node, then the listener node is changed to a follower node when the target arrangement order is less than or equal to 3.
[0128] In the embodiment of the present application, since the leader node assumes by default that if the number of nodes in the node list is greater than or equal to 3, the first 3 nodes are nodes in the raft cluster, there is no need to notify the leader node when the listening node changes to a follower node.
[0129] Step 1103: The leader node synchronizes the raft cluster data based on the nodes in the monitoring list whose target arrangement order is less than or equal to 3.
[0130] Step 1102b, if the node to be removed is the leader node, then the listening node is changed to an election node when the target ranking order is less than 3.
[0131] Step 1104: The listening node sends a voting request to each follower node.
[0132] Step 1105: Each follower node and listener node performs a raft cluster election.
[0133] Step 1106: If the listening node is elected as the leader node, the listening node performs raft cluster data synchronization based on the nodes whose target arrangement order is less than or equal to 3 in the listening list.
[0134] The gateway current limiting system provided in the embodiment of the present application can realize a decentralized cluster low-frequency current limiting solution, and there is no need to set up a gateway current limiting business data storage center such as Redis. All business data is stored in the node memory at runtime. Even if the node is changed and updated, it does not affect the global current limiting of the cluster. At the same time, the embodiment of the present application expands the original raft protocol. After the node in the raft cluster is removed, the listening node that has been synchronizing data from the raft cluster can be used to join the raft cluster to ensure the high availability of the raft cluster. At the same time, it can also speed up the data synchronization speed within the raft cluster when the new node joins the raft cluster, and reduce the time that the gateway current limiting system is unavailable due to synchronizing data in the raft cluster.
[0135] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned 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 does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can 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 to be 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.
[0136] Based on the same inventive concept, the embodiment of the present application also provides a data synchronization device for implementing the data synchronization method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more data synchronization device embodiments provided below can refer to the limitations on the data synchronization method above, and will not be repeated here.
[0137] In one embodiment, Fig.12 As shown, a data synchronization device 1200 is provided, including: a synchronization module 1202, a joining module 1204, wherein:
[0138] A synchronization module, used to periodically synchronize business data from any node in the raft cluster;
[0139] The joining module is used to join the raft cluster when it is detected that any node in the raft cluster is removed from the data synchronization cluster and the listening node meets the replacement condition.
[0140] The data synchronization device provided in the embodiment of the present application groups each node into a raft cluster, adopts the raft algorithm to ensure strong data synchronization between nodes, and at the same time newly sets a listening node to periodically synchronize business data from the raft cluster. In the case where the listening node detects that a node in the raft cluster has been removed, if the listening node determines that it has been replaced in the raft cluster, the listening node joins the raft cluster to maintain the normal operation of the raft cluster. At this time, since the previously synchronized business data has been stored in the listening node, the time for data synchronization between the listening node and other raft cluster nodes based on the raft algorithm can be greatly shortened. While ensuring the consistency of data of each node in the data synchronization cluster based on the raft algorithm, the impact of the node going offline due to updates and other reasons on business availability can be reduced, ensuring the high availability of the data synchronization cluster.
[0141] Each module in the above 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 above.
[0142] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.13As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network 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 data synchronization method is implemented.
[0143] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the 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 those shown in the figure, or combine certain components, or have a different arrangement of components.
[0144] In one 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-mentioned method embodiments when executing the computer program.
[0145] 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-mentioned method embodiments are implemented.
[0146] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0147] 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.
[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 this application can include at least one of non-volatile 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), magnetoresistive 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, 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 specification.
[0150] The above-described 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 data synchronization cluster, characterized in that: The data synchronization cluster includes a raft cluster and a listening node, and the raft cluster includes a leader node and a follower node, wherein: The monitoring node is used to periodically synchronize business data from any node in the raft cluster; The listening node is further configured to join the raft cluster when it is detected that any node in the raft cluster is removed from the data synchronization cluster and the listening node meets a replacement condition.
2. The data synchronization cluster according to claim 1, characterized in that: The listening node is further configured to send a joining request to the leader node when it is detected that a follower node in the raft cluster is removed from the data synchronization cluster and the listening node meets a replacement condition; The leader node is used to modify the raft cluster configuration stored in the leader node in response to the joining request, and synchronize the modified raft cluster configuration to each of the follower nodes and the listening node; wherein the modified raft cluster configuration is used to indicate that the listening node is a follower node.
3. The data synchronization cluster according to claim 1, characterized in that: The listening node is further used to send a voting request to each of the follower nodes when it is heard that the leader node in the raft cluster is removed from the data synchronization cluster and the listening node meets the replacement condition; The follower node is used to respond to the voting request and perform a raft cluster election based on each of the follower nodes and the listening node.
4. The data synchronization cluster according to claim 1, characterized in that: The listening node is also used to send a data synchronization request to the leading node based on the business data stored in the listening node after joining the raft cluster; The leader node is further configured to update the service data stored in the leader node based on the data synchronization request, and perform data synchronization with each of the follower nodes and the listening node based on the service data updated by the leader node.
5. The data synchronization cluster according to claim 1, characterized in that: The monitoring node is further used to receive a service request and send a service processing request to the leading node based on the service request; The leader node is used to respond to the service processing request, determine the service processing result based on the service data stored in the leader node, and send the service processing result to the monitoring node; The monitoring node is further configured to process the service request based on the service processing result.
6. The data synchronization cluster according to claim 2, characterized in that: After the newly added node joins the data synchronization cluster, the newly added node is used to obtain the number of nodes of the data synchronization cluster. If the number of nodes is 1, the raft cluster configuration stored in the newly added node is modified to the first configuration, and the first configuration is used to indicate that the listening node is the leader node; or if the number of nodes is greater than 1, and the number of nodes is less than or equal to the raft cluster node number threshold, the newly added node sends the joining request to the leader node; or if the number of nodes is greater than the raft cluster node number threshold, the raft cluster configuration stored in the newly added node is modified to the second configuration, and the second configuration is used to indicate that the newly added node is a listening node.
7. The data synchronization cluster according to claim 6, characterized in that: The newly added node is further used to send the joining request to the leader node when the number of nodes is greater than 1, the number of nodes is less than or equal to the threshold number of raft cluster nodes, and the number of nodes is an odd number; or to modify the raft cluster configuration stored in the newly added node to a third configuration when the number of nodes is greater than 1, the number of nodes is less than or equal to the threshold number of raft cluster nodes, and the number of nodes is an even number, wherein the third configuration is used to indicate that the newly added node is a temporary listening node; The temporary listening node is also used to monitor the number of nodes in the data synchronization cluster, and send the joining request to the leader node when the number of nodes changes to an odd number and the changed number of nodes is less than or equal to the raft cluster node number threshold.
8. The data synchronization cluster according to claim 6, characterized in that: The data synchronization cluster has a node list, and the node information of each node in the node list is arranged according to the order in which each node joins the data synchronization cluster; The listening node is further used to determine the node information of the listening node, the target arrangement order in the node list, and determine that the listening node meets the replacement condition when the target arrangement order is less than or equal to the raft cluster node quantity threshold.
9. A data synchronization method, characterized in that: The data synchronization cluster includes a raft cluster and a listening node, the raft cluster includes a leader node and a follower node, and the method is applied to the listening node, including: Periodically synchronize business data from any node in the raft cluster; When it is detected that any node in the raft cluster is removed from the data synchronization cluster and the monitoring node meets the replacement condition, the monitoring node joins the raft cluster.
10. A data synchronization device, characterized in that: The data synchronization cluster includes a raft cluster and a listening node, the raft cluster includes a leader node and a follower node, and the device is applied to the listening node, including: A synchronization module, used to periodically synchronize business data from any node in the raft cluster; The joining module is used to join the raft cluster when it is detected that any node in the raft cluster is removed from the data synchronization cluster and the listening node meets the replacement condition.
11. 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 claim 9 are implemented.
12. 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 claim 9 are implemented.
13. 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 claim 9 are implemented.