CN108123851B - Survival detection method and device for master-slave node synchronous link in distributed system - Google Patents

Survival detection method and device for master-slave node synchronous link in distributed system Download PDF

Info

Publication number
CN108123851B
CN108123851B CN201711486350.3A CN201711486350A CN108123851B CN 108123851 B CN108123851 B CN 108123851B CN 201711486350 A CN201711486350 A CN 201711486350A CN 108123851 B CN108123851 B CN 108123851B
Authority
CN
China
Prior art keywords
slave node
synchronous
lease
node
dynamic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711486350.3A
Other languages
Chinese (zh)
Other versions
CN108123851A (en
Inventor
王康
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201711486350.3A priority Critical patent/CN108123851B/en
Publication of CN108123851A publication Critical patent/CN108123851A/en
Application granted granted Critical
Publication of CN108123851B publication Critical patent/CN108123851B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multi Processors (AREA)

Abstract

The invention discloses a survival detection method and device for a master-slave node synchronous link in a distributed system. Wherein the method comprises the following steps: the master node sends a synchronous command carrying a dynamic lease term to the slave node through a synchronous link; the dynamic lease time limit is determined by the main node according to the time slice length and the length of the task queue to be synchronized; after receiving the synchronous command sent by the master node, the slave node executes the synchronous operation and updates the dynamic lease of the slave node side according to the dynamic lease term; and the slave node detects whether the dynamic lease on the slave node side is expired, and if so, the slave node initiates a link reestablishment request to the master node. According to the scheme, the survival state of the synchronous links of the master node and the slave node in the distributed system can be detected without adding an additional heartbeat link, so that the system overhead is reduced, and the defect of low detection accuracy caused by inconsistency of the heartbeat link and the synchronous links in the prior art is overcome.

Description

Survival detection method and device for master-slave node synchronous link in distributed system
Technical Field
The invention relates to the technical field of computers, in particular to a survival detection method and a survival detection device for a master-slave node synchronous link in a distributed system.
Background
A distributed system with a master-slave structure has become a common database structure due to its characteristics of high flexibility, high data reliability, low service node load, high data read-write efficiency, and capability of implementing read-write separation. In a distributed system with a master-slave structure, a master-slave node generally implements data synchronization of the master-slave node through a synchronization link established between the master-slave node and the slave node. In order to ensure normal data synchronization between the master node and the slave node, the survival status of the synchronization link established between the master node and the slave node is usually detected.
In the prior art, heartbeat information of an opposite side is usually sent to a master node and a slave node through a peripheral heartbeat link, so as to detect the survival state of a synchronous link between the master node and the slave node, for example, if the slave node receives the heartbeat information sent by a master node, the synchronous link between the master node and the slave node is determined to be in the survival state; and if the slave node does not receive the heartbeat information sent by the master node, determining that the synchronous link between the master node and the slave node is in an abnormal state.
However, the above method for detecting the survival status of the synchronous link adds an additional heartbeat link, thereby increasing the system overhead; moreover, the heartbeat link and the synchronization link are two separate links, so that the accuracy of detecting the survival state of the synchronization link through the heartbeat link is low, for example, when a port of the master node, which sends synchronization data to the slave node, is sealed, the synchronization link of the master node and the slave node is interrupted, however, the master node can still send heartbeat information to the slave node, so that the synchronization link between the master node and the slave node is still in the survival state through the heartbeat link, and the detection result is inconsistent with the reality.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a method and apparatus for survival detection of synchronization links of master and slave nodes in a distributed system that overcomes or at least partially solves the above mentioned problems.
According to an aspect of the present invention, a method for detecting the survival of a master-slave node synchronization link in a distributed system is provided, which includes:
the master node sends a synchronous command carrying a dynamic lease term to the slave node through a synchronous link; the dynamic lease time limit is determined by the main node according to the time slice length and the length of the task queue to be synchronized;
after receiving the synchronous command sent by the master node, the slave node executes the synchronous operation and updates the dynamic lease of the slave node side according to the dynamic lease term;
and the slave node detects whether the dynamic lease on the slave node side is expired, and if so, the slave node initiates a link reestablishment request to the master node.
According to another aspect of the present invention, there is provided a device for detecting the survival of a master-slave node synchronization link in a distributed system, including:
the sending module is suitable for the master node to send a synchronous command carrying the dynamic lease term to the slave node through a synchronous link; the dynamic lease time limit is determined by the main node according to the time slice length and the length of the task queue to be synchronized;
the updating module is suitable for executing the synchronous operation after the slave node receives the synchronous command sent by the master node, and updating the dynamic lease of the slave node side according to the dynamic lease term;
the detection module is suitable for detecting whether the dynamic lease on the slave node side is expired or not by the slave node;
and the reestablishing module is suitable for initiating a link reestablishing request to the master node by the slave node if the dynamic lease of the slave node side detected by the detecting module is expired.
According to yet another aspect of the present invention, there is provided a computing device comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the survival detection method of the synchronous link of the master node and the slave node in the distributed system.
According to still another aspect of the present invention, a computer storage medium is provided, where at least one executable instruction is stored in the storage medium, and the executable instruction causes a processor to perform an operation corresponding to the survival detection method for a master-slave node synchronization link in a distributed system as described above.
According to the survival detection method and device of the master-slave node synchronous link in the distributed system, firstly, a master node sends a synchronous command carrying a dynamic lease term to a slave node through the synchronous link; the dynamic lease time limit is determined by the main node according to the time slice length and the length of the task queue to be synchronized; after receiving the synchronous command sent by the master node, the slave node executes the synchronous operation and updates the dynamic lease of the slave node side according to the dynamic lease term; and the slave node detects whether the dynamic lease on the slave node side is expired, and if so, the slave node initiates a link reestablishment request to the master node. By adopting the scheme, the detection of the survival state of the synchronous links of the master node and the slave node in the distributed system can be realized without adding an additional heartbeat link, so that the system overhead is reduced, and the defect of low detection accuracy caused by the inconsistency of the heartbeat link and the synchronous link in the prior art is avoided.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating a method for detecting the survival of a synchronization link between a master node and a slave node in a distributed system according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a method for detecting the survival of a synchronization link between a master node and a slave node in a distributed system according to another embodiment of the present invention;
fig. 3 is a block diagram illustrating an embodiment of a device for detecting the survival of a master-slave node synchronization link in a distributed system;
fig. 4 is a schematic structural diagram of a computing device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 is a flowchart illustrating a method for detecting the survival of a synchronization link between a master node and a slave node in a distributed system according to an embodiment of the present invention. As shown in fig. 1, the method includes:
step S110, the main node sends a synchronous command carrying the dynamic lease term to the slave node through a synchronous link.
Specifically, a dynamic lease term is added to a synchronization command during the transmission of the synchronization command by the master node to the slave node over the synchronization link. The dynamic lease term is a commitment term of the master node sending a message to the slave node, that is, the master node needs to send a synchronization command or other messages to the slave node within the dynamic lease term. Optionally, the master node may add a dynamic lease term to each synchronization command sent to the slave node, or may add a dynamic lease term to one or some synchronization commands sent to the slave node, for example, add a dynamic lease term to the synchronization command sent from the slave node every preset period.
The setting of the dynamic lease term may affect the performance of detecting the survival state of the synchronous link, for example, when the dynamic lease term is set to be too long, the survival state of the synchronous link cannot be fed back in time; when the dynamic lease time limit is set to be too short, the frequency of dynamic lease expiration is greatly increased, so that the request for initiating a link reestablishment from the slave node to the master node in the subsequent steps is greatly increased, and the system load is increased.
Therefore, the dynamic lease duration in this embodiment is determined by the master node according to the time slice length and the length of the queue of the task to be synchronized. Therefore, the dynamic lease time limit can be dynamically set according to the specific situation of the master-slave node synchronous task, and the rationality of the dynamic lease time limit is improved. For example, in a specific implementation process, to facilitate management and execution of tasks synchronized between a master node and a slave node, tasks to be synchronized between the master node and the slave node are placed in a task queue to be synchronized, each task to be synchronized has a corresponding time slice length, and when a thread finishes executing a certain time slice of a task to be synchronized, the thread stops executing the synchronization task and executes another task to be synchronized. Therefore, the rationality of the dynamic lease term can be improved by determining the dynamic lease term according to the time slice length and the length of the task queue to be synchronized in the step, and the overall performance of the system is further improved.
And step S120, after receiving the synchronization command sent by the master node, the slave node executes the synchronization operation and updates the dynamic lease of the slave node side according to the dynamic lease term.
And after receiving the synchronous command sent by the master node, the slave node carries out synchronous operation according to the synchronous command. And the slave node side maintains a corresponding dynamic lease, and when the synchronization command received from the slave node carries the dynamic lease period limit, the slave node updates the dynamic lease of the slave node side according to the dynamic lease period limit.
Step S130, the slave node detects whether the dynamic lease of the slave node side is expired, if yes, the slave node initiates a request for reestablishing the link to the master node.
Specifically, the slave node detects whether the dynamic lease on the slave node side expires according to the current time, and if the dynamic lease expires, it indicates that the master node does not send a synchronization command or other messages to the slave node within the dynamic lease term, thereby indicating that an abnormal condition exists in the synchronization link between the master node and the slave node. Therefore, when the slave node detects that the dynamic lease on the slave node side is expired, a request for reestablishing the link is sent to the master node, so that the aim of reestablishing the synchronous link between the master node and the slave node is fulfilled.
According to the survival detection method of the master-slave node synchronous link in the distributed system provided by the embodiment, firstly, a master node sends a synchronous command carrying a dynamic lease term to a slave node through the synchronous link; after receiving the synchronous command sent by the master node, the slave node executes the synchronous operation and updates the dynamic lease of the slave node side according to the dynamic lease term; and the slave node detects whether the dynamic lease of the slave node side is expired, and if so, the slave node initiates a link reestablishment request to the master node. By adopting the scheme, the survival detection of the synchronous links of the master node and the slave node in the distributed system can be realized without adding an additional heartbeat link, so that the system overhead is reduced; and the disadvantage that the detected survival state of the synchronous link is low in accuracy due to the fact that the heartbeat link is inconsistent with the synchronous link in the prior art is avoided. In addition, in the embodiment, the dynamic lease period is determined according to the time slice length and the length of the task queue to be synchronized, so that the dynamic lease period can be dynamically set according to the specific situation of the master-slave node synchronization task, the rationality of the dynamic lease period is improved, and the overall performance of the system is further improved.
Fig. 2 is a flowchart illustrating a method for detecting the survival of a synchronization link between a master node and a slave node in a distributed system according to another embodiment of the present invention. As shown in fig. 2, the method includes:
step S210, the master node sends a synchronization command carrying a dynamic lease term to the slave node through the synchronization link.
Specifically, a dynamic lease term is added to a synchronization command during the transmission of the synchronization command by the master node to the slave node over the synchronization link. The dynamic lease term is a commitment term of the master node sending a message to the slave node, that is, the master node needs to send a synchronization command or other messages to the slave node within the dynamic lease term. Optionally, the master node may add a dynamic lease term to each synchronization command sent to the slave node, or may add a dynamic lease term to one or more synchronization commands sent to the slave node, for example, add a dynamic lease term to synchronization sent from the slave node every preset period.
Further, the setting of the dynamic lease time limit may affect the survival detection performance of the synchronous link, for example, when the dynamic lease time limit is set too long, the survival state of the synchronous link cannot be fed back in time; when the dynamic lease time limit is set to be too short, the frequency of dynamic lease expiration is greatly increased, so that the request for initiating a link reestablishment from the slave node to the master node in the subsequent steps is greatly increased, and the system load is increased.
Therefore, in order to improve the rationality of the dynamic lease term, the dynamic lease term in this embodiment may be determined by the master node according to the number of the synchronization threads, the length of the queue of the tasks to be synchronized, the length of the time slice of each synchronization task, the switching time of the synchronization tasks, the switching times of the synchronization tasks, the preset redundancy amount, and the preset threshold. For example, in a specific implementation process, in order to facilitate management and execution of tasks synchronized between a master node and a slave node, the tasks to be synchronized between the master node and the slave node may be placed in a task queue to be synchronized, and the length of the task queue to be synchronized is the number of the tasks to be synchronized in the task queue to be synchronized; each task to be synchronized has a corresponding time slice length, the time slice lengths corresponding to the tasks to be synchronized can be the same or different, when the time slice for executing a certain task to be synchronized by the synchronization thread is finished, the synchronization thread stops executing the synchronization task and executes another task to be synchronized; the switching time of the synchronous task is specifically the time from the end of the last synchronous task time slice to the beginning of the execution of the next synchronous task by the synchronous thread; the switching times of the synchronous tasks are more than or equal to 1; the number of the synchronous threads can be one or more; in addition, the preset redundancy amount can be set by a person skilled in the art according to the actual synchronous task execution condition; the preset threshold is the minimum allowed value of the dynamic lease term, such as 10 s. Specifically, the dynamic lease period may be determined according to equation 2-1:
Figure RE-BDA0001534842020000061
wherein t is dynamic lease duration, t1The method comprises the steps of presetting a threshold value, wherein r is preset redundancy, n is the length of a task queue to be synchronized, slice _ length is the time slice length of each synchronization task, switch _ time synchronization task switching time, m is the synchronization task switching times, and worker _ number is the number of synchronization threads.
Optionally, when the time slice lengths of each synchronization task are the same and the switching times of the synchronization tasks are the same, the dynamic lease duration may be determined according to the following formula 2-2:
Figure RE-BDA0001534842020000071
wherein t is dynamic lease duration, t1The method comprises the steps of presetting a threshold value, wherein r is preset redundancy, n is the length of a task queue to be synchronized, slice _ length is the time slice length of each synchronization task, switch _ time synchronization task switching time, m is the synchronization task switching times, and worker _ number is the number of synchronization threads.
Optionally, the master node may also send heartbeat information to the slave nodes. Specifically, when the synchronization link between the master node and the slave node is in a survival state, but a time slice for the master node to send a log synchronization command to the slave node is over or the master node synchronizes all data on the master node side to the slave node side, the master node does not send the synchronization command to the slave node any more within a period of time, so that expiration of a dynamic lease is easily caused, and misjudgment of the survival state of the synchronization link by the slave node is triggered. For example, if the synchronization link between the current master node and the slave node is in an alive state, after the master node synchronizes all data on the master node side to the slave node, no new data needs to be synchronized to the slave node on the master node side within the dynamic lease term, that is, the master node does not send a synchronization command to the slave node within the dynamic lease term, the slave node determines that the current synchronization link is alive abnormally, thereby causing misjudgment of the survival state of the synchronization link. Therefore, in this step, when the time slice during which the master node sends the synchronization command task is over, and/or the difference between the current time and the lease start time is greater than a first preset threshold (for example, the first preset threshold may be 0.9 times of the current dynamic lease duration, etc.), the master node sends a heartbeat message to the slave node. The heartbeat information carries a dynamic lease term.
Step S220, after receiving the synchronization command sent by the master node, the slave node performs a synchronization operation, and updates the lease start time and/or the dynamic lease duration in the dynamic lease on the slave node side.
The dynamic lease includes a lease start time and a dynamic lease duration. And when the slave node receives the synchronous command sent by the master node, executing synchronous operation, updating the lease initial time in the dynamic lease after the slave node receives the synchronous command sent by the master node every time, and updating the lease initial time to the current time for receiving the synchronous command. And when the synchronous command contains the dynamic lease duration, updating the dynamic lease duration in the dynamic lease of the slave node side. For example, when the slave node receives that the synchronization command sent by the master node contains the dynamic lease duration D1 at time T1, the lease start time in the dynamic lease on the slave node side is updated to time T1, and the dynamic lease duration in the dynamic lease is updated to time D1; and when the synchronization command sent by the master node is received by the slave node at the time T2 and does not contain the dynamic lease period, updating the lease start time in the dynamic lease on the slave node side to be at the time T2, wherein the dynamic lease period in the dynamic lease is still D1.
Optionally, when receiving a heartbeat message sent by the master node to the slave node, the lease start time in the dynamic lease on the slave node side is updated, and the lease start time is updated to the current time when the heartbeat message is received. And when the heartbeat message contains the dynamic lease period, updating the dynamic lease period in the dynamic lease of the slave node side according to the dynamic lease period contained in the heartbeat message.
Step S230, the slave node detects whether the difference between the current time and the lease start time is greater than the dynamic lease time limit, if so, it determines that the dynamic lease is expired, and the slave node initiates a request for reestablishing a link to the master node.
The method comprises the steps that a slave node detects whether the difference value between the current time and lease starting time in a dynamic lease on the slave node side is larger than the dynamic lease term in the dynamic lease on the slave node side, if the difference value between the current time and the lease starting time is larger than the dynamic lease term, the dynamic lease is overdue, namely, a synchronous command or heartbeat message and the like are not sent to the slave node by the master node within the dynamic lease term, the survival state of a synchronous link between the master node and the slave node is abnormal, and therefore when the slave node detects that the dynamic lease on the slave node side is overdue, a link reestablishment request is sent to a master node, and the purpose of reestablishing the synchronous link between the master node and the slave node is achieved.
According to the survival detection method of the master-slave node synchronous link in the distributed system provided by the embodiment, firstly, a master node sends a synchronous command carrying a dynamic lease term to a slave node through the synchronous link; after receiving the synchronous command sent by the master node, the slave node executes the synchronous operation and updates the dynamic lease of the slave node side according to the dynamic lease term; and the slave node detects whether the dynamic lease of the slave node side is expired, and if so, the slave node initiates a link reestablishment request to the master node. By adopting the scheme, the survival detection of the synchronous links of the master node and the slave node in the distributed system can be realized without adding an additional heartbeat link, so that the system overhead is reduced; and the disadvantage that the detected survival state of the synchronous link is low in accuracy due to the fact that the heartbeat link is inconsistent with the synchronous link in the prior art is avoided. In addition, in this embodiment, the dynamic lease period is determined according to the number of the synchronization threads, the queue length of the tasks to be synchronized, the time slice length of each synchronization task, the switching time of the synchronization tasks, the switching times of the synchronization tasks, the preset redundancy amount, and the preset threshold value by the master node, so that the dynamic lease period can be dynamically set according to the specific situation of the synchronization tasks of the master node and the slave node, and the rationality of the dynamic lease period is improved.
Fig. 3 is a block diagram illustrating an embodiment of a device for detecting the survival of a master-slave node synchronization link in a distributed system. As shown in fig. 3, the apparatus includes: a sending module 31, an updating module 32, a detecting module 33, and a reconstructing module 34.
A sending module 31, adapted to send a synchronization command carrying a dynamic lease term to the slave node through the synchronization link by the master node; wherein, the dynamic lease time limit is determined by the main node according to the time slice length and the length of the task queue to be synchronized.
And the updating module 32 is adapted to execute the synchronization operation after the slave node receives the synchronization command sent by the master node, and update the dynamic lease on the slave node side according to the dynamic lease term.
The detection module 33 is adapted to detect whether the dynamic lease on the slave side expires.
And the reestablishing module 34 is adapted to initiate a request for reestablishing the link from the slave node to the master node if the dynamic lease on the slave node side detected by the detecting module expires.
Optionally, the dynamic lease includes a lease start time and a dynamic lease duration.
Optionally, the updating module 32 is further adapted to: and after receiving the synchronization command sent by the master node, the slave node executes the synchronization operation and updates the lease start time in the dynamic lease of the slave node side according to the dynamic lease term.
Optionally, the detection module 33 is further adapted to: the slave node detects whether the difference value between the current time and the lease starting time is greater than the dynamic lease term, and if so, the slave node determines that the dynamic lease is overdue; otherwise, the dynamic lease is determined not to expire.
Optionally, the apparatus further comprises: and a heartbeat sending module (not shown in the figure) adapted to send a heartbeat message to the slave node when the time slice for the master node to send the synchronization command task is finished and/or the difference between the current time and the lease start time is greater than a first preset threshold.
Optionally, the dynamic lease duration specifically includes: the main node determines according to the number of the synchronous threads, the queue length of the tasks to be synchronized, the time slice length of each synchronous task, the switching time of the synchronous tasks, the switching times of the synchronous tasks, the preset redundancy and the preset threshold.
According to the survival detection device for the synchronous link of the master node and the slave node in the distributed system provided by the embodiment, firstly, the master node sends a synchronous command carrying a dynamic lease term to the slave node through the synchronous link; after receiving the synchronous command sent by the master node, the slave node executes the synchronous operation and updates the dynamic lease of the slave node side according to the dynamic lease term; and the slave node detects whether the dynamic lease of the slave node side is expired, and if so, the slave node initiates a link reestablishment request to the master node. By adopting the scheme, the survival detection of the synchronous links of the master node and the slave node in the distributed system can be realized without adding an additional heartbeat link, so that the system overhead is reduced; and the disadvantage that the detected survival state of the synchronous link is low in accuracy due to the fact that the heartbeat link is inconsistent with the synchronous link in the prior art is avoided. In addition, in the embodiment, the dynamic lease period is determined according to the time slice length and the length of the task queue to be synchronized, so that the dynamic lease period can be dynamically set according to the specific situation of the master-slave node synchronization task, and the rationality of the dynamic lease period is improved.
According to an embodiment of the present invention, a non-volatile computer storage medium is provided, where the computer storage medium stores at least one executable instruction, and the computer executable instruction may execute a method for detecting the survival of a synchronization link of a master node and a slave node in a distributed system in any of the above method embodiments.
Fig. 4 is a schematic structural diagram of a computing device according to an embodiment of the present invention, and the specific embodiment of the present invention does not limit the specific implementation of the computing device.
As shown in fig. 4, the terminal may include: a processor (processor)402, a Communications Interface 404, a memory 406, and a Communications bus 408.
Wherein:
the processor 402, communication interface 404, and memory 406 communicate with each other via a communication bus 408.
A communication interface 404 for communicating with network elements of other devices, such as clients or other servers.
The processor 402 is configured to execute the program 410, and may specifically execute relevant steps in the above-described embodiment of the method for detecting the survival of a synchronization link between a master node and a slave node in a distributed system.
In particular, program 410 may include program code comprising computer operating instructions.
The processor 402 may be a central processing unit CPU or an application Specific Integrated circuit asic or one or more Integrated circuits configured to implement embodiments of the present invention. The computing device includes one or more processors, which may be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
And a memory 406 for storing a program 410. Memory 406 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 410 may specifically be configured to cause the processor 402 to perform the following operations:
the master node sends a synchronous command carrying a dynamic lease term to the slave node through a synchronous link; the dynamic lease time limit is determined by the main node according to the time slice length and the length of the task queue to be synchronized;
after receiving the synchronous command sent by the master node, the slave node executes the synchronous operation and updates the dynamic lease of the slave node side according to the dynamic lease term;
and the slave node detects whether the dynamic lease on the slave node side is expired, and if so, the slave node initiates a link reestablishment request to the master node.
In an alternative embodiment, the dynamic lease includes a lease start time and a dynamic lease duration.
In an alternative embodiment, the program 410 may be specifically configured to cause the processor 402 to perform the following operations:
the slave node detects whether the difference value between the current time and the lease starting time is greater than the dynamic lease term, and if so, the slave node determines that the dynamic lease is overdue; otherwise, the dynamic lease is determined not to expire.
In an alternative embodiment, the program 410 may be specifically configured to cause the processor 402 to perform the following operations:
and after receiving the synchronization command sent by the master node, the slave node executes the synchronization operation and updates the lease start time in the dynamic lease at the slave node side.
In an alternative embodiment, the program 410 may be specifically configured to cause the processor 402 to perform the following operations:
and when the time slice of the task of sending the synchronous command by the master node is finished, and/or the difference value between the current time and the lease starting time is larger than a first preset threshold value, the master node sends a heartbeat message to the slave node.
In an optional implementation manner, the dynamic lease duration specifically includes: the main node determines according to the number of the synchronous threads, the queue length of the tasks to be synchronized, the time slice length of each synchronous task, the switching time of the synchronous tasks, the switching times of the synchronous tasks, the preset redundancy and the preset threshold.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be appreciated by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the liveness detection arrangement of the master-slave node synchronization link in a distributed system according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (12)

1. A survival detection method for a master-slave node synchronous link in a distributed system comprises the following steps:
the master node sends a synchronous command carrying a dynamic lease term to the slave node through a synchronous link; the dynamic lease term is determined by the master node according to the time slice length and the length of the task queue to be synchronized, and the dynamic lease term is the commitment term of the master node for sending a message to the slave node;
after receiving the synchronous command sent by the master node, the slave node executes the synchronous operation and updates the dynamic lease of the slave node side according to the dynamic lease term;
the slave node detects whether the dynamic lease of the slave node side is expired, if so, the slave node initiates a request for reestablishing a link to the master node;
and when the time slice of the task of sending the synchronous command by the master node is finished, and/or the difference value between the current time and the lease starting time is larger than a first preset threshold value, the master node sends a heartbeat message to the slave node.
2. The method of claim 1, wherein the dynamic lease includes a lease start time and a dynamic lease duration.
3. The method of claim 2, wherein the slave node detecting whether the dynamic lease on the slave node side has expired further comprises:
the slave node detects whether the difference value between the current time and the lease starting time is greater than the dynamic lease term, and if so, the slave node determines that the dynamic lease is overdue; otherwise, the dynamic lease is determined not to expire.
4. The method of claim 2, wherein the slave node performs a synchronization operation after receiving the synchronization command sent by the master node, and updates the dynamic lease on the slave node side according to the dynamic lease duration further comprises:
and after receiving the synchronization command sent by the master node, the slave node executes the synchronization operation and updates the lease start time in the dynamic lease at the slave node side.
5. The method according to any of claims 1-4, wherein the dynamic lease period is in particular: the main node determines according to the number of the synchronous threads, the queue length of the tasks to be synchronized, the time slice length of each synchronous task, the switching time of the synchronous tasks, the switching times of the synchronous tasks, the preset redundancy and the preset threshold.
6. A survival detection device for a master-slave node synchronous link in a distributed system comprises:
the sending module is suitable for the master node to send a synchronous command carrying the dynamic lease term to the slave node through a synchronous link; the dynamic lease term is determined by the master node according to the time slice length and the length of the task queue to be synchronized, and the dynamic lease term is the commitment term of the master node for sending a message to the slave node;
the updating module is suitable for executing the synchronous operation after the slave node receives the synchronous command sent by the master node, and updating the dynamic lease of the slave node side according to the dynamic lease term;
the detection module is suitable for detecting whether the dynamic lease on the slave node side is expired or not by the slave node;
the reestablishment module is suitable for initiating a reestablishment link request to the master node by the slave node if the dynamic lease of the slave node side detected by the detection module is expired;
and the heartbeat sending module is suitable for sending a heartbeat message to the slave node by the master node when the time slice for sending the synchronous command task by the master node is finished and/or the difference value between the current time and the lease starting time is larger than a first preset threshold value.
7. The apparatus of claim 6, wherein the dynamic lease comprises a lease start time and a dynamic lease duration.
8. The apparatus of claim 7, wherein the detection module is further adapted to:
the slave node detects whether the difference value between the current time and the lease starting time is greater than the dynamic lease term, and if so, the slave node determines that the dynamic lease is overdue; otherwise, the dynamic lease is determined not to expire.
9. The apparatus of claim 6, wherein the update module is further adapted to:
and after receiving the synchronization command sent by the master node, the slave node executes the synchronization operation and updates the lease start time in the dynamic lease at the slave node side.
10. The apparatus according to any of claims 6-9, wherein the dynamic lease period is specifically: the main node determines according to the number of the synchronous threads, the queue length of the tasks to be synchronized, the time slice length of each synchronous task, the switching time of the synchronous tasks, the switching times of the synchronous tasks, the preset redundancy and the preset threshold.
11. A computing device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the survival detection method of the master-slave node synchronous link in the distributed system according to any one of claims 1-5.
12. A computer storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to the method for detecting the survival of a synchronization link between a master node and a slave node in a distributed system according to any one of claims 1 to 5.
CN201711486350.3A 2017-12-29 2017-12-29 Survival detection method and device for master-slave node synchronous link in distributed system Active CN108123851B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711486350.3A CN108123851B (en) 2017-12-29 2017-12-29 Survival detection method and device for master-slave node synchronous link in distributed system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711486350.3A CN108123851B (en) 2017-12-29 2017-12-29 Survival detection method and device for master-slave node synchronous link in distributed system

Publications (2)

Publication Number Publication Date
CN108123851A CN108123851A (en) 2018-06-05
CN108123851B true CN108123851B (en) 2021-04-09

Family

ID=62232535

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711486350.3A Active CN108123851B (en) 2017-12-29 2017-12-29 Survival detection method and device for master-slave node synchronous link in distributed system

Country Status (1)

Country Link
CN (1) CN108123851B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109088937B (en) * 2018-08-28 2021-10-26 郑州云海信息技术有限公司 Cluster authorization method and device based on unified management
CN111026807A (en) * 2019-11-25 2020-04-17 深圳壹账通智能科技有限公司 Distributed lock synchronization method and device, computer equipment and readable storage medium
CN112865995B (en) * 2019-11-27 2022-10-14 上海哔哩哔哩科技有限公司 Distributed master-slave system
CN111813636B (en) * 2020-09-03 2021-02-23 苏州浪潮智能科技有限公司 Method, device and medium for monitoring use time of communication resources between software modules
CN112367214B (en) * 2020-10-12 2022-06-14 成都精灵云科技有限公司 Method for rapidly detecting and switching main node based on etcd
CN113297236A (en) * 2020-11-10 2021-08-24 阿里巴巴集团控股有限公司 Method, device and system for electing main node in distributed consistency system
CN112532436B (en) * 2020-11-23 2024-05-28 京东科技控股股份有限公司 Block chain node state conversion method and block chain system
CN115373904B (en) * 2022-10-24 2023-02-03 北京奥星贝斯科技有限公司 Lease dynamic continuation method, device and equipment in distributed system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101257405A (en) * 2008-04-03 2008-09-03 中兴通讯股份有限公司 Method for implementing double chain circuits among master-salve equipments

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090144167A1 (en) * 2005-02-10 2009-06-04 Pablo Calamera System and method for managing data and voice connectivity for wireless devices
CN101360021B (en) * 2008-10-14 2011-12-21 中国电信股份有限公司 Monitoring method and system for wireless wideband user status
CN101656764A (en) * 2009-09-22 2010-02-24 中兴通讯股份有限公司 Method, system and device for keeping session of DHCP user active
US9575985B2 (en) * 2009-12-07 2017-02-21 Novell, Inc. Distributed lock administration
CN105471626A (en) * 2015-11-16 2016-04-06 北京奇虎科技有限公司 Method and system for distributing storage data of internal memory
CN106936940B (en) * 2017-02-10 2019-11-08 安科讯(福建)科技有限公司 Lease information backup method and system in a kind of Dynamic Host Configuration Protocol server

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101257405A (en) * 2008-04-03 2008-09-03 中兴通讯股份有限公司 Method for implementing double chain circuits among master-salve equipments

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"Modeling and closed-loop control of hypnosis by means of bispectral index with isoflurane";A Gentilini,et al.,;《IEEE Transactions on Biomedical Engineering》;20010831;第48卷(第8期);第874-889页 *
张姝雯." CMTS接入网用户认证服务与控制".《中国优秀硕士学位论文全文数据库-信息科技辑》.2008,I136-85起全文. *

Also Published As

Publication number Publication date
CN108123851A (en) 2018-06-05

Similar Documents

Publication Publication Date Title
CN108123851B (en) Survival detection method and device for master-slave node synchronous link in distributed system
CN108234641B (en) Data reading and writing method and device based on distributed consistency protocol
JP6749926B2 (en) Method, device and system for synchronizing data
CN107872528B (en) Message pushing method and device
CN108108463B (en) Synchronous task processing method and device based on time slice scheduling
WO2017185961A1 (en) Method and apparatus for processing service discovery
US20220224610A1 (en) Heartbeat information sending method and apparatus, and heartbeat sending node
EP3550436A1 (en) Method and apparatus for detecting and recovering fault of virtual machine
CN108228789B (en) Synchronous abnormity recovery method and device triggered by slave node
CN108228812B (en) Self-adaptive main node switching method and device
CN112015595B (en) Master-slave database switching method, computing device and storage medium
CN112104727B (en) Method and system for deploying simplified high-availability Zookeeper cluster
CN113094430B (en) Data processing method, device, equipment and storage medium
CN112769652A (en) Node service monitoring method, device, equipment and medium
CN111371585A (en) Configuration method and device for CDN node
CN108200157B (en) Log synchronization method and device for triggering rollback by master node
CN112052230A (en) Multi-machine room data synchronization method, computing equipment and storage medium
CN108205588B (en) Data synchronization method and device based on master-slave structure
CN113452770B (en) Data synchronization method, device, computer equipment and storage medium
CN108121514B (en) Meta information updating method and device, computing equipment and computer storage medium
WO2022199229A1 (en) Suspended transaction inspection method and apparatus, electronic device and storage medium
CN104283950B (en) A kind of method, apparatus and system of service request processing
CN111367921A (en) Data object refreshing method and device
CN112367386A (en) Ignite-based automatic operation and maintenance method, apparatus and computer equipment
CN110908776A (en) Timed task execution method, related device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant