CN110166528B - Method and device for preventing node change notification from being lost and computer equipment - Google Patents

Method and device for preventing node change notification from being lost and computer equipment Download PDF

Info

Publication number
CN110166528B
CN110166528B CN201910305189.8A CN201910305189A CN110166528B CN 110166528 B CN110166528 B CN 110166528B CN 201910305189 A CN201910305189 A CN 201910305189A CN 110166528 B CN110166528 B CN 110166528B
Authority
CN
China
Prior art keywords
change notification
node change
node
subscriber server
server
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
CN201910305189.8A
Other languages
Chinese (zh)
Other versions
CN110166528A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910305189.8A priority Critical patent/CN110166528B/en
Publication of CN110166528A publication Critical patent/CN110166528A/en
Priority to PCT/CN2019/118161 priority patent/WO2020211361A1/en
Application granted granted Critical
Publication of CN110166528B publication Critical patent/CN110166528B/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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0631Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
    • 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/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)

Abstract

By means of a first node change notification set stored in a zookeeper server and a second node change notification set stored in a subscriber server, node change notifications which are absent from the second node change notification set relative to the first node change notification set can be quickly found out, the absent node change notifications are lost node change notifications which are not received by the subscriber server, and the change notifications of the zookeeper node are guaranteed not to be lost due to network congestion, subscriber system faults and the like.

Description

