Cluster address list acquisition method and device, computer equipment, medium and product
By obtaining and connecting the Internet protocol address of the service host and performing periodic active detection, the problem of inflexible cluster node address list discovery in the prior art is solved, and an efficient and reliable address discovery process is achieved.
Patent Information
- Application Number
- CN202411747963.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-12-02
AI Technical Summary
In microservices or distributed architecture systems, efficient interaction and collaborative work between services depends on the discovery of address lists of cluster nodes, but in the prior art, the client side configuration static address lists is not flexible enough.
By obtaining the Internet protocol addresses of multiple service hosts, the service host is communicated and connected according to the minimum threshold of available connections obtained in advance, a list of available addresses is obtained, and periodic keep-alive detection is performed based on the list to obtain the target cluster address list.
It realizes rapid filtering of available addresses, improves the efficiency of address discovery, and greatly improves the accuracy and reliability of address lists by monitoring the availability of addresses in real time.
Smart Images

Figure CN119520481A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a cluster address list acquisition method, device, computer equipment, medium and product. Background Art
[0002] In today's microservice or distributed architecture systems, efficient interaction and collaboration between services are crucial. In order to achieve smooth calls between services, it is necessary to deploy cluster nodes such as the "service registry" in the system and embed corresponding clients in the service components to establish connections with the cluster. However, the clients embedded in each service first need a way to discover the address list of the cluster nodes.
[0003] At present, the commonly used solution is to directly configure the static address list of the cluster nodes of the "service registration center" on the client side. However, the method of configuring the static address list of the "service registration center" on the client side is not flexible enough. Summary of the invention
[0004] Based on this, it is necessary to provide a cluster address list acquisition method, device, computer equipment, medium and product that can solve the above-mentioned technical problems.
[0005] In a first aspect, the present application provides a method for obtaining a cluster address list, the method comprising:
[0006] Obtain the Internet Protocol addresses of multiple service hosts;
[0007] According to each Internet Protocol address and a pre-acquired minimum threshold of the number of available connections, communication connection processing is performed on each service host to obtain an available address list;
[0008] Perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list.
[0009] In one embodiment, the communication connection processing is performed on each service host according to each Internet Protocol address and the pre-acquired minimum threshold of the number of available connections to obtain an available address list, including:
[0010] Perform communication connection processing on each service host according to the Internet Protocol address of each service host;
[0011] Determine the Internet Protocol address of the successfully connected service host as a candidate protocol address;
[0012] A list of available addresses is determined based on the minimum threshold of the number of available connections and the candidate protocol addresses.
[0013] In one embodiment, the periodic keep-alive detection process is performed based on the available address list to obtain the target cluster address list, including:
[0014] Send a detection request to each available protocol address in the available address list based on a preset period, and obtain a detection result of each available protocol address;
[0015] The available address list is updated according to the multiple detection results to obtain the target cluster address list.
[0016] In one of the embodiments, the detection result includes survival and inactivation; based on a preset period, a detection request is sent to each available protocol address in the available address list to obtain the detection result of each available protocol address, including:
[0017] For each available protocol address in the available address list, a detection request is sent to the service host corresponding to the available protocol address;
[0018] Upon receiving feedback information returned by the service host, determining that the detection result of the service host is alive;
[0019] If no feedback information is received from the service host, a detection request is resent to the service host until the detection request is sent a preset number of times and no feedback information is received, and the detection result of the service host is determined to be inactive.
[0020] In one embodiment, the updating of the available address list according to the multiple detection results to obtain the target cluster address list includes:
[0021] The available protocol addresses corresponding to the detection result indicating survival are retained in the available address list, and the available protocol addresses corresponding to the detection result indicating inactivation are deleted from the available address list to obtain a target cluster address list.
[0022] In one embodiment, the method further comprises:
[0023] When the number of available protocol addresses in the target cluster address list is less than a minimum threshold of the number of available connections, a step of obtaining Internet Protocol addresses of multiple service hosts is performed.
[0024] In a second aspect, the present application also provides a cluster address list acquisition device. The device includes:
[0025] An address acquisition module, used to acquire Internet protocol addresses of multiple service hosts;
[0026] An available list determination module is used to perform communication connection processing on each service host according to each Internet Protocol address and a pre-acquired minimum threshold of the number of available connections to obtain an available address list;
[0027] The target list determination module is used to perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list.
[0028] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0029] Obtain the Internet Protocol addresses of multiple service hosts;
[0030] According to each Internet Protocol address and a pre-acquired minimum threshold of the number of available connections, communication connection processing is performed on each service host to obtain an available address list;
[0031] Perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list.
[0032] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0033] Obtain the Internet Protocol addresses of multiple service hosts;
[0034] According to each Internet Protocol address and a pre-acquired minimum threshold of the number of available connections, communication connection processing is performed on each service host to obtain an available address list;
[0035] Perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list.
[0036] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0037] Obtain the Internet Protocol addresses of multiple service hosts;
[0038] According to each Internet Protocol address and a pre-acquired minimum threshold of the number of available connections, communication connection processing is performed on each service host to obtain an available address list;
[0039] Perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list.
[0040] The above-mentioned cluster address list acquisition method, device, computer equipment, medium and product obtain the Internet Protocol addresses of multiple service hosts; perform communication connection processing on each service host according to each Internet Protocol address and the pre-acquired minimum threshold of the number of available connections to obtain an available address list; perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list. The present application performs communication connection processing on the service host according to the Internet Protocol address and the minimum threshold of the number of available connections, and can quickly screen out available addresses, thereby improving the efficiency of address discovery. After obtaining the list of available addresses, periodic keep-alive detection processing is performed, which can monitor the availability of the address in real time, greatly improving the accuracy and reliability of the address list. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 An application environment diagram of a cluster address list acquisition method in one embodiment;
[0042] Figure 2 A schematic diagram of a process for obtaining a cluster address list in one embodiment;
[0043] Figure 3 A schematic diagram of a process for obtaining a list of available addresses in one embodiment;
[0044] Figure 4 A schematic diagram of a process of obtaining a target cluster address list in one embodiment;
[0045] Figure 5 A schematic diagram of a flow chart of obtaining detection results of each available protocol address in one embodiment;
[0046] Figure 6 It is a structural block diagram of a cluster address list acquisition device in one embodiment;
[0047] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] First of all, before specifically introducing the technical solution of the embodiments of the present application, the technical background based on the embodiments of the present application is introduced.
[0050] Based on this, the present application provides a cluster address list acquisition method, apparatus, computer equipment, medium and product, aiming to solve the above technical problems.
[0051] The cluster address list acquisition method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the service host 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 obtains the Internet Protocol addresses of multiple service hosts 102; according to each Internet Protocol address and the pre-acquired minimum threshold of the number of available connections, each service host is processed for communication connection to obtain an available address list; based on the available address list, a periodic keep-alive detection process is performed to obtain a target cluster address list. Among them, the service host 102 runs the physical or virtual host of the service, and the service host can be a physical server or a virtual server instance in a cloud computing environment. These host machines are installed with a service discovery registry or other related service components, which can be accessed and processed for communication connection through the Internet Protocol address. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0052] In one embodiment, Figure 2 As shown, a cluster address list acquisition method is provided, and the method is applied to Figure 1 The server in the example is used to illustrate the following steps:
[0053] S201, obtaining Internet Protocol addresses of multiple service hosts.
[0054] The service host refers to a physical server or virtual server instance that runs a specific service. It provides the operating environment and resources for the service and may have key components such as a service discovery registry installed.
[0055] An Internet Protocol address (IP address) is a digital label assigned to each device connected to a computer network for identification and communication in the network. In the embodiment of the present application, the IP address of the service host is key information for locating and connecting to the service host.
[0056] In the embodiment of the present application, the IP addresses of multiple service hosts can be obtained through a pre-configured file or database. For example, when the system starts, a pre-stored service host IP address list is read from a configuration file.
[0057] Another implementation method is to automatically discover the IP address of the service host by means of network scanning. For example, a specific network scanning tool is used to scan within a specific network range to find the host running a specific service and obtain its IP address.
[0058] S202, performing communication connection processing on each service host according to each Internet Protocol address and a pre-acquired minimum threshold of the number of available connections to obtain an available address list.
[0059] The minimum threshold of available connections is a pre-set value used to determine whether the current number of available connections is sufficient. When the number of available connections is less than this threshold, the server will trigger a specific operation to find more available service host addresses.
[0060] The available address list refers to a list of all successfully connected service host addresses obtained after the service host is connected. The service hosts corresponding to the addresses in this list are considered available and can be used for subsequent service calls and communications.
[0061] In an embodiment of the present application, a TCP connection attempt can be used to connect to the IP address of each service host. If the connection is successful, the address is added to the list of available addresses, and relevant information about the connection, such as the connection time, connection status, etc., is recorded. At the same time, a timer is started to regularly perform keep-alive detection on the connection. If the connection fails and the reason for the failure is "connection refused", it is considered that the service discovery registry is not running on the service host, and the address is not added to the list of available addresses.
[0062] Another implementation method: an asynchronous connection method can be used to simultaneously attempt to connect to multiple service host IP addresses. This can improve the efficiency of connection processing and reduce the time to establish a connection. When the connection succeeds or fails, the callback function performs corresponding processing and adds the result to the available address list or excludes the address.
[0063] S203: Perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list.
[0064] The target cluster address list refers to the final address list obtained after periodic keep-alive detection of the available address list. This list contains the currently available service registration center addresses and is the main basis for the system to call services and communicate.
[0065] In an embodiment of the present application, for each address in the available address list, a specific detection request or heartbeat packet is sent regularly. If a response is received within the specified time, it is considered that the connection is still available and the address continues to be kept in the available address list. If no response is received for multiple consecutive times, the address is deleted from the available address list. At the same time, it is checked whether the number of currently available connections is less than the minimum threshold of the number of available connections. If so, a new round of address detection process is triggered, the IP address of the service host is re-acquired, and connection processing and keep-alive detection are performed.
[0066] Another implementation method: a distributed keep-alive detection mechanism can be used to distribute the keep-alive detection task to multiple nodes for parallel processing. This can improve the efficiency of keep-alive detection and detect connection failures in a timely manner. When a connection failure is found, other nodes are notified through a message passing mechanism so that the available address list is updated in a timely manner and a new round of address detection is triggered.
[0067] The above-mentioned cluster address list acquisition method, device, computer equipment, medium and product obtain the Internet Protocol addresses of multiple service hosts; perform communication connection processing on each service host according to each Internet Protocol address and the pre-acquired minimum threshold of the number of available connections to obtain an available address list; perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list. The present application performs communication connection processing on the service host according to the Internet Protocol address and the minimum threshold of the number of available connections, and can quickly screen out available addresses, thereby improving the efficiency of address discovery. After obtaining the list of available addresses, periodic keep-alive detection processing is performed, which can monitor the availability of the address in real time, greatly improving the accuracy and reliability of the address list.
[0068] In an exemplary embodiment, based on the above embodiment, see Figure 3 The embodiment of the present application relates to a process of performing communication connection processing on each service host according to each Internet Protocol address and a pre-acquired minimum threshold of the number of available connections to obtain an available address list, including the following steps:
[0069] S301, performing communication connection processing on each service host according to the Internet Protocol address of each service host.
[0070] In the embodiment of the present application, for each service host's IP address, a TCP connection attempt is used to connect. A synchronous connection method can be used to connect to each IP address in turn, and relevant information such as connection time, connection status, etc. is recorded after the connection is successful.
[0071] S302: Determine an available address list according to the minimum threshold of the number of available connections and the candidate protocol addresses.
[0072] The candidate protocol addresses refer to those service host IP addresses that may become available addresses during the communication connection process of the service host.
[0073] In the embodiment of the present application, first, the number of candidate protocol addresses that have successfully established a connection is counted. If this number is greater than or equal to the minimum threshold of the number of available connections, then these successfully connected candidate protocol addresses form an available address list. If the number is less than the minimum threshold of the number of available connections, continue to attempt to connect to other unconnected candidate protocol addresses until the threshold requirement is met or all candidate protocol addresses have been tried.
[0074] The embodiment of the present application can ensure that the addresses in the available address list are all verified available addresses by judging and screening the number of connections, thereby improving the reliability and stability of the system.
[0075] In an exemplary embodiment, based on the above embodiment, see Figure 4 The embodiment of the present application relates to periodic keep-alive detection processing based on an available address list, and the process of obtaining a target cluster address list includes the following steps:
[0076] S401, sending a detection request to each available protocol address in the available address list based on a preset period, and obtaining a detection result of each available protocol address.
[0077] In the embodiment of the present application, a timer can be set to send a lightweight detection request, such as a simple heartbeat packet, to each available protocol address in the available address list according to a preset period. If a response is received within the specified time, the detection result of the address is considered to be available; if no response is received, it is marked as unavailable.
[0078] Another implementation method: a distributed detection method can be used to distribute the detection task to multiple nodes for simultaneous detection. Each node is responsible for detecting a portion of available protocol addresses and aggregating the detection results to the central node for processing. This can improve the detection efficiency and reduce the detection time.
[0079] S402: Update the available address list according to the multiple detection results to obtain a target cluster address list.
[0080] In the embodiment of the present application, the server traverses all detection results, and if the detection result of a certain available protocol address is available, it will continue to be retained in the available address list; if the detection result is unavailable, it will be deleted from the available address list. The updated available address list is the target cluster address list.
[0081] Another implementation method: a buffer area can be set up. For addresses with unavailable detection results, they are first placed in the buffer area and observed for a period of time. If the detection result of the address is restored to be available during the buffer period, it will be added back to the available address list; if it is still unavailable during the buffer period, it will be deleted from the available address list. This can avoid misjudgment due to network fluctuations and other reasons.
[0082] The embodiment of the present application can timely discover the unavailability of addresses through regular keep-alive detection, ensure that the addresses in the target cluster address list are truly available, and improve the reliability of the system.
[0083] In an exemplary embodiment, based on the above embodiment, see Figure 5 The detection results of the embodiment of the present application include survival and inactivation; based on a preset period, a detection request is sent to each available protocol address in the available address list to obtain the detection result of each available protocol address, including the following steps:
[0084] S501: For each available protocol address in the available address list, a detection request is sent to a service host corresponding to the available protocol address.
[0085] In the embodiment of the present application, a network request method, such as an HTTP request or a specific custom protocol request, can be used to send a detection request to a service host. The request can carry some identification information so that the service host can recognize and respond quickly. It is also possible to use an asynchronous method to send detection requests to multiple service hosts at the same time to improve detection efficiency. Asynchronous sending can be achieved using a multithreaded or asynchronous programming framework.
[0086] S502: upon receiving feedback information returned by the service host, determining that the detection result of the service host is alive.
[0087] The feedback information refers to the response of the service host to the detection request, which may be a specific signal, data packet, etc., used to confirm the status of the service host.
[0088] In the embodiment of the present application, after receiving the feedback information returned by the service host, the detection result of the service host is immediately marked as alive, and the time of receiving the feedback and other information are recorded for subsequent analysis and statistics. The feedback information can also be further verified, such as checking the integrity and correctness of the feedback information. Only after the verification is passed, the detection result is determined to be alive.
[0089] S503, when no feedback information is received from the service host, resend the detection request to the service host until the detection request is sent a preset number of times and no feedback information is received, and then determine that the detection result of the service host is inactive.
[0090] In an embodiment of the present application, a counter can be set, and the value of the counter is increased each time feedback information is not received, and a detection request is sent again. When the counter reaches a preset number of times, the detection result of the service host is determined to be inactive, and it is deleted from the list of available addresses. It is also possible to increase the waiting time or adjust the request parameters each time the detection request is resent, such as increasing the timeout time of the request, etc., to increase the possibility of obtaining feedback information. If feedback information is still not received after multiple adjustments, it is determined to be inactive.
[0091] The embodiment of the present application can reduce the possibility of misjudgment and improve the accuracy of judging the availability of the service host by sending multiple detection requests and determining the status of the service host based on the feedback. Timely discovering inactive service hosts and deleting them from the available address list can avoid using unavailable addresses for service calls and improve the reliability of the system.
[0092] In an exemplary embodiment, based on the above embodiments, the embodiments of the present application involve a process of updating an available address list according to multiple detection results to obtain a target cluster address list, including the following steps: retaining the available protocol addresses corresponding to the detection results representing survival in the available address list, and deleting the available protocol addresses corresponding to the detection results representing inactivation in the available address list to obtain a target cluster address list.
[0093] In an embodiment of the present application, the available address list can be traversed, and for each available protocol address, the corresponding detection result can be checked. If the detection result is alive, the address is retained in the available address list; if the detection result is inactive, the address is deleted from the available address list. It is also possible to use a marking method to mark the addresses whose detection results are alive, and then uniformly process the unmarked addresses (i.e., inactive addresses) and delete them from the available address list. This can improve processing efficiency, especially when processing large-scale address lists.
[0094] The embodiment of the present application can ensure that the addresses in the target cluster address list are all available by updating the available address list according to the detection results, retaining only the surviving addresses and deleting the inactive addresses, thereby improving the accuracy of the address list. Using an accurate address list for service calls can avoid service interruptions or errors caused by using unavailable addresses, thereby improving the reliability of the system. As the state of the service host changes, dynamically updating the address list can enable the system to better adapt to changes in resources, reasonably allocate resources, and improve the performance and efficiency of the system.
[0095] In an exemplary embodiment, based on the above embodiment, the method of the embodiment of the present application further includes the following steps:
[0096] When the number of available protocol addresses in the target cluster address list is less than a minimum threshold of the number of available connections, a step of obtaining Internet Protocol addresses of multiple service hosts is performed.
[0097] The embodiment of the present application can set up a monitoring mechanism to regularly check the number of available protocol addresses in the target cluster address list. When it is found that the number is less than the minimum threshold of the number of available connections, the step of obtaining the Internet Protocol addresses of multiple service hosts is immediately triggered. The monitoring can be implemented using a timer or periodic task scheduling. It is also possible to check the number of available protocol addresses in the target cluster address list in real time when the system makes a service call. If it is found that the number is insufficient when making a service call, the process of obtaining a new service host IP address is immediately started to ensure the availability and stability of the service.
[0098] In the embodiment of the present application, when the number of available addresses is insufficient, the step of obtaining new addresses is automatically triggered, so that the system can adaptively respond to changes in address resources, and improve the flexibility and adaptability of the system. By replenishing available addresses in a timely manner, it is ensured that the system has sufficient available connections at all times, thereby improving the availability and stability of the service.
[0099] In an exemplary embodiment, based on the above embodiment, the method of the embodiment of the present application further includes the following steps:
[0100] Step 1: The server obtains the Internet Protocol addresses of multiple service hosts;
[0101] Step 2: Perform communication connection processing on each service host according to the Internet Protocol address of each service host; determine the Internet Protocol address of the successfully connected service host as the candidate protocol address; determine the available address list according to the minimum threshold of the number of available connections and the candidate protocol address;
[0102] Step 3: For each available protocol address in the available address list, send a detection request to the service host corresponding to the available protocol address; if feedback information returned by the service host is received, determine that the detection result of the service host is alive; if no feedback information returned by the service host is received, resend the detection request to the service host until the number of detection request transmissions reaches a preset number and no feedback information is received, determine that the detection result of the service host is inactive;
[0103] Step 4: retain the available protocol address corresponding to the detection result indicating survival in the available address list, and delete the available protocol address corresponding to the detection result indicating inactivation in the available address list, to obtain the target cluster address list;
[0104] Step 5: When the number of available protocol addresses in the target cluster address list is less than the minimum threshold of the number of available connections, the step of obtaining Internet Protocol addresses of multiple service hosts is performed.
[0105] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0106] Based on the same inventive concept, the embodiment of the present application also provides a cluster address list acquisition device for implementing the cluster address list acquisition method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more cluster address list acquisition device embodiments provided below can refer to the above limitations on the cluster address list acquisition method, and will not be repeated here.
[0107] In one embodiment, Figure 6 As shown, a cluster address list acquisition device 600 is provided, comprising:
[0108] An address acquisition module 601 is used to acquire Internet protocol addresses of multiple service hosts;
[0109] An available list determination module 602 is used to perform communication connection processing on each service host according to each Internet Protocol address and a pre-acquired minimum threshold of the number of available connections to obtain an available address list;
[0110] The target list determination module 603 is used to perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list.
[0111] In one embodiment, the available list determination module 602 includes:
[0112] A communication connection unit, used for performing communication connection processing on each service host according to the Internet Protocol address of each service host;
[0113] A candidate address determination unit, used to determine the Internet Protocol address of the successfully connected service host as a candidate protocol address;
[0114] The available list determination unit is used to determine the available address list according to the minimum threshold of the number of available connections and the candidate protocol addresses.
[0115] In one embodiment, the target list determination module includes:
[0116] A detection result determination unit, configured to send a detection request to each available protocol address in the available address list based on a preset period, and obtain a detection result of each available protocol address;
[0117] The target list determination unit is used to update the available address list according to the multiple detection results to obtain the target cluster address list.
[0118] In one embodiment, the detection result includes survival and inactivation; and the detection result determination unit includes:
[0119] A request sending subunit, for sending a detection request to a service host corresponding to each available protocol address in the available address list;
[0120] A first result determination subunit is used to determine that the detection result of the service host is alive when receiving feedback information returned by the service host;
[0121] The second result determination subunit is used to resend a detection request to the service host machine when no feedback information returned by the service host machine is received, until the number of detection request sending times reaches a preset number and no feedback information is received, and then determine that the detection result of the service host machine is determined to be inactive.
[0122] In one embodiment, the target list determination unit includes:
[0123] The update subunit is used to retain the available protocol addresses corresponding to the detection result characterizing survival in the available address list, and delete the available protocol addresses corresponding to the detection result characterizing inactivation in the available address list to obtain the target cluster address list.
[0124] In one embodiment, the above device further comprises:
[0125] The iterative execution module is used to execute the step of obtaining Internet Protocol addresses of multiple service hosts when the number of available protocol addresses in the target cluster address list is less than a minimum threshold of the number of available connections.
[0126] Each module in the above-mentioned cluster address list acquisition device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0127] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external service host through a network connection. When the computer program is executed by the processor, a cluster address list acquisition method is implemented.
[0128] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0129] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0130] Obtain the Internet Protocol addresses of multiple service hosts;
[0131] According to each Internet Protocol address and a pre-acquired minimum threshold of the number of available connections, communication connection processing is performed on each service host to obtain an available address list;
[0132] Perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list.
[0133] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0134] Perform communication connection processing on each service host according to the Internet Protocol address of each service host;
[0135] Determine the Internet Protocol address of the successfully connected service host as a candidate protocol address;
[0136] A list of available addresses is determined based on the minimum threshold of the number of available connections and the candidate protocol addresses.
[0137] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0138] Send a detection request to each available protocol address in the available address list based on a preset period, and obtain a detection result of each available protocol address;
[0139] The available address list is updated according to the multiple detection results to obtain the target cluster address list.
[0140] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0141] For each available protocol address in the available address list, a detection request is sent to the service host corresponding to the available protocol address;
[0142] Upon receiving feedback information returned by the service host, determining that the detection result of the service host is alive;
[0143] If no feedback information is received from the service host, a detection request is resent to the service host until the detection request is sent a preset number of times and no feedback information is received, and the detection result of the service host is determined to be inactive.
[0144] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0145] The available protocol addresses corresponding to the detection result indicating survival are retained in the available address list, and the available protocol addresses corresponding to the detection result indicating inactivation are deleted from the available address list to obtain a target cluster address list.
[0146] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0147] When the number of available protocol addresses in the target cluster address list is less than a minimum threshold of the number of available connections, a step of obtaining Internet Protocol addresses of multiple service hosts is performed.
[0148] According to some embodiments of the present application, there is also provided a non-transitory computer-readable storage medium including instructions, such as a memory including instructions, and the above instructions can be executed by a processor of an electronic device to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0149] According to some embodiments of the present application, a computer program product is also provided, and when the computer program is executed by a processor, the above method can be implemented. The computer program product includes one or more computer instructions. When these computer instructions are loaded and executed on a computer, part or all of the above method can be implemented in whole or in part according to the process or function described in the embodiment of the present application.
[0150] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0151] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0152] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0153] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A cluster address list acquisition method, characterized in that: The method comprises: Obtain the Internet Protocol addresses of multiple service hosts; According to each of the Internet Protocol addresses and the pre-acquired minimum threshold of the number of available connections, communication connection processing is performed on each of the service host machines to obtain an available address list; Periodic keep-alive detection processing is performed based on the available address list to obtain a target cluster address list.
2. The method according to claim 1, characterized in that The step of performing communication connection processing on each of the service hosts according to each of the Internet Protocol addresses and the pre-acquired minimum threshold of the number of available connections to obtain a list of available addresses includes: Performing communication connection processing on each of the service host machines according to the Internet Protocol address of each of the service host machines; Determine the Internet Protocol address of the successfully connected service host as a candidate protocol address; The available address list is determined according to the minimum threshold of the number of available connections and the candidate protocol addresses.
3. The method according to claim 2, characterized in that The performing periodic keep-alive detection processing based on the available address list to obtain a target cluster address list includes: Sending a detection request to each available protocol address in the available address list based on a preset period to obtain a detection result of each available protocol address; The available address list is updated according to the plurality of detection results to obtain the target cluster address list.
4. The method according to claim 3, characterized in that The detection result includes survival and inactivation; the sending of a detection request to each available protocol address in the available address list based on a preset period to obtain the detection result of each available protocol address includes: For each of the available protocol addresses in the available address list, sending a detection request to a service host corresponding to the available protocol address; In case of receiving feedback information returned by the service host, determining that the detection result of the service host is alive; If no feedback information is received from the service host, the detection request is resent to the service host until the detection request is sent a preset number of times and no feedback information is received, and the detection result of the service host is determined to be inactive.
5. The method according to claim 4, characterized in that The updating of the available address list according to the plurality of detection results to obtain the target cluster address list includes: The available protocol address corresponding to the detection result characterizing survival is retained in the available address list, and the available protocol address corresponding to the detection result characterizing inactivation is deleted from the available address list to obtain the target cluster address list.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: When the number of available protocol addresses in the target cluster address list is less than the minimum threshold of the number of available connections, the step of acquiring Internet Protocol addresses of multiple service host machines is performed.
7. A cluster address list acquisition device, characterized in that: The device comprises: An address acquisition module, used to acquire Internet protocol addresses of multiple service hosts; An available list determination module, configured to perform communication connection processing on each of the service hosts according to each of the Internet Protocol addresses and a pre-acquired minimum threshold of the number of available connections, to obtain an available address list; The target list determination module is used to perform periodic keep-alive detection processing based on the available address list to obtain a target cluster address list.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Management method and device of exclusive host machine and electronic equipment
CN112751694A
Hardware protocol stack-based TCP long connection keep-alive method and device
CN115225690A
Service resource deployment method and device, server and storage medium
CN118473912A
System and method of establishing seamless remote access virtual private network connections
US20220321401A1