Server detection method and device, storage medium and electronic equipment
By delegating the initiation and determination rights of health detection to the backend server in the server cluster, and using the target proxy server for status detection request and response processing, the problem of misjudgment of health status caused by the tight coupling between the proxy and the backend server configuration level is solved, and a more efficient and accurate server cluster health detection is achieved.
Patent Information
- Application Number
- CN202411775617.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-04
AI Technical Summary
现有服务器健康检测机制由于代理端与后端服务器配置层面的紧密耦合,导致健康状态误判问题,影响服务器集群的稳定性和可靠性。
The target server sends a status detection request to the reference server through the target proxy server at the first moment. If the reference status information is not received at the second moment, it is determined that the reference server is in an abnormal state; if the status information is received, the status identification information is obtained and matched with the target status identification information, and the operating status of the reference server is determined.
A more loosely coupled, efficient and accurate server cluster health detection mechanism is implemented, which significantly improves the stability and disaster recovery capabilities of the server cluster, and reduces configuration complexity and proxy server replacement costs.
Smart Images

Figure CN119652726A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a server detection method and device, a storage medium, and an electronic device. Background Art
[0002] In the high-availability architecture of server clusters, traditional server health detection mechanisms often rely on the agent to send probe requests to the backend server to evaluate the server's operating status. This approach requires the backend server to design and expose a dedicated port path to receive and respond to the agent's health check signal. The agent periodically sends requests to these paths, collects response information, and determines the server's health status based on preset policies. However, the implementation of this mechanism intensifies the coupling between the agent and the backend server, especially at the configuration level. Any inconsistency in configuration may lead to incorrect judgment of the health status, thereby affecting the stability and reliability of the entire cluster.
[0003] In other words, when using the server detection method provided in the relevant technology, there is still a technical problem of misjudgment of health status due to inconsistent configuration due to the tight coupling between the proxy and the backend server configuration level, thus affecting the stability of the server cluster.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a server detection method and device, a storage medium and an electronic device to at least solve the technical problem that the stability of the server cluster is affected by the close coupling between the proxy terminal and the back-end server configuration level.
[0006] According to one aspect of an embodiment of the present application, a server detection method is provided, including: a target server sends a target status detection request to a reference server through a target proxy server at a first moment, wherein the status detection message is used to obtain status information of the reference server, the target server and the reference server both belong to a target server cluster, and the target proxy server is a proxy server configured for the target server cluster; when the target server has not received reference status information returned by the reference server through the target proxy server at a second moment, determining that the reference server is in an abnormal state, wherein the second moment is later than the first moment, and the time interval between the second moment and the first moment is greater than a target interval; when the target server receives reference status information returned by the reference server through the target proxy server before the second moment, obtaining status identification information carried in the reference status information; when the status identification information matches the target status identification information, determining that the reference server is in a normal operating state; when the status identification information does not match the target status identification information, determining that the reference server is in an abnormal state.
[0007] According to another aspect of an embodiment of the present application, a server detection device is also provided, including: a sending unit, used to send a target status detection request to a reference server through a target proxy server at a first moment, wherein the status detection message is used to obtain status information of the reference server, and the target server and the reference server receiving the status detection message both belong to a target server cluster, and the target proxy server is a proxy server configured for the target server cluster; a first determination unit, used to determine that the reference server is in an abnormal state if the reference status information returned by the reference server has not been received through the target proxy server at a second moment, wherein the second moment is later than the first moment, and the time interval between the second moment and the first moment is greater than the target interval; a second determination unit, used to obtain status identification information carried in the reference status information if the target server receives the reference status information returned by the reference server through the target proxy server before the second moment; if the status identification information matches the target status identification information, determine that the reference server is in a normal operating state; if the status identification information does not match the target status identification information, determine that the reference server is in an abnormal state.
[0008] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned server detection method when running.
[0009] According to another aspect of the embodiment of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device performs the detection method of the server as above.
[0010] According to another aspect of the embodiments of the present application, there is further provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the server detection method through the computer program.
[0011] In an embodiment of the present application, the target server sends a target status detection request to the reference server through the target proxy server at a first moment, wherein the status detection message is used to obtain the status information of the reference server, the target server and the reference server both belong to the target server cluster, and the target proxy server is a proxy server configured for the target server cluster; when the target server has not received the reference status information returned by the reference server through the target proxy server at the second moment, it is determined that the reference server is in an abnormal state, wherein the second moment is later than the first moment, and the time interval between the second moment and the first moment is greater than the target interval; when the target server receives the reference status information returned by the reference server through the target proxy server before the second moment, the status identification information carried in the reference status information is obtained; when the status identification information matches the target status identification information, it is determined that the reference server is in a normal operating state; when the status identification information does not match the target status identification information, it is determined that the reference server is in an abnormal state. In other words, by adopting the embodiment of the present application, by delegating the initiation right and judgment right of health detection to the back-end server, a more loosely coupled, efficient and accurate server cluster health detection mechanism is realized, which significantly improves the stability and disaster recovery capability of the entire server cluster, and reduces the configuration complexity and the replacement cost of the proxy server. The invention solves the technical problem that in the server detection method provided in the related technology, due to the close coupling between the proxy and the back-end server configuration level, the health status is misjudged due to inconsistent configuration, thus affecting the stability of the server cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0013] Figure 1 is a flow chart of an optional server detection method according to an embodiment of the present application;
[0014] Figure 2 is a schematic diagram of an optional server detection method according to an embodiment of the present application;
[0015] Figure 3 is a schematic diagram of an optional server detection method according to an embodiment of the present application;
[0016] Figure 4 is a schematic diagram of an optional server detection method according to an embodiment of the present application;
[0017] Figure 5 is a schematic structural diagram of an optional server detection device according to an embodiment of the present application;
[0018] Figure 6 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0019] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0020] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0021] Alternatively, as an alternative, Figure 1 As shown, the detection method of the above server includes:
[0022] S102, the target server sends a target status detection request to the reference server through the target proxy server at the first moment, wherein the status detection message is used to obtain status information of the reference server, the target server and the reference server both belong to the target server cluster, and the target proxy server is a proxy server configured for the target server cluster.
[0023] Optionally, in some embodiments, the above-mentioned server detection method can be but is not limited to being applied to the application scenario of the server detection method mainly in a distributed server cluster environment, especially in a server cluster under a cloud platform, a data center or a high-availability architecture, to ensure the health status of the server and the stable operation of the cluster.
[0024] It should be noted that, in some embodiments, the target server may be, but is not limited to, a server for indicating health status detection, which has a built-in target server detection module responsible for sending status detection requests to other servers in the cluster. In addition, the target server detection module may also be used to receive status detection requests sent by other servers in the target server cluster. The reference server may be, but is not limited to, one of the other servers in the target server cluster that is used to indicate the status of the target server being detected.
[0025] Furthermore, the target proxy server may be, but is not limited to, a proxy server used to indicate the target server cluster, which is responsible for forwarding traffic and relaying health check requests. In this embodiment, the target proxy server forwards the target status detection request through a normal business traffic forwarding channel, without the need to create a dedicated health detection channel.
[0026] It should be noted that the target server can, but is not limited to, periodically perform health checks on the reference server according to the target period, and correspondingly, other servers in the target server cluster also periodically perform health checks on the target server. In other words, in some embodiments, any server in the target server cluster can periodically perform health checks on other servers in the target server cluster, and can also be subjected to health checks by other servers in the target server cluster, which is not limited in this embodiment.
[0027] For example, Figure 2 As shown, the target proxy server 202 can send and receive health detection messages to the target server detection module 204-1 configured in the target server 204 through the business traffic forwarding channel. At the same time, the business interface 204-2 of the target server 204 will also send and receive business traffic through the target proxy server through the business traffic forwarding channel.
[0028] S104, determining that the reference server is in an abnormal state when the target server has not received the reference status information returned by the reference server through the target proxy server at a second moment, wherein the second moment is later than the first moment, and the time interval between the second moment and the first moment is greater than the target interval.
[0029] It should be noted that the above-mentioned target status detection request can be, but is not limited to, a request for indicating that the target server sends a request to the reference server through the target proxy server to obtain its status information, such as an HTTP request. The above-mentioned reference status information is status information returned to the target server after the reference server receives the target status detection request, which is used to characterize its current operating status. The above-mentioned status identification information is a specific identification carried in the reference status information, such as an HTTP status code, which is used to determine whether the reference server is operating normally.
[0030] S106, when the target server receives the reference status information returned by the reference server through the target proxy server before the second moment, obtains the status identification information carried in the reference status information; when the status identification information matches the target status identification information, determines that the reference server is in a normal operating state; when the status identification information does not match the target status identification information, determines that the reference server is in an abnormal state.
[0031] It should be noted that, when the status identification information is an HTTP status code, the target status identification information may be a status code indicating that the server is normal, such as status code 200.
[0032] Optionally, the above steps may be explained based on, but not limited to, the following examples:
[0033] Initial configuration: Configure the target server detection module for target server 1, set the IP address of the target proxy server to 10.1.1.1, the fixed path to / health, and set the target interval to 3 seconds.
[0034] Target status detection request sending: At any first moment, the transmitter in the target server detection module of target server 1 sends an http request to the / health path of 10.1.1.1, and the request includes the identifier of target server 1 and the identifier of target server 2 to be detected.
[0035] Waiting for target interval: After sending the request, target server 1 starts timing and waits for a target interval of 3 seconds to receive a response from target server 2.
[0036] Receive and analyze reference status information: If a response from target server 2 is received within the target interval, the determiner in the target server detection module analyzes the status information in the response. For example, if the HTTP status code is 200, it indicates that target server 2 is in normal operation; if it is not 200, it is determined to be an abnormal state.
[0037] Processing of not receiving reference status information: If no response is received from the target server 2 after the target interval ends, the determiner in the target server detection module directly marks the status of the target server 2 as abnormal and triggers the disaster recovery process.
[0038] It should be noted that the above example is an optional example provided to facilitate explanation of the above steps, and there is no limitation on the detection method of the above server.
[0039] In an embodiment of the present application, the target server sends a target status detection request to the reference server through the target proxy server at a first moment, wherein the status detection message is used to obtain the status information of the reference server, the target server and the reference server both belong to the target server cluster, and the target proxy server is a proxy server configured for the target server cluster; when the target server has not received the reference status information returned by the reference server through the target proxy server at the second moment, it is determined that the reference server is in an abnormal state, wherein the second moment is later than the first moment, and the time interval between the second moment and the first moment is greater than the target interval; when the target server receives the reference status information returned by the reference server through the target proxy server before the second moment, the status identification information carried in the reference status information is obtained; when the status identification information matches the target status identification information, it is determined that the reference server is in a normal operating state; when the status identification information does not match the target status identification information, it is determined that the reference server is in an abnormal state. In other words, by adopting the embodiment of the present application, by delegating the initiation right and judgment right of health detection to the back-end server, a more loosely coupled, efficient and accurate server cluster health detection mechanism is realized, which significantly improves the stability and disaster recovery capability of the entire server cluster, and reduces the configuration complexity and the replacement cost of the proxy server. The invention solves the technical problem that in the server detection method provided in the related technology, due to the close coupling between the proxy and the back-end server configuration level, the health status misjudgment problem caused by inconsistent configurations affects the stability of the server cluster.
[0040] Optionally, as an optional solution, the target server sending a target status detection request to the reference server through the target proxy server at the first moment includes:
[0041] The target server detection module configured in the target server sends a target status detection request to the reference server detection module configured in the reference server through the target proxy server at the first moment, wherein the target status detection request carries the reference network address of the reference server detection module and the port identifier of the detection port configured for the reference server detection module.
[0042] It should be noted that the above-mentioned target server detection module is a built-in software module on the target server, which is responsible for periodically sending health check requests to other servers in the target server cluster, receiving and processing the health status responses of other servers, and performing status judgment and disaster recovery processing based on the received health status information.
[0043] Correspondingly, the above-mentioned reference server detection module is a software module built into the reference server, which is responsible for periodically sending health check requests to other servers in the target server cluster, receiving and processing health status responses from other servers, and performing status judgment and disaster recovery processing based on the received health status information.
[0044] Optionally, the server health detection program (including the above-mentioned target server detection module and reference server detection module) can be but is not limited to the following: Figure 3 As shown, including:
[0045] The transmitter 302 is used to send a detection request, for example, to send an http request to a fixed path of an IP address at a fixed frequency, and pass the corresponding status code and the corresponding address in the request result to the determiner. The fixed frequency does not need to be configured and can be set internally, for example, 2 times per second; a certain IP needs to be configured as the IP address of the proxy. No matter what kind of proxy implementation method is used, it has IP attributes, so there is no binding for this configuration, and the proxy can be changed at any time; the fixed path is built-in as the path of the receiver.
[0046] The receiver 304 is used to receive a health status response, for example, provide a web interface, receive an http request, and return the local IP as a result to the other party.
[0047] The determiner 306 is used to determine the health status, for example, receiving the IP and status information transmitted by the transmitter, and marking the IP as online or offline according to the built-in determination rules. For example, if no response from a certain IP is received for 3 consecutive seconds, it is marked as offline; if a normal response is received once, it is marked as online.
[0048] The state maintainer 308 is used to store the IP addresses and health status of all backend nodes. It is essentially a memory space that maintains the determination results of the determiner.
[0049] The disaster recovery processor 310 is used to execute the disaster recovery strategy when the backend node is abnormal. For example, it subscribes to the health status change event in the status maintainer to trigger the execution of different actions. This part can be customized by the user according to his own business. The disaster recovery execution form includes but is not limited to scripts, webhooks, etc.
[0050] Optionally, the above steps may be explained by, but not limited to, the following examples:
[0051] S1, Environment Configuration Environment: A target server cluster under a cloud platform, including target server 1, target server 2 to target server N, and a target proxy server (such as a load balancer). The IP address of the target proxy server is 10.1.1.a, and the IP address of target server 1 is 10.1.1.b. Assume that target server 1 needs to detect the health status of target server 2, the IP address of target server 2 is 10.1.1.c, and the detection port is 8080.
[0052] S2, target status detection request sending request time: the first moment is set to the current time, such as 2023-04-0110:00:00. Transmitter: The transmitter module on the target server 1 starts working, and it sends a target status detection request to the detection port 8080 of the target server 2 through the target proxy server 10.1.1.a. Request content: The target status detection request contains a specific HTTP request, such as a GET request to the / health path, and carries the target server 1 identifier and the reference network address of the target server 2 (IP: 10.1.1.c) and the detection port identifier (port: 8080) in the request header.
[0053] S3, after receiving the target status detection request, the target proxy server 10.1.1.a forwards the request to the detection port 8080 of the target server 2 based on its built-in forwarding rules. The receiver module of the target server 2 receives and processes the request, and then returns an HTTP response on the / health path through the transmitter module, which contains status identification information, such as HTTP status code 200 for normal operation, or 500 for internal server error.
[0054] S4, target status information reception and analysis After the receiver module of the target server 1 receives the response forwarded by the target proxy server, it passes the status identification information in the response to the determiner. The determiner determines the health status of the target server 2 based on the built-in determination rules, such as marking it as abnormal if it does not receive a 200 status code response for three consecutive times. Status information maintenance: If the status identification information of the target server 2 indicates that it is in normal operation, the status maintainer will update the health status information of all back-end nodes in the cluster and mark the status of the target server 2 as normal. If the status identification information indicates an abnormality, the status maintainer will mark the status of the target server 2 as abnormal and trigger the disaster recovery strategy of the disaster recovery processor.
[0055] S5, Disaster Recovery Processing Flow The disaster recovery processor subscribes to the health status change event in the state maintainer. Once it detects that the status of the target server 2 is judged to be abnormal, it will execute predefined disaster recovery operations, such as automatically executing the "restart service" script to try to restore the business of the target server 2. Alternatively, if the target server 2 cannot be restored by restarting, the disaster recovery processor may execute more complex disaster recovery strategies, such as redirecting traffic to other healthy servers in the cluster to ensure service continuity and high availability.
[0056] It should be noted that the above example is an optional example provided to facilitate explanation of the above steps, and there is no limitation on the detection method of the above server.
[0057] By adopting the embodiment of the present application, by defining the target server detection module and the reference server detection module, the initiation and response responsibilities of health detection are clearly divided, making the health check mechanism more modular and manageable. At the same time, the reference network address and port identifier carried in the target status detection request ensure the accuracy and pertinence of the request, avoid the problem of mis-sending the request or mismatching the response, and improve the accuracy and efficiency of health detection.
[0058] Optionally, as an optional scheme, when the target server has not received the reference status information returned by the reference server through the target proxy server at the second moment, determining that the reference server is in an abnormal state includes: when the target server detection module has not received the reference status information returned by the reference server detection module through the target proxy server at the second moment, determining that the reference server is in an abnormal state.
[0059] In the case where the target server receives the reference state information returned by the reference server through the target proxy server before the second moment, obtaining the state identification information carried in the reference state information includes: in the case where the target server detection module receives the reference state information returned by the reference server detection module through the target proxy server before the second moment, obtaining the state identification information carried in the reference state information;
[0060] In the case where the state identification information matches the target state identification information, determining that the reference server is in a normal state includes: the target server detection module determines that the reference server is in a normal state in the case where the state identification information matches the target state identification information;
[0061] When the state identification information does not match the target state identification information, determining that the reference server is in an abnormal state includes: when the state identification information does not match the target state identification information, the target server detection module determines that the reference server is in an abnormal state.
[0062] It should be noted that the target server detection module receives the above-mentioned reference status information through a receiver, and uses a determiner to determine the operating status of the reference server.
[0063] By using the embodiment of the present application, health checks are performed through the target server detection module, which can not only accurately identify the abnormal state of the reference server, but also accurately distinguish between normal operation and abnormal state based on the matching of the state identification information. This enables the disaster recovery processor to make disaster recovery decisions more quickly and accurately, such as automatically isolating abnormal servers, reallocating traffic, etc., thereby further enhancing the stability and disaster recovery capabilities of the server cluster.
[0064] Optionally, as an optional solution, after determining that the reference server is in an abnormal state, the method further includes:
[0065] The abnormal prompt information is reported to a cluster maintenance system for maintaining the target server cluster through the target server detection module, wherein the abnormal prompt information is used to prompt the reference server storage failure.
[0066] It should be noted that, in some embodiments, the target server detection module may, but is not limited to, report the above-mentioned abnormal prompt information through the disaster recovery processor. The above-mentioned cluster maintenance system may, but is not limited to, be responsible for detecting and managing the operating status of the entire target server cluster, including but not limited to functions such as fault detection, resource allocation, and cluster configuration management. It is usually an important tool for cluster operation and maintenance, and can receive health status reports and abnormal information from each server in the cluster.
[0067] Furthermore, when the target server detects that the reference server is in an abnormal state, the target server detection module generates and sends a prompt message. The prompt message may include, but is not limited to, the reference server identifier (such as IP address), a description of the abnormal state (such as storage failure), and possible abnormal timestamps and other detailed information, which are used by the cluster maintenance system to further locate and handle problems, and are not limited to this in this embodiment.
[0068] By adopting the embodiment of the present application, after the target server detection module determines that the reference server is in an abnormal state, the operation and maintenance personnel or the monitoring system can be notified in time by reporting the abnormal prompt information to the cluster maintenance system, so as to quickly locate and handle the fault, reduce the impact scope and duration of the fault, and improve the management and maintenance efficiency of the cluster.
[0069] Optionally, as an optional solution, the detection method of the server further includes:
[0070] A target server detection module is configured for the target server, wherein the target server detection module is used to send a status detection message to servers other than the target server in the target server cluster to detect the operating status of the servers other than the target server in the target server cluster, and the target server detection module is also used to receive a status detection request sent by the servers other than the target server in the target server cluster;
[0071] Configure the network address and detection port for the target server detection module.
[0072] It should be noted that, in this embodiment, the above network address configuration is a network address required by the target server detection module, usually an IP address, for receiving status detection requests sent by other servers. The module may also need to know the network addresses of other servers in order to actively send health check requests. The above detection port is a specific port number, the target server detection module listens for status detection requests on this port, and other servers send status detection requests to the target server through this port. The detection port ensures the distinction between health check requests and other service requests, avoiding unnecessary interference.
[0073] By adopting the embodiment of the present application, the target server detection module and its network address and detection port are configured for the target server, which not only simplifies the configuration process of health detection, but also improves the flexibility and scalability of the configuration, making it more convenient to add or replace servers in the server cluster, while also reducing the risk of misjudgment of health detection caused by configuration errors.
[0074] Optionally, as an optional solution, the detection method of the server further includes:
[0075] When the target server receives a reference status detection request sent by the reference server through the target proxy server, target status information for responding to the reference status detection request is sent to the reference server through the target proxy server, wherein the target status information is used to characterize the operating status of the target server. When the reference server receives the target status information, the operating status of the target server is determined based on the target status information.
[0076] Optionally, in some embodiments, the reference status detection request is used to indicate a request sent by the reference server to the target server, the purpose of which is to obtain the operating status information of the target server. The target status information may be, but is not limited to, information returned when indicating the target server responding to the reference status detection request, used to characterize its own operating status, and may include information such as an HTTP identification code, which is not limited in this embodiment.
[0077] By adopting the embodiment of the present application, the target server is able to respond to the detection request of the reference server, that is, the target server can send the target status information reflecting its own running status to the reference server through the target proxy server. This two-way health check mechanism not only strengthens the health status synchronization between servers in the cluster, but also provides more detailed health status information, which helps the disaster recovery processor to make more accurate decisions and further improves the disaster recovery management capability of the cluster.
[0078] Optionally, as an optional example, it can be but not limited to based on Figure 4 The following example is used to illustrate the detection method of the above server:
[0079] like Figure 4 As shown, the proxy server of the target server cluster is proxy server A, and the target server cluster includes N servers, including server 1, server 2 to server N; server 1, server 2 to server N are all configured with service ports and server health detection programs (used to represent server detection modules); server 1, server 2 to server N all use their own configured service interfaces to send and receive service traffic sent and received through the forwarding channel of proxy server A, and server 1, server 2 to server N all use their own configured server health detection programs to send and receive health detection messages sent and received through the forwarding channel of proxy server A.
[0080] It should be noted that the above example is an optional example provided to facilitate explanation of the above steps, and there is no limitation on the detection method of the above server.
[0081] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0082] According to another aspect of the embodiment of the present application, a server detection device for implementing the above-mentioned server detection method is also provided. Figure 5 As shown, the device comprises:
[0083] A sending unit 502 is configured to send a target status detection request to a reference server through a target proxy server at a first moment, wherein the status detection message is used to obtain status information of the reference server, the target server receiving the status detection message and the reference server both belong to a target server cluster, and the target proxy server is a proxy server configured for the target server cluster;
[0084] A first determining unit 504 is configured to determine that the reference server is in an abnormal state if the reference state information returned by the reference server has not been received through the target proxy server at a second time, wherein the second time is later than the first time, and the time interval between the second time and the first time is greater than the target interval;
[0085] The second determination unit 506 is used to obtain the status identification information carried in the reference status information when the target server receives the reference status information returned by the reference server through the target proxy server before the second moment; when the status identification information matches the target status identification information, determine that the reference server is in a normal operating state; when the status identification information does not match the target status identification information, determine that the reference server is in an abnormal state.
[0086] Optionally, in some embodiments, the above-mentioned sending unit includes: a sending module, which is used for the target server detection module configured in the target server to send a target status detection request to the reference server detection module configured in the reference server through the target proxy server at the first moment, wherein the target status detection request carries the reference network address of the reference server detection module and the port identifier of the detection port configured for the reference server detection module.
[0087] Optionally, in some embodiments, the first determination unit includes: a first determination module, used to determine that the reference server is in an abnormal state when the reference status information returned by the reference server detection module has not been received through the target proxy server at the second moment; the second determination unit includes: a first acquisition module, used to acquire the status identification information carried in the reference status information when the target server detection module receives the reference status information returned by the reference server detection module through the target proxy server before the second moment; the second determination unit also includes: a second determination module, used to determine that the reference server is in a normal state when the status identification information matches the target status identification information; the second determination unit also includes: a third determination module, used to determine that the reference server is in an abnormal state when the status identification information does not match the target status identification information.
[0088] Optionally, in some embodiments, the above-mentioned device further includes: an abnormal message reporting unit, used to report abnormal prompt information to a cluster maintenance system used to maintain the target server cluster through the target server detection module, wherein the abnormal prompt information is used to prompt a reference server storage failure.
[0089] Optionally, in some embodiments, the above-mentioned device also includes: a first configuration unit, used to configure a target server detection module for the target server, wherein the target server detection module is used to send status detection messages to servers other than the target server in the target server cluster to detect the operating status of servers other than the target server in the target server cluster, and the target server detection module is also used to receive status detection requests sent by servers other than the target server in the target server cluster; a second configuration unit, used to configure the network address and detection port for the target server detection module.
[0090] Optionally, in some embodiments, the above-mentioned device also includes: a receiving unit, which is used to send target status information for responding to the reference status detection request to the reference server through the target proxy server when the target server receives the reference status detection request sent by the reference server through the target proxy server, wherein the target status information is used to characterize the operating status of the target server, and when the reference server receives the target status information, it will determine the operating status of the target server based on the target status information.
[0091] For a specific embodiment, reference may be made to the example shown in the above-mentioned server detection method, and this embodiment will not be described in detail here.
[0092] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned server detection method is also provided. This embodiment is described by taking the electronic device as an example of a server. Figure 6As shown, the electronic device includes a memory 602 and a processor 604. The memory 602 stores a computer program, and the processor 604 is configured to execute the steps in any of the above method embodiments through the computer program.
[0093] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0094] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0095] S1, the target server sends a target status detection request to the reference server through the target proxy server at the first moment, wherein the status detection message is used to obtain the status information of the reference server, the target server and the reference server both belong to the target server cluster, and the target proxy server is a proxy server configured for the target server cluster;
[0096] S2, determining that the reference server is in an abnormal state when the target server has not received the reference state information returned by the reference server through the target proxy server at a second time, wherein the second time is later than the first time, and the time interval between the second time and the first time is greater than the target interval;
[0097] S3, when the target server receives the reference status information returned by the reference server through the target proxy server before the second moment, obtains the status identification information carried in the reference status information; when the status identification information matches the target status identification information, determines that the reference server is in a normal operating state; when the status identification information does not match the target status identification information, determines that the reference server is in an abnormal state.
[0098] Alternatively, a person skilled in the art may understand that: Figure 6 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Figure 6 The structure of the electronic device is not limited. Figure 6 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 6 Different configurations are shown.
[0099] Among them, the memory 602 can be used to store software programs and modules, such as the program instructions / modules corresponding to the server detection method and device in the embodiments of the present application. The processor 604 executes various functional applications and data processing by running the software programs and modules stored in the memory 602, that is, realizing the above-mentioned server detection method. The memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 602 may further include a memory remotely located relative to the processor 604, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. As an example, Figure 6 As shown, the memory 602 may include but is not limited to the sending unit 502, the first determining unit 504 and the second determining unit 506 in the detection device of the server. In addition, other module units in the detection device of the server may also be included but are not limited to, which will not be repeated in this example.
[0100] Optionally, the transmission device 606 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 606 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 606 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0101] In addition, the electronic device further includes: a display 608 and a connection bus 610 for connecting various module components in the electronic device.
[0102] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. The nodes may form a point-to-point network, and any form of computing device, such as a server, terminal or other electronic device, may become a node in the blockchain system by joining the point-to-point network.
[0103] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the above method. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions provided by the embodiments of the present application are executed.
[0104] According to one aspect of the present application, another computer program product is also provided, including a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps of the method in each embodiment of the present application are implemented.
[0105] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above method.
[0106] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0107] S1, the target server sends a target status detection request to the reference server through the target proxy server at the first moment, wherein the status detection message is used to obtain the status information of the reference server, the target server and the reference server both belong to the target server cluster, and the target proxy server is a proxy server configured for the target server cluster;
[0108] S2, determining that the reference server is in an abnormal state when the target server has not received the reference state information returned by the reference server through the target proxy server at a second time, wherein the second time is later than the first time, and the time interval between the second time and the first time is greater than the target interval;
[0109] S3, when the target server receives the reference status information returned by the reference server through the target proxy server before the second moment, obtains the status identification information carried in the reference status information; when the status identification information matches the target status identification information, determines that the reference server is in a normal operating state; when the status identification information does not match the target status identification information, determines that the reference server is in an abnormal state.
[0110] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0111] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
[0112] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0113] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0114] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0115] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0116] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A server detection method, characterized in that: include: The target server sends a target status detection request to the reference server through the target proxy server at a first moment, wherein the status detection message is used to obtain status information of the reference server, the target server and the reference server both belong to a target server cluster, and the target proxy server is a proxy server configured for the target server cluster; determining that the reference server is in an abnormal state when the target server has not received the reference state information returned by the reference server through the target proxy server at a second time, wherein the second time is later than the first time, and the time interval between the second time and the first time is greater than a target interval; When the target server receives the reference status information returned by the reference server through the target proxy server before the second moment, the status identification information carried in the reference status information is obtained; when the status identification information matches the target status identification information, it is determined that the reference server is in a normal operating state; when the status identification information does not match the target status identification information, it is determined that the reference server is in an abnormal state.
2. The method according to claim 1, characterized in that The target server sending a target status detection request to the reference server through the target proxy server at the first moment includes: The target server detection module configured in the target server sends the target status detection request to the reference server detection module configured in the reference server through the target proxy server at the first moment, wherein the target status detection request carries the reference network address of the reference server detection module and the port identifier of the detection port configured for the reference server detection module.
3. The method according to claim 2, characterized in that The step of determining that the reference server is in an abnormal state when the target server has not received the reference state information returned by the reference server through the target proxy server at the second moment comprises: determining that the reference server is in an abnormal state when the target server detection module has not received the reference state information returned by the reference server detection module through the target proxy server at the second moment; In a case where the target server receives the reference state information returned by the reference server through the target proxy server before the second moment, acquiring the state identification information carried in the reference state information includes: in a case where the target server detection module receives the reference state information returned by the reference server detection module through the target proxy server before the second moment, acquiring the state identification information carried in the reference state information; The determining that the reference server is in a normal state when the state identification information matches the target state identification information comprises: the target server detection module determining that the reference server is in a normal state when the state identification information matches the target state identification information; The determining that the reference server is in an abnormal state when the state identification information does not match the target state identification information includes: the target server detection module determining that the reference server is in an abnormal state when the state identification information does not match the target state identification information.
4. The method according to claim 2, characterized in that: After determining that the reference server is in an abnormal state, the method further includes: The target server detection module reports abnormal prompt information to a cluster maintenance system for maintaining the target server cluster, wherein the abnormal prompt information is used to prompt the reference server storage failure.
5. The method according to any one of claims 1 to 4, characterized in that: Before the target server sends a target status detection request to the reference server through the target proxy server at the first moment, the method further includes: A target server detection module is configured for the target server, wherein the target server detection module is used to send a status detection message to servers other than the target server in the target server cluster to detect the operating status of servers other than the target server in the target server cluster, and the target server detection module is also used to receive a status detection request sent by servers other than the target server in the target server cluster; The target server detection module is configured with a network address and a detection port.
6. The method according to any one of claims 1 to 4, characterized in that The detection method of the server also includes: In a case where the target server receives a reference status detection request sent by the reference server through the target proxy server, target status information for responding to the reference status detection request is sent to the reference server through the target proxy server, wherein the target status information is used to characterize the operating status of the target server, and in a case where the reference server receives the target status information, the operating status of the target server is determined based on the target status information.
7. A detection device for a server, characterized in that: include: a sending unit, configured to send a target status detection request to a reference server through a target proxy server at a first moment, wherein the status detection message is used to obtain status information of the reference server, the target server receiving the status detection message and the reference server both belong to a target server cluster, and the target proxy server is a proxy server configured for the target server cluster; a first determining unit, configured to determine that the reference server is in an abnormal state if the reference state information returned by the reference server has not been received through the target proxy server at a second time, wherein the second time is later than the first time, and a time interval between the second time and the first time is greater than a target interval; The second determination unit is used to obtain the status identification information carried in the reference status information when the target server receives the reference status information returned by the reference server through the target proxy server before the second moment; determine that the reference server is in a normal operating state when the status identification information matches the target status identification information; and determine that the reference server is in an abnormal state when the status identification information does not match the target status identification information.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program is executed by a processor to perform the method described in any one of claims 1 to 6.
9. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 6 through the computer program.
Citation Information
Patent Citations
Server state push method and system
CN108965369A
Method and system for detecting health state of server cluster
CN114168481A
Fault processing method, device and system for application server cluster
CN116095082A
Back-end server management method and apparatus, readable medium and electronic device
WO2023202182A1