Method and device for preventing node change notification from being lost and computer equipment
Technical Field
The present application relates to the technical field of node change notifications, and in particular, to a method, an apparatus, and a computer device for preventing a node change notification from being lost.
Background
The ESG-ADMIN (subscriber server) is an enterprise service administration platform management system, which is used for monitoring node change of zookeeper and the like, because zookeeper (zookeeper is a distributed, open source code distributed application coordination service, which is an implementation of Google's Chubby one open source and is an important component of Hadoop and Hbase) only supports a monitoring mode to notify a subscriber (a third party system, such as ESG-ADMIN), that is, zookeeper is only responsible for sending node change notifications to the subscriber server, whether the subscriber server receives the node change notifications sent by zookeeper, and zookeeper does not care, so that when network congestion and a subscriber system failure occur, the subscriber server cannot receive all the node change notifications sent by zookeeper, that is, the problem of node change notification loss exists.
Disclosure of Invention
The present application mainly aims to provide a method, an apparatus, a computer device and a storage medium for sending a node change notification, and aims to solve the problem that the node change notification is lost due to network congestion and a subscriber system failure.
In order to achieve the above object, the present application provides a method for sending a node change notification, where a zookeeper server sends a node change notification to a subscriber server, where the zookeeper server is installed with a notification component that enables the zookeeper server to support RESTful interface call, and the method for sending the node change notification includes:
the zookeeper server acquires a node change notification, wherein the node change notification comprises an instance node path and change time;
calling a first RESTful interface of the subscriber server by using the notification component, sending the node change notification to the subscriber server, and storing the node change notification in a local first node change notification set;
and under a preset condition, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
Further, the step of, under a preset condition, invoking a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface includes:
judging whether the number of the node change notifications in the first node change notification set is equal to a preset number threshold value or not;
if yes, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
Further, the step of, under a preset condition, invoking a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface includes:
acquiring a first time of sending the first node change notification set to the subscriber server at the previous time and acquiring a current second time;
judging whether the time difference between the first time and the second time is equal to a preset time threshold value or not;
if yes, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
The application further provides a method for preventing loss of the node change notification, which is used for preventing the node change notification sent by the zookeeper server by using the method for sending the node change notification as described in any one of the above from being lost by the subscriber server; the method for preventing the loss of the node change notification comprises the following steps:
the subscriber server receives a node change notification sent by the zookeeper server through the first RESTful interface, and stores the received node change notification in a preset storage space to form a second node change notification set;
after the first node change notification set sent by the zookeeper server is received, searching for a lost node change notification which does not exist in the second node change notification set in the first node change notification set;
and finishing corresponding processing operation according to the example node path of the lost node change notification.
Further, the step of searching for a lost node change notification that does not exist in the second node change notification set in the first node change notification set comprises:
extracting a first change time of each node change notification in the first node change notification set;
searching a second change time which is the same as each first change time in the second node change notification set;
and acquiring the remaining first change time without finding the same second change time, and recording the node change notification corresponding to the remaining first change time as the lost node change notification.
Further, after the step of searching for a lost node change notification that does not exist in the second node change notification set in the first node change notification set after receiving the step of sending the first node change notification set by the zookeeper server, the method further includes:
calculating a ratio value of the number of the lost node change notifications to the number of all the node change notifications in the first node change notification set;
and if the proportion value is larger than a preset proportion threshold value, generating alarm information.
The application further provides a device for sending a node change notification, which is used for sending the node change notification to a subscriber server by the zookeeper server, wherein a notification component for enabling the zookeeper server to support RESTful interface calling is installed in the zookeeper server, and the device comprises:
the system comprises an acquisition unit, a server and a server, wherein the acquisition unit is used for acquiring a node change notification by a zookeeper server, and the node change notification comprises an example node path and change time;
a sending storage unit, configured to invoke a first RESTful interface of the subscriber server by using the notification component, send the node change notification to the subscriber server, and store the node change notification in a local first node change notification set;
and the calling and sending unit is used for calling a second RESTful interface preset by the subscriber server through the notification component under a preset condition and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
The application also provides a device for preventing the loss of the node change notification, which is used for preventing the loss of the node change notification sent by the zookeeper server by using the method for sending the node change notification; the device for preventing the loss of the node change notification comprises the following steps:
a receiving unit, configured to receive, by the subscriber server through the first RESTful interface, a node change notification sent by the zookeeper server, and store the received node change notification in a preset storage space to form a second node change notification set;
a searching unit, configured to search, after receiving the first node change notification set sent by the zookeeper server, for a lost node change notification that does not exist in the second node change notification set in the first node change notification set;
and the processing unit is used for finishing corresponding processing operation according to the example node path of the lost node change notification.
The present application further provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of the method of sending a node change notification according to any one of claims 1 to 3 or the steps of the method of preventing a node change notification from being lost according to any one of claims 4 to 6 when executing the computer program.
The present application further provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method of sending a node change notification according to any one of claims 1 to 3, or the steps of the method of preventing loss of a node change notification according to any one of claims 4 to 6.
According to the method, the device and the computer equipment for preventing the node change notification from being lost, the first node change notification set stored in the zookeeper server and the second node change notification set stored in the subscriber server can be used for quickly finding out node change notifications which are lacked relative to the first node change notification set in the second node change notification set, the lacked node change notifications are lost node change notifications which are not received by the subscriber server, and the change notifications of the zookeeper node are ensured not to be lost due to network congestion, subscriber system faults and the like.
Drawings
Fig. 1 is a flowchart illustrating a method for sending a node change notification according to an embodiment of the present application;
fig. 2 is a flowchart illustrating a method for preventing loss of a node change notification according to an embodiment of the present application;
fig. 3 is a block diagram schematically illustrating a structure of an apparatus for sending a node change notification according to an embodiment of the present application;
fig. 4 is a block diagram schematically illustrating a structure of an apparatus for preventing loss of a node change notification according to an embodiment of the present application;
fig. 5 is a block diagram illustrating a structure of a computer device according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Referring to fig. 1, an embodiment of the present application provides a method for sending a node change notification, where the method is used for a zookeeper server to send a node change notification to a subscriber server, and a notification component that enables the zookeeper server to support RESTful interface call is installed in the zookeeper server.
The zookeeper server is a server for operating zookeeper, and zookeeper is a network system which only supports a monitoring mode to notify a subscriber and does not support RESTful (Representational State Transfer, abbreviated as REST) to describe an architecture style, and refers to a set of architecture constraints and principles. An application or design meeting the constraints and principles is a tool for notifying a subscriber of a RESTful) interface, so that developers write or call an existing RESTful notification component by themselves and add the RESTful notification component into a zookeeper, so that the zookeeper supports RESTful interface notification.
The method for sending the node change notification comprises the following steps:
s10, the zookeeper server obtains a node change notification, wherein the node change notification comprises an instance node path and change time;
s20, calling a first RESTful interface of the subscriber server by using the notification component, sending the node change notification to the subscriber server, and storing the node change notification in a local first node change notification set;
and S30, under a preset condition, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
As described in steps S10 and S20, after obtaining each node change, the zookeeper server initiates http to call the first RESTful interface to notify the subscriber server, and stores the generated node change notification in a local storage space of the zookeeper server, so as to form a first node change notification set. When the first RESTful interface is called by http to notify the subscriber server, network congestion or system failure of the subscriber server exists, so that the node change notification is lost, that is, after the zookeeper server finishes sending the node change notification to the subscriber server, the node change notification cannot be received by the subscriber server. And storing the first node change set in a local storage space of the zookeeper server, wherein the node change notification stored in the storage space has no loss condition.
As described in the above step S30, the preset condition is a preset precondition, and only when the preset condition is reached, the corresponding operation is executed. In the present application, the preset condition includes a plurality of conditions, for example, a condition that is necessary to be a certain time limit condition, a condition that is necessary to be a certain collective data amount limit condition, and the like. In this embodiment, when the preset condition is met, the notification component calls a second RESTful interface preset by the subscriber server, and transmits the first node change notification set to the subscriber server through the second RESTful interface. After receiving the first change node set, the subscriber server may determine, according to the node change notification that the subscriber server has received, a node change notification that the subscriber server has not received, and then call an instance node path of the node change notification that the subscriber server in the first node change notification set has not received, to complete the corresponding processing operation again.
In an embodiment, the step S30 of invoking, by the notification component, a second RESTful interface preset by the subscriber server under the preset condition, and transmitting the first node change notification set to the subscriber server through the second RESTful interface includes:
s3011, judging whether the number of the node change notifications in the first node change notification set is equal to a preset number threshold;
and S3012, if yes, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
As described in the foregoing steps S3011 and S3012, that is, the preset condition is that the number of the node change notifications in the first node change notification set is equal to a preset number threshold, for example, the number threshold is 50, when the number of the node change notifications in the first node change notification set is 50, the notification component is triggered to call a second RESTful interface preset by the subscriber server, and the first node change notification set is transmitted to the subscriber server through the second RESTful interface. The number threshold is used as a preset condition, so that the situation that when the number of the node change notifications in the first node notification set is too large, the node change notifications are sent to the subscriber server again to cause network congestion can be prevented.
In another embodiment, the step S30 of invoking, by the notification component, a second RESTful interface preset by the subscriber server under the preset condition, and transmitting the first node change notification set to the subscriber server through the second RESTful interface includes:
s3021, acquiring a first time when the first node change notification set is sent to the subscriber server last time, and acquiring a current second time;
s3022, judging whether the time difference between the first time and the second time is equal to a preset time threshold value;
and S3023, if yes, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
As described in the above steps S3021 to S3023, that is, the preset condition is that the time difference between the first time of sending the first node change notification set to the subscriber server last time and the second time of sending the first node change notification set to the subscriber server last time is equal to a preset time threshold, for example, the time threshold is 30 minutes, the first time of sending the first node change notification set to the subscriber server last time is 30 minutes at 1 pm, and when the time is 2 pm on the same day, the time difference between the first time of sending the first node change notification set and the second time of sending the first node change notification set to the subscriber server last time is equal to the time threshold, which triggers the operation of calling a second RESTful interface preset by the subscriber server through the notification component and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
In an embodiment, the step of transmitting the first node change notification set to the subscriber server through a second RESTful interface includes:
sending a preset handshake request to the subscriber server;
and if the feedback of successful handshake of the subscriber server is received, transmitting the first node change notification set to the subscriber server through a second RESTful interface.
In this embodiment, after receiving the feedback that the handshake is successful, the first node change notification set is transmitted to the subscriber server through the second RESTful interface, so that it is possible to prevent the first node change notification set from being unsuccessfully transmitted to the subscriber server due to the network failure. Further, if the feedback of successful handshake of the subscriber server is not received, a handshake request is sent to the subscriber server according to a preset frequency, and the operation of transmitting the first node change notification set to the subscriber server through a second RESTful interface is not executed until the feedback of successful handshake is received. And when the feedback of successful handshake is not received within the specified time span, alarm information is generated and sent to a preset terminal, so that the working personnel can know the condition and carry out technical processing.
Compared with the prior art, the method for sending the node change notification in the embodiment includes that after the zookeeper server receives a monitoring request of the subscriber server, the zookeeper server not only sends the corresponding node change notification to the subscriber server, but also stores the node change notification locally, and actively sends the first node change notification set stored locally to the subscriber server after a preset condition is reached, so that the subscriber server can find out the lost node change notification by using the first node change notification set, and the lost node change notification is processed in a supplementing manner.
Referring to fig. 2, an embodiment of the present application further provides a method for preventing a node change notification from being lost, where the method is used for a subscriber server to prevent a node change notification sent by a zookeeper server by using a method for sending a node change notification as in any one of the above embodiments from being lost; the method for preventing the loss of the node change notification comprises the following steps:
s11, the subscriber server receives the node change notification sent by the zookeeper server through the first RESTful interface, and stores the received node change notification in a preset storage space to form a second node change notification set;
s21, after receiving the first node change notification set sent by the zookeeper server, searching for a lost node change notification which does not exist in the second node change notification set in the first node change notification set;
and S31, completing corresponding processing operation according to the example node path of the lost node change notification.
As described in steps S11 to S31, when the zookeeper server sends the node change notification to the subscriber server, if there is network congestion or a system failure of the subscriber server may cause the node change notification to be lost, that is, the node change notification received by the subscriber server is not necessarily all the node change notifications that the zookeeper server has sent to it, and there may be a lost node change notification. In the present application, the subscriber server records the node change notification received by the subscriber server, and stores the node change notification in the local to form a second node change notification set, where the node change notification in the second node change notification set may be the same as the node change notification in the first node change set, or may be a part less than the node change notification in the first node change set, where the part less is the node change notification that the subscriber server does not receive, that is, the above-mentioned lost node change notification. After the lost node change notification is found, the corresponding processing operation can be completed according to the instance node path of the lost node change notification, so that the subscriber server supplements the processing of the lost node change notification.
In an embodiment, the step S21, after receiving the first node change notification set sent by the zookeeper server, of searching for a lost node change notification that does not exist in the second node change notification set in the first node change notification set includes:
s2111, after the first node change notification set sent by the zookeeper server is received, extracting first change time of each node change notification in the first node change notification set;
s2112, searching for second change time which is the same as each first change time in the second node change notification set;
s2113, obtaining the remaining first change time without finding the same second change time, and marking the node change notification corresponding to the remaining first change time as the lost node change notification.
As described in steps S2111 to S2113, since the node change notification has the change time when the notification is generated, in the present embodiment, the change time of the node change notification is used as a basis for determining whether the node change notification in the first node change notification set is the same as the node change notification in the second node change notification set, and if the node change notification in the first node change notification set is the same as the node change notification in the second node change notification set, it is described that the node change notification is received and processed by the subscriber server, and if not, it is described that the node change notification is a lost node change notification.
In an embodiment, after the step S21 of searching for a missing node change notification that does not exist in the second node change notification set in the first node change notification set after receiving the step S21 in which the zookeeper server sends the first node change notification set, the method further includes:
s2101, calculating a ratio of the number of the lost node change notifications to the number of all the node change notifications in the first node change notification set;
and S2102, if the proportion value is larger than a preset proportion threshold value, generating alarm information.
As described in the above steps S2101 and S2102, if there are a lot of lost node change notifications, it is indicated that there is a serious problem such as network congestion or system failure of the subscriber server, and an alarm message is generated so that the worker can know the situation in time and perform corresponding maintenance. The alarm information can be sound/light physical alarm, or alarm in text form such as mail and short message.
According to the method for preventing the loss of the node change notification, the first node change notification set stored in the zookeeper server and the second node change notification set stored in the subscriber server are received, so that node change notifications which are lacked relative to the first node change notification set in the second node change notification set can be quickly found out, the lacked node change notifications are lost node change notifications which are not received by the subscriber server, and the change notifications of the zookeeper node are ensured not to be lost due to network congestion, subscriber system faults and the like.
Referring to fig. 3, a device for sending a node change notification according to an embodiment of the present invention is a device for sending a node change notification to a subscriber server by a zookeeper server, where a notification component is installed in the zookeeper server, and the zookeeper server supports RESTful interface call, and the device includes:
an obtaining unit 10, configured to obtain a node change notification by a zookeeper server, where the node change notification includes an instance node path and change time;
a sending and storing unit 20, configured to invoke a first RESTful interface of the subscriber server by using the notification component, send the node change notification to the subscriber server, and store the node change notification in a local first node change notification set;
a call sending unit 30, configured to call, through the notification component, a second RESTful interface preset by the subscriber server under a preset condition, and transmit the first node change notification set to the subscriber server through the second RESTful interface.
As described above in the obtaining unit 10 and the sending storage unit 20, after obtaining each node change, the zookeeper server initiates http to call the first RESTful interface to notify the subscriber server, and stores the generated node change notification in a local storage space of the zookeeper server, so as to form a first node change notification set. When the first RESTful interface is called by http to notify the subscriber server, network congestion or system failure of the subscriber server exists, so that the node change notification is lost, that is, after the zookeeper server finishes sending the node change notification to the subscriber server, the node change notification cannot be received by the subscriber server. And storing the first node change set in a local storage space of the zookeeper server, wherein the node change notification stored in the storage space has no loss condition.
As mentioned above, the predetermined condition is a predetermined precondition, and only when the predetermined precondition is reached, the corresponding operation is executed. In the present application, the preset condition includes a plurality of conditions, for example, a condition that is necessary to be a certain time limit condition, a condition that is necessary to be a certain collective data amount limit condition, and the like. In this embodiment, when the preset condition is met, the notification component calls a second RESTful interface preset by the subscriber server, and transmits the first node change notification set to the subscriber server through the second RESTful interface. After receiving the first change node set, the subscriber server may determine, according to the node change notification that the subscriber server has received, a node change notification that the subscriber server has not received, and then call an instance node path of the node change notification that the subscriber server in the first node change notification set has not received, to complete the corresponding processing operation again.
In an embodiment, the call sending unit 30 includes:
a first determining module, configured to determine whether a number of node change notifications in the first node change notification set is equal to a preset number threshold;
and the first call sending module is used for calling a second RESTful interface preset by the subscriber server through the notification component if the number of the node change notifications in the first node change notification set is equal to a preset number threshold, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
As for the first determining module and the first call sending module, that is, the preset condition is that the number of the node change notifications in the first node change notification set is equal to a preset number threshold, for example, the number threshold is 50, when the number of the node change notifications in the first node change notification set is 50, the notification component is triggered to call a second RESTful interface preset by the subscriber server, and the first node change notification set is transmitted to the subscriber server through the second RESTful interface. The number threshold is used as a preset condition, so that the situation that when the number of the node change notifications in the first node notification set is too large, the node change notifications are sent to the subscriber server again to cause network congestion can be prevented.
In another embodiment, the call sending unit 30 includes:
an obtaining module, configured to obtain a first time when the first node change notification set is sent to the subscriber server last time, and obtain a current second time;
the second judging module is used for judging whether the time difference between the first time and the second time is equal to a preset time threshold value or not;
and if the time difference is equal to a preset time threshold, a second call sending module calls a second RESTful interface preset by the subscriber server through the notification component, and transmits the first node change notification set to the subscriber server through the second RESTful interface.
The obtaining module, the second determining module, and the second call sending module are configured to obtain a first time when the first node change notification set was sent to the subscriber server last time, and a time difference between a current second time and the preset time threshold, where the first time when the first node change notification set was sent to the subscriber server last time is 30 minutes at 1 pm if the time threshold is 30 minutes, and the time difference between the first time and the current second time when the time is 2 pm on the same day is equal to the time threshold, and then trigger the operation of calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
In an embodiment, the call sending unit 30 includes:
a sending module, configured to send a preset handshake request to the subscriber server;
and the transmission module is used for transmitting the first node change notification set to the subscriber server through a second RESTful interface if receiving the feedback of successful handshake of the subscriber server.
In this embodiment, after receiving the feedback that the handshake is successful, the first node change notification set is transmitted to the subscriber server through the second RESTful interface, so that it is possible to prevent the first node change notification set from being unsuccessfully transmitted to the subscriber server due to the network failure. Further, if the feedback of successful handshake of the subscriber server is not received, a handshake request is sent to the subscriber server according to a preset frequency, and the operation of transmitting the first node change notification set to the subscriber server through a second RESTful interface is not executed until the feedback of successful handshake is received. And when the feedback of successful handshake is not received within the specified time span, alarm information is generated and sent to a preset terminal, so that the working personnel can know the condition and carry out technical processing.
In the apparatus for sending a node change notification according to this embodiment, after the zookeeper server receives a monitoring request from the subscriber server, the zookeeper server not only sends the corresponding node change notification to the subscriber server, but also stores the node change notification locally, and when a preset condition is reached, actively sends the first node change notification set stored locally to the subscriber server, so that the subscriber server can find out the lost node change notification by using the first node change notification set, thereby completing the processing of the lost node change notification.
Referring to fig. 4, a device for preventing loss of a node change notification according to an embodiment of the present application is further configured to prevent, by a subscriber server, loss of a node change notification sent by a zookeeper server by using a method for sending a node change notification according to any one of the embodiments; the device for preventing the loss of the node change notification comprises the following components:
a receiving unit 11, configured to receive, by the subscriber server through the first RESTful interface, a node change notification sent by the zookeeper server, and store the received node change notification in a preset storage space to form a second node change notification set;
a searching unit 21, configured to search, after receiving the first node change notification set sent by the zookeeper server, for a lost node change notification that does not exist in the second node change notification set in the first node change notification set;
and the processing unit 31 is configured to complete corresponding processing operations according to the instance node path of the lost node change notification.
As described in the receiving unit 11, the searching unit 21, and the processing unit 31, when the zookeeper server sends the node change notification to the subscriber server, if there is network congestion or a system failure of the subscriber server may cause the node change notification to be lost, that is, the node change notification received by the subscriber server is not necessarily all the node change notifications that the zookeeper server has sent to it, and there may be a lost node change notification. In the present application, the subscriber server records the node change notification received by the subscriber server, and stores the node change notification in the local to form a second node change notification set, where the node change notification in the second node change notification set may be the same as the node change notification in the first node change set, or may be a part less than the node change notification in the first node change set, where the part less is the node change notification that the subscriber server does not receive, that is, the above-mentioned lost node change notification. After the lost node change notification is found, the corresponding processing operation can be completed according to the instance node path of the lost node change notification, so that the subscriber server supplements the processing of the lost node change notification.
In an embodiment, the search unit 21 includes:
the extracting module is used for extracting the first change time of each node change notice in the first node change notice set after receiving the first node change notice set sent by the zookeeper server;
the searching module is used for searching a second change time which is the same as each first change time in the second node change notification set;
and the confirming unit is used for acquiring the remaining first change time for which the same second change time is not found, and recording the node change notification corresponding to the remaining first change time as the lost node change notification.
As described above, in the present embodiment, since the node change notification has the change time when the notification is generated, the change time of the node change notification is used as a basis for determining whether the node change notification in the first node change notification set is the same as the node change notification in the second node change notification set, and if the node change notification in the first node change notification set is the same as the node change notification in the second node change notification set, it is determined that the node change notification is received and processed by the subscriber server, and if the node change notification is not the same, it is determined that the node change notification is a lost node change notification.
In one embodiment, the apparatus for preventing loss of a node change notification further includes:
a proportion calculation unit, configured to calculate a proportion value of the number of the lost node change notifications to the number of all node change notifications in the first node change notification set;
and the generating unit is used for generating alarm information if the proportion value is greater than a preset proportion threshold value.
According to the proportion calculation unit and the generation unit, if a large number of lost node change notifications exist, serious problems such as network congestion or system faults of a subscriber server are indicated, and alarm information is generated so that working personnel can know the conditions in time and perform corresponding maintenance. The alarm information can be sound/light physical alarm, or alarm in text form such as mail and short message.
According to the device for preventing the loss of the node change notification, the first node change notification set stored in the zookeeper server and the second node change notification set stored in the subscriber server are received, so that node change notifications which are lacked relative to the first node change notification set in the second node change notification set can be quickly found out, the lacked node change notifications are lost node change notifications which are not received by the subscriber server, and the change notifications of the zookeeper node are ensured not to be lost due to network congestion, subscriber system faults and the like.
Referring to fig. 5, a computer device is also provided in the embodiment of the present application, where the computer device may be the management server described above, or a server corresponding to a management node, and its internal structure may be as shown in fig. 5. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer designed processor is used to provide computational and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used for storing data such as the first node change notification set or the second node change notification set. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of sending a node change notification or a method of preventing loss of a node change notification.
In one embodiment, when the processor executes the method for sending a node change notification, the processor is configured to send a node change notification to a subscriber server by using a zookeeper server, where the zookeeper server is installed with a notification component that enables the zookeeper server to support RESTful interface call, and the method for sending a node change notification includes: the zookeeper server acquires a node change notification, wherein the node change notification comprises an instance node path and change time; calling a first RESTful interface of the subscriber server by using the notification component, sending the node change notification to the subscriber server, and storing the node change notification in a local first node change notification set; and under a preset condition, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
In an embodiment, the step of invoking, by the notification component, a second RESTful interface preset by the subscriber server under the preset condition, and transmitting the first node change notification set to the subscriber server through the second RESTful interface includes: judging whether the number of the node change notifications in the first node change notification set is equal to a preset number threshold value or not; if yes, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
In an embodiment, the step of invoking, by the notification component, a second RESTful interface preset by the subscriber server under the preset condition, and transmitting the first node change notification set to the subscriber server through the second RESTful interface includes: acquiring a first time of sending the first node change notification set to the subscriber server at the previous time and acquiring a current second time; judging whether the time difference between the first time and the second time is equal to a preset time threshold value or not; if yes, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
In another embodiment, when the processor executes the method for preventing loss of a node change notification, the processor is configured to prevent, by the subscriber server, loss of a node change notification transmitted by the zookeeper server by using any one of the methods for transmitting a node change notification described above; the method for preventing the loss of the node change notification comprises the following steps: the subscriber server receives a node change notification sent by the zookeeper server through the first RESTful interface, and stores the received node change notification in a preset storage space to form a second node change notification set; after the first node change notification set sent by the zookeeper server is received, searching for a lost node change notification which does not exist in the second node change notification set in the first node change notification set; and finishing corresponding processing operation according to the example node path of the lost node change notification.
In an embodiment, the step of searching for a missing node change notification that does not exist in the second node change notification set in the first node change notification set includes: extracting a first change time of each node change notification in the first node change notification set; searching a second change time which is the same as each first change time in the second node change notification set; and acquiring the remaining first change time without finding the same second change time, and recording the node change notification corresponding to the remaining first change time as the lost node change notification.
In an embodiment, after receiving the step of searching for a lost node change notification that does not exist in the second node change notification set in the first node change notification set after the zookeeper server sends the first node change notification set, the method further includes: calculating a ratio value of the number of the lost node change notifications to the number of all the node change notifications in the first node change notification set; and if the proportion value is larger than a preset proportion threshold value, generating alarm information.
Those skilled in the art will appreciate that the architecture shown in fig. 5 is only a block diagram of some of the structures associated with the present solution and is not intended to limit the scope of the present solution as applied to computer devices.
According to the computer device, through the first node change notification set stored in the zookeeper server and the second node change notification set stored in the subscriber server, node change notifications which are absent from the second node change notification set relative to the first node change notification set can be quickly found out, and the absent node change notifications are lost node change notifications which are not received by the subscriber server, so that the change notifications of the zookeeper node are not lost due to network congestion, subscriber system faults and the like.
Embodiments of the present application also provide a computer-readable storage medium having stored thereon a computer program, which when executed by a processor implements a method of sending a node change notification or a method of preventing a node change notification from being lost.
In one embodiment, when the processor executes the method for sending a node change notification, the processor is configured to send a node change notification to a subscriber server by using a zookeeper server, where the zookeeper server is installed with a notification component that enables the zookeeper server to support RESTful interface call, and the method for sending a node change notification includes: the zookeeper server acquires a node change notification, wherein the node change notification comprises an instance node path and change time; calling a first RESTful interface of the subscriber server by using the notification component, sending the node change notification to the subscriber server, and storing the node change notification in a local first node change notification set; and under a preset condition, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
In an embodiment, the step of invoking, by the notification component, a second RESTful interface preset by the subscriber server under the preset condition, and transmitting the first node change notification set to the subscriber server through the second RESTful interface includes: judging whether the number of the node change notifications in the first node change notification set is equal to a preset number threshold value or not; if yes, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
In an embodiment, the step of invoking, by the notification component, a second RESTful interface preset by the subscriber server under the preset condition, and transmitting the first node change notification set to the subscriber server through the second RESTful interface includes: acquiring a first time of sending the first node change notification set to the subscriber server at the previous time and acquiring a current second time; judging whether the time difference between the first time and the second time is equal to a preset time threshold value or not; if yes, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
In another embodiment, when the processor executes the method for preventing loss of a node change notification, the processor is configured to prevent, by the subscriber server, loss of a node change notification transmitted by the zookeeper server by using any one of the methods for transmitting a node change notification described above; the method for preventing the loss of the node change notification comprises the following steps: the subscriber server receives a node change notification sent by the zookeeper server through the first RESTful interface, and stores the received node change notification in a preset storage space to form a second node change notification set; after the first node change notification set sent by the zookeeper server is received, searching for a lost node change notification which does not exist in the second node change notification set in the first node change notification set; and finishing corresponding processing operation according to the example node path of the lost node change notification.
In an embodiment, the step of searching for a missing node change notification that does not exist in the second node change notification set in the first node change notification set includes: extracting a first change time of each node change notification in the first node change notification set; searching a second change time which is the same as each first change time in the second node change notification set; and acquiring the remaining first change time without finding the same second change time, and recording the node change notification corresponding to the remaining first change time as the lost node change notification.
In an embodiment, after receiving the step of searching for a lost node change notification that does not exist in the second node change notification set in the first node change notification set after the zookeeper server sends the first node change notification set, the method further includes: calculating a ratio value of the number of the lost node change notifications to the number of all the node change notifications in the first node change notification set; and if the proportion value is larger than a preset proportion threshold value, generating alarm information.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in the examples may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double-rate SDRAM (SSRSDRAM), Enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A method for sending a node change notification is used for sending the node change notification to a subscriber server by a zookeeper server, wherein a notification component enabling the zookeeper server to support RESTful interface calling is installed in the zookeeper server, and the method for sending the node change notification comprises the following steps:
the zookeeper server acquires a node change notification, wherein the node change notification comprises an instance node path and change time;
calling a first RESTful interface of the subscriber server by using the notification component, sending the node change notification to the subscriber server, and storing the node change notification in a local first node change notification set;
under a preset condition, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface;
further comprising the steps of:
the subscriber server receives a node change notification sent by the zookeeper server through the first RESTful interface, and stores the received node change notification in a preset storage space to form a second node change notification set;
after the first node change notification set sent by the zookeeper server is received, searching for a lost node change notification which does not exist in the second node change notification set in the first node change notification set;
and finishing corresponding processing operation according to the example node path of the lost node change notification.
2. The method of claim 1, wherein said step of invoking a second RESTful interface preset by said subscriber server via said notification component and transmitting said first set of node change notifications to said subscriber server via said second RESTful interface under preset conditions comprises:
judging whether the number of the node change notifications in the first node change notification set is equal to a preset number threshold value or not;
if yes, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
3. The method of claim 1, wherein said step of invoking a second RESTful interface preset by said subscriber server via said notification component and transmitting said first set of node change notifications to said subscriber server via said second RESTful interface under preset conditions comprises:
acquiring a first time of sending the first node change notification set to the subscriber server at the previous time and acquiring a current second time;
judging whether the time difference between the first time and the second time is equal to a preset time threshold value or not;
if yes, calling a second RESTful interface preset by the subscriber server through the notification component, and transmitting the first node change notification set to the subscriber server through the second RESTful interface.
4. A method for preventing loss of a node change notification, which is used for preventing loss of a node change notification sent by a zookeeper server by using the method for sending the node change notification according to any one of claims 1 to 3 by a subscriber server; the method for preventing the loss of the node change notification is characterized by comprising the following steps:
the subscriber server receives a node change notification sent by the zookeeper server through the first RESTful interface, and stores the received node change notification in a preset storage space to form a second node change notification set;
after the first node change notification set sent by the zookeeper server is received, searching for a lost node change notification which does not exist in the second node change notification set in the first node change notification set;
and finishing corresponding processing operation according to the example node path of the lost node change notification.
5. The method of claim 4, wherein the step of searching the first node change notification set for the lost node change notification that does not exist in the second node change notification set comprises:
extracting a first change time of each node change notification in the first node change notification set;
searching a second change time which is the same as each first change time in the second node change notification set;
and acquiring the remaining first change time without finding the same second change time, and recording the node change notification corresponding to the remaining first change time as the lost node change notification.
6. The method according to claim 5, wherein after the step of searching for a lost node change notification that does not exist in the second node change notification set in the first node change notification set after receiving the first node change notification set sent by the zookeeper server, the method further comprises:
calculating a ratio value of the number of the lost node change notifications to the number of all the node change notifications in the first node change notification set;
and if the proportion value is larger than a preset proportion threshold value, generating alarm information.
7. An apparatus for transmitting a node change notification, configured to a zookeeper server that has installed therein a notification component that causes the zookeeper server to support RESTful interface calls, to transmit the node change notification to a subscriber server, the apparatus comprising:
the system comprises an acquisition unit, a server and a server, wherein the acquisition unit is used for acquiring a node change notification by a zookeeper server, and the node change notification comprises an example node path and change time;
a sending storage unit, configured to invoke a first RESTful interface of the subscriber server by using the notification component, send the node change notification to the subscriber server, and store the node change notification in a local first node change notification set;
a calling and sending unit, configured to call, through the notification component, a second RESTful interface preset by the subscriber server under a preset condition, and transmit the first node change notification set to the subscriber server through the second RESTful interface;
further comprising: a receiving unit, configured to receive, by the subscriber server through the first RESTful interface, a node change notification sent by the zookeeper server, and store the received node change notification in a preset storage space to form a second node change notification set;
a searching unit, configured to search, after receiving the first node change notification set sent by the zookeeper server, for a lost node change notification that does not exist in the second node change notification set in the first node change notification set;
and the processing unit is used for finishing corresponding processing operation according to the example node path of the lost node change notification.
8. An apparatus for preventing loss of a node change notification, which is used by a subscriber server to prevent loss of a node change notification transmitted by a zookeeper server by using the method for transmitting a node change notification according to any one of claims 1 to 3; the apparatus for preventing loss of node change notification includes:
a receiving unit, configured to receive, by the subscriber server through the first RESTful interface, a node change notification sent by the zookeeper server, and store the received node change notification in a preset storage space to form a second node change notification set;
a searching unit, configured to search, after receiving the first node change notification set sent by the zookeeper server, for a lost node change notification that does not exist in the second node change notification set in the first node change notification set;
and the processing unit is used for finishing corresponding processing operation according to the example node path of the lost node change notification.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor when executing the computer program performs the steps of the method of sending a node change notification according to any one of claims 1 to 3 or the steps of the method of preventing loss of a node change notification according to any one of claims 4 to 6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of sending a node change notification according to any one of claims 1 to 3, or carries out the steps of the method of preventing loss of a node change notification according to any one of claims 4 to 6.
CN201910305189.8A 2019-04-16 2019-04-16 Method and device for preventing node change notification from being lost and computer equipment Active CN110166528B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910305189.8A CN110166528B (en) 2019-04-16 2019-04-16 Method and device for preventing node change notification from being lost and computer equipment
PCT/CN2019/118161 WO2020211361A1 (en) 2019-04-16 2019-11-13 Method for preventing loss of node change notification, device and computer apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910305189.8A CN110166528B (en) 2019-04-16 2019-04-16 Method and device for preventing node change notification from being lost and computer equipment

