CN113821414B - Server protection method and device, electronic equipment and storage medium - Google Patents

Server protection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113821414B
CN113821414B CN202111382365.1A CN202111382365A CN113821414B CN 113821414 B CN113821414 B CN 113821414B CN 202111382365 A CN202111382365 A CN 202111382365A CN 113821414 B CN113821414 B CN 113821414B
Authority
CN
China
Prior art keywords
heartbeat
threshold value
time period
heartbeat data
node
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
CN202111382365.1A
Other languages
Chinese (zh)
Other versions
CN113821414A (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.)
Chengdu New Hope Finance Information Co Ltd
Original Assignee
Chengdu New Hope Finance Information 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 Chengdu New Hope Finance Information Co Ltd filed Critical Chengdu New Hope Finance Information Co Ltd
Priority to CN202111382365.1A priority Critical patent/CN113821414B/en
Publication of CN113821414A publication Critical patent/CN113821414A/en
Application granted granted Critical
Publication of CN113821414B publication Critical patent/CN113821414B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Fuzzy Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a server protection method, a server protection device, an electronic device and a storage medium, which are used for improving the stability of a Eureka server. The method comprises the following steps: scanning heartbeat data sent by all nodes in a time period to obtain total heartbeat data, wherein the total heartbeat data is the sum of the scanned heartbeat data; if the total heartbeat data is determined to be larger than a first heartbeat threshold value and smaller than a second heartbeat threshold value in a first time period, changing the node state which does not receive the heartbeat data in the first time period into a state to be confirmed, wherein the first heartbeat threshold value is smaller than the second heartbeat threshold value; and if the total heartbeat data is determined to be larger than the first heartbeat threshold value in the second time period, changing the state of the node to be confirmed which still does not receive the heartbeat data in the second time period to be offline, wherein the second time period is later than the first time period.

Description

