A virtual server state monitoring method and device
By setting up a Diameter-type virtual server in the load balancer to establish a connection with the server cluster and periodically probe the status of the real servers, the problem of the inability to monitor the status of virtual server clusters in existing technologies is solved, and accurate monitoring and effective management of the network status of virtual servers are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HILLSTONE NETWORKS CO LTD
- Filing Date
- 2023-01-09
- Publication Date
- 2026-07-10
AI Technical Summary
Existing technologies cannot effectively monitor the status of virtual server clusters, resulting in an inability to accurately obtain the network status of virtual servers.
By setting up a Diameter-type virtual server in the load balancer, a Diameter connection is established with the server cluster, and probe messages are sent periodically to monitor the status of each real server. The status of the virtual server is determined based on the server status, and a DWA message is replied to.
It enables status monitoring of the entire server cluster, effectively determining the network status of virtual servers, avoiding invalid detection when the entire cluster is unavailable, and ensuring the effectiveness and reliability of the detection process.
Smart Images

Figure CN116032792B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a method and apparatus for monitoring the status of a virtual server. Background Technology
[0002] The Diameter protocol is an authentication, authorization, and auditing (AAA) protocol used in computer networks, defined by RFC 6733, and evolved from the RADIUS protocol. In existing technologies, virtual machine servers typically forward received DWR messages to one of the real servers in the server cluster, which then replies with DWA messages. However, in practice, it has been found that existing methods can only probe the server status of one real server, failing to accurately obtain the status of the server cluster corresponding to the virtual server. Furthermore, the status of a single real service within the server cluster does not represent the true status of the virtual server. Therefore, existing methods cannot monitor the server status of the entire server cluster, and thus cannot effectively determine the network status of the virtual server. Summary of the Invention
[0003] The purpose of this application is to provide a virtual server status monitoring method and apparatus that can monitor the server status of the entire server cluster, thereby effectively knowing the network status of the virtual server.
[0004] The first aspect of this application provides a method for monitoring the status of a virtual server, including:
[0005] When the type of the virtual server in the load balancer is set to Diameter, the server cluster corresponding to the virtual server is determined.
[0006] Establish a Diameter connection between the load balancer and the server cluster;
[0007] Under the Diameter connection, probe messages are sent to the server cluster according to a preset time period to probe the server status of each real server in the server cluster;
[0008] The status of the virtual server is determined based on the server status.
[0009] When the load balancer receives the DWR message, it replies with the DWA message based on the status of the virtual server.
[0010] In the above implementation, when the virtual server type in the load balancer is set to Diameter, this method establishes a Diameter connection with each real service in the corresponding server cluster and actively sends DWR messages periodically to probe the status of the real services. This allows the Diameter client to effectively know the network status of the virtual servers within the network environment where the load balancer exists, thereby achieving monitoring of the status of all servers in the entire server cluster.
[0011] Further, determining the state of the virtual server based on the server state includes:
[0012] Determine whether all servers in the server cluster are unavailable based on the server status.
[0013] If so, then set the virtual server to an unavailable state.
[0014] In the above implementation process, this method can, when determining the status of the virtual server, prioritize determining whether all real services are abnormal, and set the virtual server's status to unavailable if all real services are abnormal, thereby stopping the detection of real services. It is evident that this method can avoid invalid detection when the entire system is unavailable through this comprehensive pre-detection approach, thus ensuring the effectiveness and reliability of the subsequent detection process, and achieving a degree of autonomy and self-control.
[0015] Furthermore, the method also includes:
[0016] When it is determined that not all servers in the server cluster are unavailable, the server status is used to determine whether there is an unavailable target server in the server cluster.
[0017] If so, mark the target server as unavailable and generate log data indicating that the target server is unavailable.
[0018] Furthermore, the method also includes:
[0019] When the target server is detected to have recovered to an available state, the state of the target server is set to an available state.
[0020] Furthermore, replying to the DWA message based on the status of the virtual server includes:
[0021] Obtain the status of the virtual server;
[0022] When the virtual server is in an available state, a feedback message including a preset status code is sent to the client according to the DWA message.
[0023] Furthermore, the method also includes:
[0024] When the virtual server is in an unavailable state, a feedback message including an exception status code is sent to the client according to the DWA message.
[0025] A second aspect of this application provides a virtual server status monitoring device, the virtual server status monitoring device comprising:
[0026] The first determining unit is used to determine the server cluster corresponding to the virtual server when the type of the virtual server in the load balancer is set to Diameter;
[0027] A setup unit is used to establish a Diameter connection between the load balancer and the server cluster.
[0028] The sending unit is used to send probe messages to the server cluster according to a preset time period under the Diameter connection, so as to probe the server status of each real server in the server cluster.
[0029] The second determining unit is used to determine the state of the virtual server based on the server state.
[0030] The response unit is used to respond to the DWA message according to the status of the virtual server when the load balancer receives the DWR message.
[0031] Further, the second determining unit includes:
[0032] The judgment subunit is used to determine whether all servers in the server cluster are unavailable based on the server status.
[0033] A sub-unit is configured to set the virtual server to an unavailable state when it is determined that all servers in the server cluster are unavailable.
[0034] Furthermore, the second determining unit also includes:
[0035] The judgment subunit is further configured to, when it is determined that not all servers in the server cluster are unavailable, determine whether there is an unavailable target server in the server cluster based on the server status.
[0036] The tagging subunit is used to mark the target server as unavailable when the unavailable target server exists in the server cluster, and to generate log data indicating that the target server is unavailable.
[0037] Furthermore, the setting subunit is also used to set the state of the target server to an available state when it is detected that the target server has recovered to an available state.
[0038] Furthermore, the virtual server status monitoring device also includes:
[0039] The acquisition unit is used to acquire the status of the virtual server when the virtual server receives a DWA message sent by the client;
[0040] The sending unit is further configured to send a feedback message including a preset status code to the client according to the DWA message when the virtual server is in an available state.
[0041] Furthermore, the sending unit is also configured to send a feedback message including an exception status code to the client according to the DWA message when the virtual server is in an unavailable state.
[0042] A third aspect of this application provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor runs the computer program to cause the electronic device to perform the virtual server status monitoring method described in any one of the first aspects of this application.
[0043] A fourth aspect of this application provides a computer-readable storage medium storing computer program instructions, which, when read and executed by a processor, perform the virtual server status monitoring method described in any one of the first aspects of this application. Attached Figure Description
[0044] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 A flowchart illustrating a virtual server status monitoring method provided in this application embodiment;
[0046] Figure 2 A flowchart illustrating another virtual server status monitoring method provided in this application embodiment;
[0047] Figure 3 This is a schematic diagram of the structure of a virtual server status monitoring device provided in an embodiment of this application;
[0048] Figure 4 A schematic diagram of another virtual server status monitoring device provided in this application embodiment;
[0049] Figure 5 This is a schematic diagram of a system architecture for a virtual server status monitoring method provided in an embodiment of this application. Detailed Implementation
[0050] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0051] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0052] Example 1
[0053] Please refer to Figure 1 , Figure 1 This embodiment provides a flowchart illustrating a virtual server status monitoring method. The virtual server status monitoring method includes:
[0054] S101. When the type of the virtual server in the load balancer is set to Diameter, determine the server cluster corresponding to the virtual server.
[0055] S102. Establish a Diameter connection between the load balancer and the server cluster.
[0056] S103. Under Diameter connection, send probe messages to the server cluster according to the preset time period to probe the server status of each real server in the server cluster.
[0057] S104. Determine the status of the virtual server based on the server status.
[0058] S105. When the load balancer receives the DWR message, it replies with a DWA message based on the status of the virtual server.
[0059] In this embodiment, the subject executing the method can be a computing device such as a computer or server, and no limitation is made in this embodiment.
[0060] In this embodiment, the subject executing the method can also be a smart device such as a smartphone or tablet, and no limitation is made in this embodiment.
[0061] As can be seen, implementing the virtual server status monitoring method described in this embodiment can monitor the server status of the entire server cluster, and thus effectively determine the network status of the virtual server.
[0062] Example 2
[0063] Please refer to Figure 2 , Figure 2 This embodiment provides a flowchart illustrating a virtual server status monitoring method. The virtual server status monitoring method includes:
[0064] S201. When the type of the virtual server in the load balancer is set to Diameter, determine the server cluster corresponding to the virtual server.
[0065] S202. Establish a Diameter connection between the load balancer and the server cluster.
[0066] In this embodiment, when the virtual server type in the load balancer is set to Diameter, a Diameter connection is established with each real service in the corresponding server cluster, and DWR messages are actively sent periodically to probe the status of the real services. This time can be customized by the user.
[0067] S203. Under Diameter connection, send probe messages to the server cluster according to the preset time period to probe the server status of each real server in the server cluster.
[0068] S204. Determine whether all servers in the server cluster are unavailable based on the server status. If yes, proceed to step S205; otherwise, proceed to steps S206-S207.
[0069] S205. Set the virtual server to an unavailable state and execute step S211.
[0070] S206. Set the virtual server to an available state.
[0071] S207. Determine whether there is an unavailable target server in the server cluster based on the server status. If yes, proceed to step S208; otherwise, proceed to step S210.
[0072] In this embodiment, the criteria for determining whether a real service is unavailable are as follows:
[0073] a. After receiving the DWA message, parse the DWA message and determine whether the message body content with AVP of 268 is 2001. If it is not 2001, it is unavailable.
[0074] b. If there is no response to DWA messages within a certain period of time, which is specified by the user, the status is unavailable.
[0075] S208. Set the target server's status to unavailable and generate log data indicating that the target server is unavailable, then execute step S209 or S211.
[0076] S209. Detect whether the target server has been restored to availability. If yes, proceed to step S210; otherwise, proceed to step S209.
[0077] S210. Set the target server's status to available and proceed to step S211.
[0078] In this embodiment, when a real service becomes unavailable, the load balancer will notify the user in the form of logs and mark the real service as unavailable. However, it will continue to probe the real service. When the real service recovers, its status will be set back to available. Only when all real services are abnormal will the virtual server's status be set to unavailable.
[0079] S211. When the load balancer receives a DWA message sent by the client, it obtains the status of the virtual server.
[0080] S212. Determine whether the virtual server is in an available state. If yes, proceed to step S213; otherwise, proceed to step S214.
[0081] S213. Send a feedback message, including a preset status code, to the client based on the DWA message.
[0082] S214. Send a feedback message, including the exception status code, to the client based on the DWA message.
[0083] In this embodiment, when a Diameter-type virtual server receives a DWR message, it directly responds with a DWA message based on the current status of the virtual server. In the steps described above, the method has already obtained the status of the virtual server. Only when the virtual server's status is unavailable will the status code be set to an exception status code in the responded DWA message; otherwise, a DWA message with status code 2001 will be responded with.
[0084] Please refer to Figure 5 As can be seen, if the virtual server type of the load balancer is Diameter, then the load balancer establishes Diameter protocol connections with the real services corresponding to the virtual servers and periodically sends DWR messages to probe the status of the real services. Upon receiving a DWA message, the load balancer parses the DWA message and, based on the DWA message, sets the status of the virtual server by considering the status of all real services.
[0085] The DWR message between the client and the load balancer is directly responded to by the load balancer's virtual server based on its own status.
[0086] In this embodiment, the subject executing the method can be a computing device such as a computer or server, and no limitation is made in this embodiment.
[0087] In this embodiment, the subject executing the method can also be a smart device such as a smartphone or tablet, and no limitation is made in this embodiment.
[0088] As can be seen, implementing the virtual server status monitoring method described in this embodiment can monitor the server status of the entire server cluster, and thus effectively determine the network status of the virtual server.
[0089] Example 3
[0090] Please refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of a virtual server status monitoring device provided in this embodiment. Figure 3 As shown, the virtual server status monitoring device includes:
[0091] The first determining unit 310 is used to determine the server cluster corresponding to the virtual server when the type of the virtual server in the load balancer is set to Diameter.
[0092] Establishment unit 320 is used to establish a Diameter connection between the load balancer and the server cluster;
[0093] The sending unit 330 is used to send probe messages to the server cluster according to a preset time period under the Diameter connection in order to probe the server status of each real server in the server cluster.
[0094] The second determining unit 340 is used to determine the status of the virtual server based on the server status.
[0095] The response unit 350 is used to respond with a DWA message based on the status of the virtual server when the load balancer receives a DWR message.
[0096] In this embodiment, the explanation of the virtual server status monitoring device can be referred to the description in Embodiment 1 or Embodiment 2, and will not be repeated here.
[0097] As can be seen, by implementing the virtual server status monitoring device described in this embodiment, the server status of the entire server cluster can be monitored, thereby effectively determining the network status of the virtual server.
[0098] Example 4
[0099] Please refer to Figure 4 , Figure 4 This is a schematic diagram of the structure of a virtual server status monitoring device provided in this embodiment. Figure 4 As shown, the virtual server status monitoring device includes:
[0100] The first determining unit 310 is used to determine the server cluster corresponding to the virtual server when the type of the virtual server in the load balancer is set to Diameter.
[0101] Establishment unit 320 is used to establish a Diameter connection between the load balancer and the server cluster;
[0102] The sending unit 330 is used to send probe messages to the server cluster according to a preset time period under the Diameter connection in order to probe the server status of each real server in the server cluster.
[0103] The second determining unit 340 is used to determine the status of the virtual server based on the server status.
[0104] As an optional implementation, the second determining unit 340 includes:
[0105] The judgment subunit 341 is used to determine whether all servers in the server cluster are unavailable based on the server status.
[0106] Sub-unit 342 is configured to set the virtual server to an unavailable state when it is determined that all servers in the server cluster are unavailable.
[0107] As an optional implementation, the second determining unit 340 further includes:
[0108] The judgment subunit 341 is also used to determine whether there is an unavailable target server in the server cluster based on the server status when it is determined that not all servers in the server cluster are unavailable.
[0109] The tagging subunit 343 is used to mark the target server as unavailable when there is an unavailable target server in the server cluster, and to generate log data indicating that the target server is unavailable.
[0110] As an optional implementation, subunit 342 is also configured to set the state of the target server to an available state when it is detected that the target server has recovered to an available state.
[0111] As an optional implementation, the response unit 350 includes:
[0112] Get sub-unit 351, used to obtain the status of the virtual server when the load balancer receives the DWA message;
[0113] The sending subunit 352 is also used to send a feedback message including a preset status code to the client according to the DWA message when the virtual server is in an available state.
[0114] As an optional implementation, the sending unit 330 is also configured to send a feedback message including an exception status code to the client according to the DWA message when the virtual server is in an unavailable state.
[0115] In this embodiment, the explanation of the virtual server status monitoring device can be referred to the description in Embodiment 1 or Embodiment 2, and will not be repeated here.
[0116] As can be seen, by implementing the virtual server status monitoring device described in this embodiment, the server status of the entire server cluster can be monitored, thereby effectively determining the network status of the virtual server.
[0117] This application provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor runs the computer program to enable the electronic device to perform the virtual server status monitoring method in embodiment 1 or embodiment 2 of this application.
[0118] This application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the virtual server status monitoring method in embodiment 1 or embodiment 2 of this application is performed.
[0119] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0120] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0121] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0122] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0123] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0124] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for monitoring the status of a virtual server, characterized in that, include: When the type of the virtual server in the load balancer is set to Diameter, the server cluster corresponding to the virtual server is determined. Establish a Diameter connection between the load balancer and the server cluster; Under the Diameter connection, probe messages are sent to the server cluster according to a preset time period to probe the server status of each real server in the server cluster. The status of the virtual server is determined based on the server status. The status of the virtual server is set by taking into account the status of all real servers; When the load balancer receives a DWR message from the client, the load balancer directly replies with a DWA message to the client based on the status of the virtual server. The step of determining the status of the virtual server based on the server status includes: Determine whether all servers in the server cluster are unavailable based on the server status. If so, then set the virtual server to an unavailable state.
2. The virtual server status monitoring method according to claim 1, characterized in that, The method further includes: When it is determined that not all servers in the server cluster are unavailable, the server status is used to determine whether there is an unavailable target server in the server cluster. If so, mark the target server as unavailable and generate log data indicating that the target server is unavailable.
3. The virtual server status monitoring method according to claim 2, characterized in that, The method further includes: When the target server is detected to have recovered to an available state, the state of the target server is set to an available state.
4. The virtual server status monitoring method according to any one of claims 1 to 3, characterized in that, The step of replying to the DWA message based on the status of the virtual server includes: Obtain the status of the virtual server; When the virtual server is in an available state, a feedback message including a preset status code is sent to the client according to the DWA message.
5. The virtual server status monitoring method according to claim 4, characterized in that, The method further includes: When the virtual server is in an unavailable state, a feedback message including an exception status code is sent to the client according to the DWA message.
6. A virtual server status monitoring device, characterized in that, The virtual server status monitoring device includes: The first determining unit is used to determine the server cluster corresponding to the virtual server when the type of the virtual server in the load balancer is set to Diameter; A setup unit is used to establish a Diameter connection between the load balancer and the server cluster. The sending unit is used to send probe messages to the server cluster according to a preset time period under the Diameter connection, so as to probe the server status of each real server in the server cluster. The second determining unit is used to determine the state of the virtual server based on the server state; wherein the state of the virtual server is set by comprehensively considering the states of all real servers; The response unit is used to, when the load balancer receives a DWR message sent by the client, have the load balancer directly reply with a DWA message to the client based on the status of the virtual server; The second determining unit includes: The judgment subunit is used to determine whether all servers in the server cluster are unavailable based on the server status. A sub-unit is configured to set the virtual server to an unavailable state when it is determined that all servers in the server cluster are unavailable.
7. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to cause the electronic device to perform the virtual server status monitoring method according to any one of claims 1 to 5.
8. A readable storage medium, characterized in that, The readable storage medium stores computer program instructions, which, when read and executed by a processor, perform the virtual server status monitoring method according to any one of claims 1 to 5.