Publications (2)

Publication Number Publication Date
CN110166528A CN110166528A (en) 2019-08-23
CN110166528B true CN110166528B (en) 2022-03-18

Family

ID=67639613

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910305189.8A Active CN110166528B (en) 2019-04-16 2019-04-16 Method and device for preventing node change notification from being lost and computer equipment

Country Status (2)

Country Link
CN (1) CN110166528B (en)
WO (1) WO2020211361A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110166528B (en) * 2019-04-16 2022-03-18 平安科技(深圳)有限公司 Method and device for preventing node change notification from being lost and computer equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH033054A (en) * 1989-05-31 1991-01-09 Yokogawa Electric Corp Method for preventing communication data from being missed
US6687848B1 (en) * 2000-05-31 2004-02-03 Sun Microsystems, Inc. Techniques for preventing information loss in a business to business message in an enterprise computer system
CN1822533A (en) * 2006-03-27 2006-08-23 阿里巴巴公司 Message reliable informing method and system between systems
CN105282118A (en) * 2014-07-21 2016-01-27 中兴通讯股份有限公司 Control resource change notification message sending method and apparatus
CN106712981A (en) * 2015-07-23 2017-05-24 阿里巴巴集团控股有限公司 Method and device for informing node change
CN106980643A (en) * 2017-02-14 2017-07-25 阿里巴巴集团控股有限公司 Change sending method, device and the electronic equipment of message
CN108255592A (en) * 2017-12-19 2018-07-06 武汉市烽视威科技有限公司 A kind of Quartz clusters timing task processing system and method
CN108984544A (en) * 2017-05-31 2018-12-11 北京京东尚科信息技术有限公司 A kind of method and apparatus of distributed system modification configuration information
CN109525466A (en) * 2019-01-03 2019-03-26 杭州云英网络科技有限公司 Back end monitor method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104092718B (en) * 2013-12-12 2017-10-24 腾讯数码(天津)有限公司 The update method of configuration information in distributed system and distributed system
CN104636135B (en) * 2014-12-31 2018-05-04 北京奇虎科技有限公司 A kind of node visit method and system, Client Agent and client
US10887173B2 (en) * 2016-12-21 2021-01-05 Juniper Networks, Inc. Communicating state information in distributed operating systems
CN110166528B (en) * 2019-04-16 2022-03-18 平安科技(深圳)有限公司 Method and device for preventing node change notification from being lost and computer equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH033054A (en) * 1989-05-31 1991-01-09 Yokogawa Electric Corp Method for preventing communication data from being missed
US6687848B1 (en) * 2000-05-31 2004-02-03 Sun Microsystems, Inc. Techniques for preventing information loss in a business to business message in an enterprise computer system
CN1822533A (en) * 2006-03-27 2006-08-23 阿里巴巴公司 Message reliable informing method and system between systems
CN105282118A (en) * 2014-07-21 2016-01-27 中兴通讯股份有限公司 Control resource change notification message sending method and apparatus
CN106712981A (en) * 2015-07-23 2017-05-24 阿里巴巴集团控股有限公司 Method and device for informing node change
CN106980643A (en) * 2017-02-14 2017-07-25 阿里巴巴集团控股有限公司 Change sending method, device and the electronic equipment of message
CN108984544A (en) * 2017-05-31 2018-12-11 北京京东尚科信息技术有限公司 A kind of method and apparatus of distributed system modification configuration information
CN108255592A (en) * 2017-12-19 2018-07-06 武汉市烽视威科技有限公司 A kind of Quartz clusters timing task processing system and method
CN109525466A (en) * 2019-01-03 2019-03-26 杭州云英网络科技有限公司 Back end monitor method and device