Server protection method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of server protection methods, and in particular, to a server protection method, apparatus, electronic device, and storage medium.
Background
After the Eureka client successfully registers to the Eureka server, heartbeats are sent at intervals to keep the client in an online state, the Eureka server initiates node elimination (evict) every other minute, and nodes which do not receive heartbeats within one minute are marked as offline. When a network fault occurs in a registration channel of the Eureka server, a heartbeat request sent by the Eureka client cannot be received in time, a server self-protection mechanism is triggered, and a fault node is not timely offline, so that a large number of calling errors are caused. Therefore, the existing self-protection mechanism of the Eureka server has defects, thereby causing instability of the Eureka server.
Disclosure of Invention
The embodiment of the invention aims to provide a server protection method, a server protection device, an electronic device and a storage medium, which are used for improving the stability of a Eureka server.
In a first aspect, an embodiment of the present application provides a server protection method, including: scanning heartbeat data sent by all nodes in a time period to obtain total heartbeat data, wherein the total heartbeat data is the sum of the scanned heartbeat data; if the total heartbeat data is determined to be larger than a first heartbeat threshold value and smaller than a second heartbeat threshold value in a first time period, changing the node state which does not receive the heartbeat data in the first time period into a state to be confirmed, wherein the first heartbeat threshold value is smaller than the second heartbeat threshold value; and if the total heartbeat data is determined to be larger than the first heartbeat threshold value in the second time period, changing the state of the node to be confirmed which still does not receive the heartbeat data in the second time period to be offline, wherein the second time period is later than the first time period. In the implementation process, the first heartbeat threshold value and the second heartbeat threshold value are set, a delay margin of a time period is given to nodes which do not send heartbeats in the first time period, whether the nodes are eliminated or not is determined in the second time period, the elimination is to change the node state to be offline, the nodes which do not send heartbeats and are quickly recovered due to network jitter and the like are protected, and the node state is changed to be offline at a higher speed when the nodes really break down, so that the stability of the server is improved.
Optionally, in this embodiment of the application, if the total heartbeat data is not greater than the first heartbeat threshold, whether a node to be confirmed exists is queried, and if so, the state of the node to be confirmed is changed to be online. In the implementation process, a heartbeat threshold value smaller than the second heartbeat threshold value is introduced as the first heartbeat threshold value, if the heartbeat data is smaller than or equal to the first heartbeat threshold value, elimination of the node is not carried out, the online state of the node is maintained, the state of the node to be confirmed is changed to be online, the probability of triggering of a self-protection mechanism is reduced, and therefore the stability of the server is improved.
Optionally, in this embodiment of the application, if the total heartbeat data is not less than the second heartbeat threshold value, the node state that does not receive the heartbeat data is changed to offline. In the implementation process, the heartbeat threshold value larger than the first heartbeat threshold value is introduced to serve as the second heartbeat threshold value, so that the probability of triggering the self-protection mechanism is reduced, and the stability of the server is improved.
Optionally, in this embodiment of the present application, before scanning heartbeat data sent by all nodes in a time period to obtain total heartbeat data, the method further includes: the first heartbeat threshold and the second heartbeat threshold are adjusted according to the actual network environment. In the implementation process, the heartbeat threshold value can be debugged according to the current network environment, the proper heartbeat threshold value is determined, the usability of a server self-protection mechanism is improved, and therefore the stability of the server is improved.
Optionally, in this embodiment of the present application, the second heartbeat threshold is smaller than a total heartbeat threshold, where the total heartbeat threshold is a threshold of a sum of heartbeat data sent by all nodes in a time period. In the implementation process, the second heartbeat threshold value is smaller than a total heartbeat threshold value of all the nodes in the server sending heartbeat data within a time period.
Optionally, in this embodiment of the present application, changing a state of a node that does not receive heartbeat data within a first time period to be confirmed includes: acquiring a node identifier, wherein the node identifier is stored in a Key-Value database in a Key form; searching a node identifier and a value corresponding to a Key in a database; and changing the value corresponding to the Key into a state to be confirmed. In the implementation process, nodes which do not receive heartbeat data in the first time period are marked in a Key-Value storage mode, and whether the state of the nodes is changed to be offline or not is determined in the second time period, so that the stability of the server is improved.
The embodiment of the present application further provides an Eureka server protection device, including: the scanning module is used for scanning heartbeat data sent by all nodes in a time period to obtain total heartbeat data, and the total heartbeat data is the sum of the scanned heartbeat data; the first processing module is used for changing the node state which does not receive the heartbeat data in the first time period into a state to be confirmed if the total heartbeat data is determined to be larger than a first heartbeat threshold value and smaller than a second heartbeat threshold value in the first time period, wherein the first heartbeat threshold value is smaller than the second heartbeat threshold value; and the second processing module is used for changing the state of the node to be confirmed which still does not receive the heartbeat data in the second time period to be offline if the total heartbeat data is determined to be greater than the first heartbeat threshold value in the second time period, wherein the second time period is later than the first time period.
Optionally, in this embodiment of the application, the server protection device further includes: and the third processing module is used for inquiring whether the node to be confirmed exists or not if the total heartbeat data is not greater than the first heartbeat threshold value, and changing the state of the node to be confirmed to be on-line if the total heartbeat data exists.
Optionally, in this embodiment of the application, the server protection device further includes: and the fourth processing module is used for changing the node state which does not receive the heartbeat data into an offline state if the total heartbeat data is not less than the second heartbeat threshold value.
Optionally, in this embodiment of the application, the server protection device further includes: and the adjusting threshold module is used for adjusting the first heartbeat threshold and the second heartbeat threshold according to the actual network environment.
Optionally, in this embodiment of the application, the second heartbeat threshold is smaller than the total heartbeat threshold, where the total heartbeat threshold is a threshold of a sum of heartbeat data sent by all nodes in a time period.
Optionally, in this embodiment of the application, the server protection device further includes: a state changing module, configured to change a state of a node that does not receive heartbeat data within a first time period to be confirmed, including: acquiring a node identifier, wherein the node identifier is stored in a Key-Value database in a Key form; searching a node identifier and a value corresponding to a Key in a database; and changing the value corresponding to the Key into a state to be confirmed.
An embodiment of the present application further provides an electronic device, including: a processor and a memory, the memory storing processor-executable machine-readable instructions, the machine-readable instructions when executed by the processor performing the method as described above.
Embodiments of the present application also provide a computer-readable storage medium having a computer program stored thereon, where the computer program is executed by a processor to perform the above-described method.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic diagram of a server structure provided in an embodiment of the present application;
fig. 2 is a schematic flow chart of a Eureka server protection method provided in an embodiment of the present application;
fig. 3 is a schematic structural diagram of an Eureka server protection device provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. The following examples are merely used to more clearly illustrate the technical solutions of the present application, and therefore are only examples, and the protection scope of the present application is not limited thereby.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
In the description of the embodiments of the present application, the technical terms "first", "second", and the like are used only for distinguishing different objects, and are not to be construed as indicating or implying relative importance or implicitly indicating the number, specific order, or primary-secondary relationship of the technical features indicated. In the description of the embodiments of the present application, "a plurality" means two or more unless specifically defined otherwise.
Please refer to fig. 1, which shows a schematic structural diagram of an Eureka server provided in the embodiment of the present application;
eureka is a service discovery framework developed by Netflix, comprising: the system comprises an Eureka server and an Eureka client, wherein the Eureka server is used for providing functions of service registration, service inquiry, service discovery and the like for the Eureka client.
The Eureka server refers to a server running a Eureka server. Eureka may include data structures or components such as registries, heartbeat tables, self-protected heartbeat thresholds, service culling threads, etc.; each node deploying services in the server initiates registration to the Eureka server when starting, and sends heartbeats to the server at certain intervals; the service elimination module compares the acquired heartbeat data t with a heartbeat threshold value to make judgment and acquire a judgment result, wherein the judgment result comprises a suspected fault node set, and the suspected fault node is a node which does not send out heartbeat; and eliminating the nodes through the service elimination thread according to the judgment result, wherein the elimination is to change the node state into offline. The node can be a Eureka client registered in the Eureka server, and the Eureka client can pull other Eureka client information on the Eureka server.
Please refer to fig. 2, which is a schematic flow chart diagram of a server protection method according to an embodiment of the present application.
The server protection method sets a first heartbeat threshold value and a second heartbeat threshold value, changes the state of a node by comparing the heartbeat sent by the node with the threshold value, gives a delay margin of a time period to the node which does not send the heartbeat in the first time period, and determines whether to change the state of the node to be offline in the second time period, thereby improving the stability of the server. The server protection method may include the steps of:
step S110: and scanning heartbeat data sent by all nodes in a time period to obtain total heartbeat data, wherein the total heartbeat data is the sum of the scanned heartbeat data.
The embodiment of step S110 described above is, for example: after the nodes are successfully registered in the Eureka server, heartbeat data can be sent at intervals to keep the client-side online state, the interval time can be set, the Eureka server scans the heartbeat data sent by all the nodes in a time period, and the total heartbeat data is obtained through a heartbeat table. Wherein, the server scanning time period may be one minute.
Specifically, for example, 40 nodes are deployed in a distributed system, a node in an online state sends a heartbeat to a server every 30S, if 30 nodes send heartbeat data to the server every 30S within one minute, and an Eureka server scans the heartbeat data sent by the node every one minute, the heartbeat data obtained in one minute is 30 × 2=60 heartbeats.
After step S110, step S120 is performed: if the total heartbeat data is determined to be larger than the first heartbeat threshold value and smaller than the second heartbeat threshold value in the first time period, the node state of the node which does not receive the heartbeat data in the first time period is changed to be confirmed, and the first heartbeat threshold value is smaller than the second heartbeat threshold value.
The embodiment of step S120 described above is, for example: the time period of scanning the heartbeat data by the Eureka server may be one minute, and the total heartbeat data of the first time period is the total heartbeat data obtained by scanning the heartbeat data in the first minute. And comparing the total heartbeat data of the first minute with a preset first heartbeat threshold value and a preset second heartbeat threshold value, and if the total heartbeat data of the first minute is greater than the first heartbeat threshold value and smaller than the second heartbeat threshold value, changing the node state which does not receive the heartbeat data in the first time period into a state to be confirmed, wherein the node does not send out the heartbeat data if the total heartbeat data of the first minute is not greater than the first heartbeat threshold value and smaller than the second heartbeat threshold value, and the first heartbeat threshold value is smaller than the second heartbeat threshold value.
Specifically, for example, if each node in a distributed system sends heartbeat data to a server every 30S, the total heartbeat threshold obtained by the server in one minute is 80 heartbeats. The first heartbeat threshold may be set to 50% of the total heartbeat threshold and the second heartbeat threshold may be set to 85% of the total heartbeat threshold, i.e. the first heartbeat threshold is 40 heartbeats and the second heartbeat threshold is 68 heartbeats. If 40 nodes are deployed in the system, wherein 30 nodes send heartbeat data to the server every 30 seconds, the total heartbeat data obtained by the first minute server is 60 heartbeats, and if the total heartbeat data is greater than a first heartbeat threshold value and less than a second heartbeat threshold value, 10 nodes which do not send heartbeats are marked as nodes to be confirmed.
After step S120, step S130 is performed: and if the total heartbeat data is determined to be larger than the first heartbeat threshold value in the second time period, changing the state of the node to be confirmed which still does not receive the heartbeat data in the second time period to be offline, wherein the second time period is later than the first time period.
The embodiment of step S130 described above is, for example: if the total heartbeat data of the second time period is greater than the first heartbeat threshold value, the state of the node to be confirmed which still does not receive the heartbeat data in the second time period is changed to be offline, namely whether the node marked as the state to be confirmed in the first time period sends out the heartbeat data is detected, if the node to be confirmed in the state is detected to still not send out the heartbeat data, the state of the node to be confirmed is changed to be offline, and the second time period is later than the first time period. The second time period may be a next time period to the first time period.
Specifically, for example, the second minute server scans heartbeat data to obtain total heartbeat data which is 60 heartbeats and is greater than the first heartbeat threshold value, and detects whether the first minute state is that 10 nodes to be confirmed send out heartbeat data or not; if it is detected that 10 nodes in the state to be confirmed do not send heartbeat data in the second minute, changing the states of the 10 nodes to be confirmed into offline; if 10 nodes marked as states to be confirmed are detected, wherein 5 nodes send out heartbeat in the second minute, the states of the 5 nodes are changed to be on-line, and the states of the remaining 5 nodes which do not send out heartbeat are changed to be off-line.
It should be understood that the second time period server scans the heartbeat data, and after obtaining the total heartbeat data, the action of the first time period server is also performed. And if the total heartbeat data is greater than the first heartbeat threshold value and less than the second heartbeat threshold value, changing the node state which does not send out the heartbeat in the period into a state to be confirmed, and judging whether to change the state of the node into offline in the next time period.
In the implementation process, by setting the first heartbeat threshold value and the second heartbeat threshold value, if it is determined in the first time period that the heartbeat data is greater than the first heartbeat threshold value and less than the second heartbeat threshold value, a delay margin of a time period is given to a node which does not send out heartbeats in the first time period, and whether the state of the node is marked as offline is determined in the second time period. The node which does not send out heartbeat due to network jitter and the like but recovers quickly is protected, and the state of the node is changed to be offline at a higher speed when the node really fails. The usability of the server self-protection mechanism is improved, and therefore the stability of the server is improved.
Optionally, in this embodiment of the application, if the total heartbeat data is not greater than the first heartbeat threshold, whether a node to be confirmed exists is queried, and if so, the state of the node to be confirmed is changed to be online.
The implementation manner of the above steps is as follows: the total heartbeat data is not greater than the first heartbeat threshold, that is, the total heartbeat data is less than or equal to the first heartbeat threshold. The total heartbeat data may be heartbeat data of the first time period, and may also be total heartbeat data of the second time period. And if the total heartbeat data of the first time period is less than or equal to the first heartbeat threshold value, keeping the existing node in an online state. And if the total heartbeat data of the second time period is less than or equal to the first heartbeat threshold value, inquiring whether the node to be confirmed exists, and if so, changing the state of the node to be confirmed to be on-line. That is, if the total heartbeat data is less than or equal to the first heartbeat threshold, the nodes that sent heartbeats and did not send heartbeats within the time period are both in the online state.
In the implementation process, a smaller heartbeat threshold value is introduced as a first heartbeat threshold value, if the total heartbeat data is smaller than the first heartbeat threshold value, the nodes are not eliminated, the state of the nodes to be confirmed is changed to be on-line, the probability of triggering of a self-protection mechanism is reduced, and therefore the stability of the server is improved.
Optionally, in this embodiment of the application, if the total heartbeat data is not less than the second heartbeat threshold value, the node state that does not receive the heartbeat data is changed to offline.
The implementation manner of the above steps is as follows: the total heartbeat data is not less than the second heartbeat threshold value, namely the total heartbeat data is greater than or equal to the second heartbeat threshold value. The total heartbeat data may be heartbeat data of the first time period, and may also be total heartbeat data of the second time period. And if the total heartbeat data in the first time period is greater than or equal to the second heartbeat threshold value, changing the node state which does not receive the heartbeat data in the first time period into a offline state. If the total heartbeat data of the second time period is greater than or equal to a second heartbeat threshold value, detecting whether the node marked as the state to be confirmed in the first time period sends out heartbeat data or not, and if the node marked as the state to be confirmed is detected to still not send out the heartbeat data, changing the state of the node to be offline; and changing the node state which does not receive the heartbeat data in the second time period into offline.
In the implementation process, a heartbeat threshold value larger than the first heartbeat threshold value is introduced as a second heartbeat threshold value, if the total heartbeat data is larger than or equal to the second heartbeat threshold value, a node to be confirmed which does not send a heartbeat in the last time period is detected, if the heartbeat is not sent yet, the state of the node is changed into an offline state, and the state of the node which does not send a heartbeat in the time period is changed into an offline state, so that the availability of a server self-protection mechanism is improved, and the stability of the server is improved.
Optionally, in this embodiment of the present application, before scanning heartbeat data sent by all nodes in a time period to obtain total heartbeat data, the method further includes: the first heartbeat threshold and the second heartbeat threshold are adjusted according to the actual network environment.
The implementation manner of the above steps is as follows: and adjusting the first heartbeat threshold value and the second heartbeat threshold value according to the current network environment, wherein the performance of the network environment can be obtained by simulating the network environment by using a network tool.
Specifically, for example, one host in the local area network is used as the simulation server, and the other hosts are used as the simulation clients. Two conditions are simulated for the network environment, and in the first condition, the simulation of the normal network state is carried out. The simulation client sends messages to the simulation server at a fixed frequency, for example, once in 30s, and the number of the received messages is counted at the simulation server, and the 30s is taken as a counting window. And counting the ratio of the number of messages received every 30s and the number of messages sent to the simulation server by the simulation client in the normal network for 24 hours, taking the minimum value in the normal network state as the ratio of the second heartbeat threshold value to the total heartbeat threshold value, and calculating to obtain the second heartbeat threshold value. In the second case, a simulation of the worst network state is performed. For example, increasing the bandwidth occupied by other application programs, increasing the concurrency amount, and the like, the simulation client sends messages to the simulation server at a fixed frequency, for example, once in 30s, and counts the number of received messages at the simulation server, taking 30s as a statistical window. And counting the ratio of the number of messages received every 30s to the number of messages sent to the simulation server by the simulation client under the worst network condition for 24 hours, taking the minimum value under the worst network condition as the ratio of the first heartbeat threshold value to the total heartbeat threshold value, and calculating to obtain the first heartbeat threshold value.
The first heartbeat threshold value and the second heartbeat threshold value are adjusted according to the actual network environment, and the first heartbeat threshold value can be properly adjusted to be higher if the network environment is stable, and the first heartbeat threshold value can be properly adjusted to be lower if the network environment is unstable.
In the implementation process, the first heartbeat threshold value and the second heartbeat threshold value are adjusted according to the actual network environment, the proper heartbeat threshold value is determined, the availability of a server self-protection mechanism is improved, and therefore the stability of the server is improved.
Optionally, in this embodiment of the present application, the second heartbeat threshold is smaller than a total heartbeat threshold, where the total heartbeat threshold is a threshold of a sum of heartbeat data sent by all nodes in a time period.
The implementation manner of the above steps is as follows: if each node in the system sends heartbeat data to the server every 30 seconds, the time period for the Eureka server to scan the heartbeat data can be one minute, all the nodes send heartbeat data within one minute, and the total heartbeat threshold is 80 heartbeats.
Optionally, in this embodiment of the present application, changing a state of a node that does not receive heartbeat data within a first time period to be confirmed includes: acquiring a node identifier, wherein the node identifier is stored in a Key-Value database in a Key form; searching a node identifier and a value corresponding to a Key in a database; and changing the value corresponding to the Key into a state to be confirmed.
In the implementation process, state information of the nodes is recorded and changed in a memory of the Eureka server, and node identifiers are acquired and stored in a Key-Value database in a Key form; searching a node identifier and a value corresponding to a Key in a database; and changing the value corresponding to the Key into a state to be confirmed. The step of recording and modifying the node state information may also have a second implementation, for example, creating a table in the memory of the Eureka server to record the data dictionary type, and the data dictionary type table records the state of the node.
Please refer to fig. 3 for a schematic structural diagram of a Eureka server protection apparatus provided in an embodiment of the present application; the embodiment of the present application provides an Eureka server protection apparatus 200, including:
the scanning module 210 is configured to scan heartbeat data sent by all nodes in a time period to obtain total heartbeat data, where the total heartbeat data is a sum of the scanned heartbeat data.
The first processing module 220 is configured to change a node state where the heartbeat data is not received in the first time period to be confirmed if it is determined that the total heartbeat data is greater than the first heartbeat threshold and smaller than the second heartbeat threshold in the first time period, where the first heartbeat threshold is smaller than the second heartbeat threshold.
The second processing module 230 is configured to, if it is determined that the total heartbeat data is greater than the first heartbeat threshold value in a second time period, change the state of the node to be confirmed that the heartbeat data is not received yet in the second time period to be offline, where the second time period is later than the first time period.
Optionally, in this embodiment of the application, the server protection device further includes: and the third processing module is used for inquiring whether the node to be confirmed exists or not if the total heartbeat data is not greater than the first heartbeat threshold value, and changing the state of the node to be confirmed to be on-line if the total heartbeat data exists.
Optionally, in this embodiment of the application, the server protection device further includes: and the fourth processing module is used for changing the node state which does not receive the heartbeat data into an offline state if the total heartbeat data is not less than the second heartbeat threshold value.
Optionally, in this embodiment of the application, the server protection device further includes: and the adjusting threshold module is used for adjusting the first heartbeat threshold and the second heartbeat threshold according to the actual network environment.
Optionally, in this embodiment of the application, the second heartbeat threshold is smaller than the total heartbeat threshold, where the total heartbeat threshold is a threshold of a sum of heartbeat data sent by all nodes in a time period.
Optionally, in this embodiment of the application, the server protection device further includes: a state changing module, configured to change a state of a node that does not receive heartbeat data within a first time period to be confirmed, including: acquiring a node identifier, wherein the node identifier is stored in a Key-Value database in a Key form; searching a node identifier and a value corresponding to a Key in a database; and changing the value corresponding to the Key into a state to be confirmed.
It should be understood that the apparatus corresponds to the above-mentioned embodiment of the image recognition and analysis method, and can perform the steps related to the above-mentioned embodiment of the method, and the specific functions of the apparatus can be referred to the above description, and the detailed description is appropriately omitted here to avoid redundancy. The device includes at least one software function that can be stored in memory in the form of software or firmware (firmware) or solidified in the Operating System (OS) of the device.
Please refer to fig. 4 for a schematic structural diagram of an electronic device according to an embodiment of the present application.
An electronic device 300 provided in an embodiment of the present application includes: a processor 310 and a memory 320, the memory 320 storing machine readable instructions executable by the processor 310, the machine readable instructions when executed by the processor 310 performing the method as above.
The embodiment of the application also provides a storage medium, wherein the storage medium is stored with a computer program, and the computer program is executed by a processor to execute the method.
The storage medium may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as a Static Random Access Memory (SRAM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Programmable Read-Only Memory (PROM), a Read-Only Memory (ROM), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The above description is only an alternative embodiment of the embodiments of the present application, but the scope of the embodiments of the present application is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present application, and all the changes or substitutions should be covered by the scope of the embodiments of the present application.

Claims (6)

1. A server protection method, comprising:
scanning heartbeat data sent by all nodes in a time period to obtain total heartbeat data, wherein the total heartbeat data is the sum of the scanned heartbeat data;
if the total heartbeat data is determined to be larger than a first heartbeat threshold value and smaller than a second heartbeat threshold value in a first time period, changing the node state of the heartbeat data which is not received in the first time period into a state to be confirmed, wherein the first heartbeat threshold value is smaller than the second heartbeat threshold value;
if the total heartbeat data is determined to be greater than the first heartbeat threshold value in a second time period, changing the state of the node to be confirmed which still does not receive the heartbeat data in the second time period to be offline, wherein the second time period is later than the first time period;
if the total heartbeat data is not larger than the first heartbeat threshold value, inquiring whether the node to be confirmed exists, and if so, changing the state of the node to be confirmed to be on-line;
if the total heartbeat data is not less than the second heartbeat threshold value, changing the node state which does not receive the heartbeat data into an offline state;
the second heartbeat threshold value is smaller than a total heartbeat threshold value, and the total heartbeat threshold value is a threshold value of the sum of heartbeat data sent by all nodes in a time period.
2. The method of claim 1, wherein before scanning the heartbeat data sent by all nodes in the time period to obtain the total heartbeat data, the method further comprises:
and adjusting the first heartbeat threshold value and the second heartbeat threshold value according to the actual network environment.
3. The method of claim 1, wherein changing the state of the node that has not received the heartbeat data in the first time period to be acknowledged comprises:
acquiring a node identifier, wherein the node identifier is stored in a Key-Value database in a Key form;
searching the node identification and the value corresponding to the Key in the database;
and changing the value corresponding to the Key into a state to be confirmed.
4. A server protection device, comprising:
the scanning module is used for scanning heartbeat data sent by all nodes in a time period to obtain total heartbeat data, and the total heartbeat data is the sum of the scanned heartbeat data;
a first processing module, configured to change, if it is determined in a first time period that the total heartbeat data is greater than a first heartbeat threshold and smaller than a second heartbeat threshold, a node state where the heartbeat data is not received in the first time period to be confirmed, where the first heartbeat threshold is smaller than the second heartbeat threshold;
a second processing module, configured to change a state of the node to be confirmed that the heartbeat data is not received in a second time period to an offline state if it is determined that the total heartbeat data is greater than the first heartbeat threshold value in the second time period, where the second time period is later than the first time period;
a third processing module, configured to query whether there is a node to be confirmed if the total heartbeat data is not greater than the first heartbeat threshold value, and if so, change the state of the node to be confirmed to be online;
the fourth processing module is configured to change the node state that does not receive the heartbeat data to be offline if the total heartbeat data is not less than the second heartbeat threshold value;
the second heartbeat threshold value is smaller than a total heartbeat threshold value, and the total heartbeat threshold value is a threshold value of the sum of heartbeat data sent by all nodes in a time period.
5. An electronic device, comprising: a processor and a memory, the memory storing machine-readable instructions executable by the processor, the machine-readable instructions, when executed by the processor, performing the method of any of claims 1 to 3.
6. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, performs the method of any one of claims 1 to 3.
CN202111382365.1A 2021-11-22 2021-11-22 Server protection method and device, electronic equipment and storage medium Active CN113821414B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111382365.1A CN113821414B (en) 2021-11-22 2021-11-22 Server protection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111382365.1A CN113821414B (en) 2021-11-22 2021-11-22 Server protection method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113821414A CN113821414A (en) 2021-12-21
CN113821414B true CN113821414B (en) 2022-02-08

Family

ID=78917959

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111382365.1A Active CN113821414B (en) 2021-11-22 2021-11-22 Server protection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113821414B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115333983B (en) * 2022-08-16 2023-10-10 超聚变数字技术有限公司 Heartbeat management method and node

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012174934A1 (en) * 2011-06-21 2012-12-27 中兴通讯股份有限公司 Adaptive method and device for heartbeat period
CN104243293A (en) * 2014-08-21 2014-12-24 深圳市合信自动化技术有限公司 Automatic heartbeat interval adjustment method, gateway device and server
EP3319253A1 (en) * 2016-11-07 2018-05-09 Alcatel Lucent A network server, a mobile user terminal, and a method of controlling a characteristic of data to be sent
CN109857344A (en) * 2019-01-30 2019-06-07 平安科技(深圳)有限公司 Heart beat status judgment method, device and computer equipment based on shared drive
CN112804202A (en) * 2020-12-30 2021-05-14 平安证券股份有限公司 Multi-internetwork data security interaction method and device, server and storage medium
CN113190546A (en) * 2021-05-26 2021-07-30 成都新希望金融信息有限公司 Eureka service control method, system and readable storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107483280B (en) * 2016-06-07 2021-03-09 阿里巴巴集团控股有限公司 Method and device for monitoring service node device
US11076009B2 (en) * 2018-04-23 2021-07-27 Microsoft Technology Licensing, Llc Anti-jitter mechanism for monitoring online availability
CN112291099B (en) * 2020-11-02 2022-07-29 西南电子技术研究所(中国电子科技集团公司第十研究所) Multi-mode registration center architecture switching method under mobile environment
CN113612624B (en) * 2021-06-29 2023-01-06 济南浪潮数据技术有限公司 Method and device for processing heartbeat between nodes
CN113472606B (en) * 2021-06-29 2022-09-30 聚好看科技股份有限公司 Heartbeat overtime detection method, server and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012174934A1 (en) * 2011-06-21 2012-12-27 中兴通讯股份有限公司 Adaptive method and device for heartbeat period
CN104243293A (en) * 2014-08-21 2014-12-24 深圳市合信自动化技术有限公司 Automatic heartbeat interval adjustment method, gateway device and server
EP3319253A1 (en) * 2016-11-07 2018-05-09 Alcatel Lucent A network server, a mobile user terminal, and a method of controlling a characteristic of data to be sent
CN109857344A (en) * 2019-01-30 2019-06-07 平安科技(深圳)有限公司 Heart beat status judgment method, device and computer equipment based on shared drive
CN112804202A (en) * 2020-12-30 2021-05-14 平安证券股份有限公司 Multi-internetwork data security interaction method and device, server and storage medium
CN113190546A (en) * 2021-05-26 2021-07-30 成都新希望金融信息有限公司 Eureka service control method, system and readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于微服务架构的业务系统设计与实现;洪华军 等;《计算机与数字工程》;20180120;第46卷(第01期);149-154 *

Also Published As

Publication number Publication date
CN113821414A (en) 2021-12-21

Similar Documents

Publication Publication Date Title
CN112506702B (en) Disaster recovery method, device, equipment and storage medium for data center
US20210320977A1 (en) Method and apparatus for implementing data consistency, server, and terminal
CN109684155B (en) Monitoring configuration method, device, equipment and readable storage medium
US9430221B2 (en) Device and method for updating firmware of a rackmount server system
CN110083515B (en) Method and device for quickly judging slow disk in distributed storage system and storage medium
CN113821414B (en) Server protection method and device, electronic equipment and storage medium
CN112463318B (en) Timing task processing method, device and system
CN111274205B (en) Data block access method and device and storage medium
CN111901176A (en) Fault determination method, device, equipment and storage medium
CN108509296B (en) Method and system for processing equipment fault
CN104158843B (en) The storage-unit-failure detection method and device of distributed file storage system
CN116737444A (en) Database server fault processing method and system
CN114422576B (en) Session cleaning method and device, computer equipment and readable storage medium
CN111092956A (en) Resource synchronization method, device, storage medium and equipment
CN113055203A (en) Method and device for recovering abnormity of SDN control plane
US8230444B2 (en) Global attribute uniqueness (GAU) using an ordered message service (OMS)
CN113688021B (en) Load balancing service processing method, device, equipment and readable storage medium
CN113112023B (en) Inference service management method and device of AIStation inference platform
CN110392104B (en) Data synchronization method, system, server and storage medium
CN113568781A (en) Database error processing method and device and database cluster access system
CN111984844A (en) Method and system for automatically supplementing graph based on big data
CN111224841B (en) Operation and maintenance method and system for government affair cloud platform website application
CN106375354B (en) Data processing method and device
CN117851244B (en) Database fault detection method and device, electronic equipment and storage medium
CN112532525B (en) Processing method, device and system for equipment recovery service

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