Also Published As

Publication number Publication date
CN110166528A (en) 2019-08-23
WO2020211361A1 (en) 2020-10-22

Similar Documents

Publication Publication Date Title
CN106844137B (en) Server monitoring method and device
CN109714319A (en) Management system, method, apparatus, computer equipment and the storage medium of micro services
CN110334126B (en) Timing task processing method and device based on Spring MVC and computer equipment
US20200327045A1 (en) Test System and Test Method
CN112558997A (en) Method and device for deploying applications
CN110727560A (en) Cloud service alarm method and device
CN112948174A (en) Message processing method and device, computer equipment and storage medium
CN112491659B (en) Flow playback test method and device, computer equipment and storage medium
CN110851159A (en) Business rule updating method and device, computer equipment and storage medium
CN111159233A (en) Distributed caching method, system, computer device and storage medium
CN110166528B (en) Method and device for preventing node change notification from being lost and computer equipment
CN110531984B (en) Code compiling method, device, system, computer equipment and storage medium
CN109768962B (en) Firewall strategy generation method and device, computer equipment and storage medium
CN109831521B (en) Cache instance management method and device, computer equipment and storage medium
CN111382976B (en) Early warning data processing method and device, computer equipment and storage medium
CN113407823A (en) IOS message pushing method and system
US20150277892A1 (en) Multi-phase software delivery
CN113010306A (en) Service data processing method and device, computer equipment and storage medium
CN112910868A (en) Enterprise network security management method and device, computer equipment and storage medium
CN116389385A (en) System resource processing method, device, storage medium and equipment
CN110889539B (en) Method, system and device for organizing spot market clearing cases based on cloud platform
CN114610413A (en) Method, device, equipment and storage medium for executing synchronous and asynchronous tasks based on Java
CN110032601B (en) Method, device and storage medium for real-time data synchronization
EP3139536A1 (en) Alarm reporting method and device
CN113064658A (en) Method, device and equipment for copying configuration data 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