Application cluster group formation method, computer device, and computer-readable storage medium

By adopting a Redis service discovery strategy in a cloud environment, the problem of building a Hazelcast cluster under dynamic node allocation was solved, achieving unified cluster building, reducing system maintenance costs and improving efficiency.

CN115633043BActive Publication Date: 2026-03-17YONYOU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-13
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

In cloud environments, existing technologies cannot effectively build Hazelcast clusters, especially when dynamically allocating nodes. The static configuration method of Transmission Control Protocol (TCP) cannot meet the requirements, making it impossible to build a data distribution and cluster platform cluster in the cloud environment.

Method used

A service discovery strategy based on Redis is adopted. By obtaining node information and registering it in the node information registry of the service discovery strategy, the identity is determined based on the node information, and the cluster is built.

Benefits of technology

It enables the clustering of Hazelcast applications in a cloud environment, compatible with native, public cloud, private cloud and dedicated deployments, reducing system maintenance costs and improving efficiency and customer satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115633043B_ABST
    Figure CN115633043B_ABST
Patent Text Reader

Abstract

The application provides an application cluster construction method, a computer device and a computer readable storage medium. The application cluster construction method comprises the following steps: in response to the start of a first application, a first node and first node information are acquired, and a connection between the first node and a service discovery strategy is created; a node information registration request is initiated to the service discovery strategy according to the first node information; a node information registration table is acquired in the service discovery strategy; the identity of the first node is determined according to the first node information and the node information registration table; and a cluster is constructed according to the identity of the first node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically, to an application cluster building method, a computer device, and a computer-readable storage medium. Background Technology

[0002] In related technologies, service discovery strategies cannot be well scaled, and for dynamically allocated nodes, node addresses cannot be determined before runtime. While static configuration using the Transmission Control Protocol (TCP) in native deployments can meet enterprise needs, with the rise of cloud services, the migration of various applications to the cloud, containerization, and dynamic node allocation, TCP is no longer sufficient. Therefore, none of these three methods are applicable to cloud environments. How to build a data distribution and clustering platform (Hazelcast) cluster in a cloud environment is an unresolved issue. Summary of the Invention

[0003] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.

[0004] Therefore, the first aspect of the present invention proposes an application cluster construction method.

[0005] A second aspect of the present invention provides a computer device.

[0006] A third aspect of the present invention provides a computer-readable storage medium.

[0007] In view of this, according to a first aspect of the present invention, an application cluster construction method is proposed, comprising: in response to the startup of a first application, obtaining a first node and first node information, and creating a connection between the first node and a service discovery policy; initiating a node information registration request to the service discovery policy based on the first node information; obtaining a node information registry in the service discovery policy; determining the identity of the first node based on the first node information and the node information registry; and constructing a cluster based on the identity of the first node.

[0008] The application cluster construction method provided by this invention, after the first application starts, firstly executes a registration phase, obtains the first node and its information in the first application, and establishes a connection with the service discovery strategy, that is, connects the service discovery strategy with the first application. Service discovery refers to using a registry center to record information about all services in the distributed system so that other services can quickly find these registered services. Furthermore, in this invention, the service discovery strategy is implemented based on a remote dictionary service (Redis). A node information registration request is initiated to the service discovery strategy based on the first node information, adding the first node information to the node information registry in the service discovery strategy. Further, the node information registry is obtained from the service discovery strategy, all node information is parsed, and the identity of the first node is determined based on the first node information and the contents of the node information list. Finally, the cluster is constructed based on the identity of the first node. Thus, the application cluster is constructed.

[0009] The application cluster building method provided by this invention implements a service discovery strategy based on Redis, successfully building a Hazelcast application cluster in a cloud environment and achieving the goal of providing unified external services. It also changes the predicament of being unable to build a cluster due to environmental changes, meeting the cluster building capabilities that cloud-era applications should possess. Furthermore, this method is compatible with native, public cloud, private cloud, and customized deployments, promoting the unification of cluster building methods across various environments, significantly reducing system maintenance costs and improving efficiency.

[0010] The application cluster construction method of the present invention may also have the following technical features:

[0011] In the above technical solution, the step of determining the identity of the first node based on the first node information and the node information registry specifically includes: if the node information registry contains only the first node information, then the first node is a master node; if the node information registry contains other node information, then the first node is a slave node.

[0012] In this technical solution, the steps for determining the identity of the first node based on the first node information and the node information registry specifically include: if the node information registry only contains the first node's own information, then the first node will elect itself as the master node; if the node information registry contains information about other nodes besides the first node, then the first node will join the cluster as a slave node. The identity of the first node in forming the cluster is determined by comparing the first node information with the contents of the node information registry.

[0013] In any of the above technical solutions, the steps of forming a cluster based on the identity of the first node specifically include: the first node being the master node, which maintains the cluster; and the first node being a slave node, which sends a join request to the cluster, which is then reviewed by the master node.

[0014] In this technical solution, the steps of forming a cluster based on the identity of the first node specifically include: if the first node is the master node in the cluster, the first node is responsible for maintaining the cluster and managing other nodes in the cluster; if the first node is a slave node, the first node needs to send a join request to the cluster, and the master node will review and decide whether to agree to let the first node join the cluster.

[0015] In any of the above technical solutions, after the step of initiating node information registration with the service discovery strategy based on the first node information, the method further includes: starting a monitoring thread to maintain the registered first node information.

[0016] In this technical solution, after the step of registering node information with the service discovery policy based on the first node information, the solution further includes: after the first node information is registered with the service discovery policy, a monitoring thread will be started to monitor and maintain the registered first node information, so as to dynamically allocate nodes.

[0017] In any of the above technical solutions, the steps of obtaining the first node and its information, and creating a connection between the first node and the service discovery strategy, include: connecting the service provider interface of the cluster framework to the service discovery strategy; and configuring the cluster framework according to the service discovery strategy.

[0018] In this technical solution, before the steps of obtaining the first node and its information, and establishing a connection between the first node and the service discovery strategy, the following steps are taken: Since Hazelcast provides a Service Provider Interface (SPI) extension mechanism that allows enterprises to implement their own service discovery strategies and support adaptation to Hazelcast to build clusters, the service provider interface of the cluster framework is connected to the service discovery strategy, i.e., the SPI is configured. Specifically, according to the SPI definition, the specific implementation of the SPI is configured in the "META-INF / services" directory of the project's JAR file. Its file name is "Hazelcast Discovery SPI," and "com.hazelcast.spi.discovery.DiscoveryStrategyFactory" is the service discovery SPI interface exposed by Hazelcast, which is also the entry point for the service discovery strategy to adapt to Hazelcast in this invention. The content of this file is the implementation of this interface, and here the strategy factory of this invention is configured. The strategy factory refers to the specific process of creating a discovery strategy, creating a specific discovery strategy based on the declared SPI service. By connecting the service discovery strategy to the SPI interface in Hazelcast, the connection between the service discovery strategy and the Hazelcast cluster is established, enabling the Hazelcast cluster to find the service discovery strategy implemented based on Redis. Furthermore, by configuring the Hazelcast cluster configuration file according to the service discovery strategy, the Hazelcast cluster can be built according to the configuration in the service discovery strategy.

[0019] In any of the above technical solutions, the steps of configuring the cluster framework according to the service discovery policy specifically include: enabling the service discovery switch of the cluster framework and disabling multicast of the cluster framework; configuring the service discovery policy and related parameters for the execution of the service discovery policy for the cluster framework.

[0020] In this technical solution, the specific steps for configuring the cluster framework according to the service discovery strategy include: First, enabling the service discovery switch in the Hazelcast cluster and disabling multicast in the Hazelcast cluster, that is, informing the Hazelcast cluster to start executing the service discovery strategy; further, configuring the service discovery strategy based on Redis, and configuring the relevant parameters for executing the service discovery strategy. These parameters may include the Redis address, Redis port, Redis authentication password, Redis database, node information registry, node information maintenance and update interval, and node information expiration time.

[0021] In any of the above technical solutions, the step of starting the monitoring thread to maintain the information of the first node after registration specifically includes: obtaining the current node and the current node information; if the current node information is the first node information, then performing periodic information updates according to the relevant parameters executed by the service discovery strategy; if the current node information is not the first node information, then clearing the information and disconnecting the service discovery strategy connection according to the last maintenance time of the current node and the relevant parameters executed by the service discovery strategy.

[0022] In this technical solution, the steps of starting the monitoring thread to maintain the information of the first node after registration specifically include: obtaining the current node and current node information of the current application; further, comparing the current node information with the first node information; if the current node information is the first node information, then periodically updating the node information according to the node information maintenance and update interval in the relevant parameters of the service discovery strategy; if the current node information is not the first node information, then clearing the node information and releasing the Redis connection according to the last maintenance time of the current node and the node information expiration time in the relevant parameters, that is, removing the current application from the cluster. Furthermore, the monitoring thread periodically polls and executes according to the relevant parameters of the service discovery strategy. This achieves dynamic adjustment of node information.

[0023] In any of the above technical solutions, the application cluster formation method further includes: in response to the shutdown of the second application, obtaining the second node and the second node information; initiating a node information deregistration request to the service discovery policy based on the second node information; and disconnecting the service discovery policy from the second node.

[0024] In this technical solution, the application cluster construction method further includes: when the second application is shut down, i.e. when the node exits normally, a destruction phase is triggered. In this phase, the second node and its information are first obtained. Then, a node information deregistration request is sent to the service discovery policy to delete the second node information from the node information registry in the service discovery policy. Finally, the connection resources of the service discovery policy are released to disconnect the second node from the cluster.

[0025] According to a second aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the application cluster assembly method as described above.

[0026] The computer device provided by the present invention, when the processor executes the computer program, implements the steps of the above-mentioned document processing method, and can achieve the technical effects of the above-mentioned application cluster construction method, which will not be elaborated further.

[0027] According to a third aspect of the present invention, a computer-readable storage medium is provided on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the application cluster assembly method as described above.

[0028] The computer-readable storage medium provided by this invention enables the computer program to implement the steps of the above-described document processing method when executed by a processor, and can achieve the technical effects of the above-described application cluster construction method, which will not be elaborated further.

[0029] Additional aspects and advantages of the invention will become apparent in the following description or may be learned by practice of the invention. Attached Figure Description

[0030] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0031] Figure 1 A flowchart illustrating an embodiment of the application cluster building method of the present invention is shown;

[0032] Figure 2 A flowchart illustrating an application cluster building method according to another embodiment of the present invention is shown;

[0033] Figure 3 A flowchart illustrating another embodiment of the application cluster building method of the present invention is shown;

[0034] Figure 4 A flowchart illustrating another embodiment of the application cluster building method of the present invention is shown;

[0035] Figure 5 A flowchart illustrating another embodiment of the application cluster building method of the present invention is shown;

[0036] Figure 6 A flowchart illustrating another embodiment of the application cluster building method of the present invention is shown;

[0037] Figure 7 A flowchart illustrating another embodiment of the application cluster building method of the present invention is shown;

[0038] Figure 8 A system block diagram of an application cluster building method according to an embodiment of the present invention is shown. Detailed Implementation

[0039] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments of the present invention and the features thereof can be combined with each other.

[0040] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.

[0041] An embodiment of the first aspect of the present invention proposes a method for building application clusters. Figure 1 A flowchart illustrating an embodiment of the application cluster building method of the present invention is shown. The method includes:

[0042] Step 102: In response to the startup of the first application, obtain the first node and its information, and establish a connection between the first node and the service discovery strategy;

[0043] Step 104: Initiate a node information registration request to the service discovery strategy based on the first node information;

[0044] Step 106: Obtain the node information registry in the service discovery policy;

[0045] Step 108: Determine the identity of the first node based on the first node information and the node information registry;

[0046] Step 110: Build a cluster based on the identity of the first node.

[0047] The application cluster construction method provided by this invention is mainly used for establishing a Hazelcast cluster. After the first application starts, a registration phase is first executed to obtain the first node and its information, and a connection is established with the service discovery strategy. This connects the service discovery strategy with the first application. Service discovery refers to using a registry center to record information about all services in the distributed system, so that other services can quickly find these registered services. Further, such as... Figure 8 As shown, in this invention, the service discovery strategy is based on Redis. A node information registration request is initiated to the service discovery strategy based on the first node information, adding the first node information to the node information registry within the service discovery strategy. Further, the node information registry is retrieved from the service discovery strategy, and the identity of the first node is determined based on the first node information and the contents of the node information list. Finally, a cluster is formed based on the identity of the first node. Thus, the application cluster is formed, where node H can be the first node.

[0048] The application cluster building method provided by this invention implements a service discovery strategy based on Redis, successfully building a Hazelcast application cluster in a cloud environment and achieving the goal of providing unified external services. It also changes the predicament of being unable to build a cluster due to environmental changes, meeting the cluster building capabilities that cloud-era applications should possess. Furthermore, this method is compatible with native, public cloud, private cloud, and customized deployments, promoting the unification of cluster building methods for various environments, greatly reducing system maintenance costs, and improving efficiency and customer satisfaction.

[0049] Figure 2 A flowchart illustrating an embodiment of the application cluster construction method of the present invention is shown. Specifically, the step of determining the identity of the first node based on the first node information and the node information registry includes:

[0050] Step 202: If the registry contains only the information of the first node, then the identity of the first node is the master node;

[0051] Step 204: If the registry contains information about other nodes, then the first node is identified as a slave node.

[0052] In this embodiment, the step of determining the identity of the first node based on the first node information and the node information registry specifically includes: if the node information registry only contains the first node's own information, then the first node will elect itself as the master node; if the node information registry contains information on other nodes besides the first node's information, then the first node will join the cluster as a slave node. The identity of the first node in forming the cluster is determined by comparing the first node information with the contents of the node information registry.

[0053] Figure 3 A flowchart illustrating an embodiment of the application cluster building method of the present invention is shown. The step of building the cluster based on the identity of the first node specifically includes:

[0054] Step 302: Based on the identity of the first node, become the master node and maintain the cluster through the master node;

[0055] Step 304: Based on the identity of the first node as a slave node, the slave node sends a join request to the cluster, which is then reviewed by the master node.

[0056] In this embodiment, the steps of forming a cluster based on the identity of the first node specifically include: if the first node is the master node in the cluster, then the first node is responsible for maintaining the cluster and managing other nodes in the cluster; if the first node is a slave node, then the first node needs to send a join request to the cluster, and the master node will review and decide whether to agree to let the first node join the cluster.

[0057] like Figure 8 As shown, in one embodiment of the present invention, after the step of initiating node information registration with the service discovery strategy based on the first node information, the method further includes: starting a monitoring thread to maintain the registered first node information.

[0058] In this embodiment, after the step of registering node information with the service discovery policy based on the first node information, the method further includes: after the first node information is registered with the service discovery policy, a monitoring thread is started to monitor and maintain the registered first node information, so as to dynamically allocate nodes.

[0059] Figure 4 A flowchart illustrating an embodiment of the application cluster construction method of the present invention is shown. Prior to the steps of obtaining a first node and its information, and creating a connection between the first node and the service discovery strategy, the method includes:

[0060] Step 402: Connect the service provider interface of the cluster framework to the service discovery strategy;

[0061] Step 404: Configure the cluster framework according to the service discovery policy.

[0062] In this embodiment, before the steps of obtaining the first node and its information, and establishing a connection between the first node and the service discovery strategy, the following steps are included: Since Hazelcast provides an SPI extension mechanism that allows enterprises to implement their own service discovery strategies and supports adaptation to Hazelcast to build clusters, the service provider interface of the cluster framework is connected to the service discovery strategy, i.e., the SPI is configured.

[0063] Specifically, according to the SPI definition, the specific implementation of SPI is configured in the "META-INF / services" directory within the project's JAR file. The service discovery strategy file is named "Hazelcast DiscoverySPI," and "com.hazelcast.spi.discovery.DiscoveryStrategyFactory" is the service discovery SPI interface exposed by Hazelcast, serving as the entry point for adapting the service discovery strategy to Hazelcast in this invention. This file contains the implementation of this interface, specifically the strategy factory configured in this invention. The strategy factory refers to the specific process of creating a discovery strategy, creating a concrete discovery strategy based on the declared SPI service. This connects the service discovery strategy to the SPI interface in Hazelcast, thereby establishing a connection between the service discovery strategy and the Hazelcast cluster, enabling the Hazelcast cluster to find the service discovery strategy implemented based on Redis.

[0064] Furthermore, by configuring the Hazelcast cluster configuration file according to the service discovery strategy, the Hazelcast cluster can be built according to the configuration in the service discovery strategy.

[0065] Figure 5 A flowchart illustrating an embodiment of the application cluster construction method of the present invention is shown. Specifically, the step of configuring the cluster framework according to a service discovery strategy includes:

[0066] Step 502: Enable the service discovery switch in the cluster framework and disable multicast in the cluster framework;

[0067] Step 504: Configure the service discovery policy and related parameters for the execution of the service discovery policy in the cluster framework.

[0068] In this embodiment, the steps for configuring the cluster framework according to the service discovery policy specifically include: First, enabling the service discovery switch in the Hazelcast cluster and disabling multicast in the Hazelcast cluster, that is, informing the Hazelcast cluster to start executing the service discovery policy; further, configuring the Hazelcast cluster with a service discovery policy based on Redis, and configuring the parameters related to the execution of the service discovery policy. These parameters may include the Redis address, Redis port, Redis authentication password, Redis library, node information registry, node information maintenance and update interval, and node information expiration time, etc.

[0069] The specific parameters are explained below:

[0070] ${redis_host}: Redis address;

[0071] ${redis_port}: The Redis port;

[0072] ${redis_auth}: Redis authentication password;

[0073] ${redis_select}: The Redis library;

[0074] ${discovery_registry}: Node information registry;

[0075] ${discovery_interval}: The interval for maintaining and updating node information;

[0076] ${discovery_timeout}: The expiration time of node information.

[0077] Using the code above, by writing the various parameters through a computer program, the relevant parameters for executing the service discovery strategy can be configured into the Hazelcast cluster, thereby enabling the execution of the relevant parameters when building the Hazelcast cluster.

[0078] Figure 6 A flowchart illustrating an embodiment of the application cluster construction method of the present invention is shown. The step of starting the monitoring thread to maintain the information of the first registered node specifically includes:

[0079] Step 602: Obtain the current node and its information;

[0080] Step 604: Based on the fact that the current node information is the first node information, the information is updated periodically according to the relevant parameters executed by the service discovery strategy;

[0081] Step 606: If the current node information is not the first node information, then clear the information and disconnect the service discovery policy connection according to the last maintenance time of the current node and the relevant parameters of the service discovery policy execution.

[0082] In this embodiment, the step of starting the monitoring thread to maintain the first node information after registration specifically includes: obtaining the current node and current node information of the current application; further, comparing the current node information with the first node information; if the current node information is the first node information, then periodically updating the node information according to the node information maintenance update interval in the relevant parameters of the service discovery strategy; if the current node information is not the first node information, then clearing the node information and releasing the Redis connection according to the last maintenance time of the current node and the node information expiration time in the relevant parameters, that is, removing the current application from the cluster. Furthermore, the monitoring thread periodically polls and performs maintenance work according to the relevant parameters of the service discovery strategy. This achieves dynamic adjustment of node information.

[0083] Figure 7 A flowchart illustrating an embodiment of the application cluster building method of the present invention is shown. The application cluster building method further includes:

[0084] Step 702: In response to the second application closing, obtain the second node and its information;

[0085] Step 704: Initiate a node information deregistration request to the service discovery policy based on the second node information;

[0086] Step 706: The service discovery policy disconnects from the second node.

[0087] In this embodiment, the application cluster building method further includes: when the second application is shut down, i.e., when the node exits normally, a destruction phase is triggered. In this phase, the second node and its information are first obtained, and further, such as... Figure 8 As shown, a node information deregistration request is initiated to the service discovery policy, deleting the second node's information from the node information registry in the service discovery policy; furthermore, the service discovery policy connection resources are released, disconnecting the second node from the cluster. This achieves the disbanding of the application cluster.

[0088] The application cluster construction method provided in this invention is a Hazelcast cluster construction method based on the Redis service discovery strategy, and is an extended implementation of Hazelcast service discovery. Hazelcast officially provides the SPI extension mechanism, allowing enterprises to implement their own service discovery strategies and support adaptation to Hazelcast for cluster construction. The enterprise's own service discovery strategy is a service discovery strategy implemented based on Redis.

[0089] First, the service provider interface of the cluster framework is connected to the service discovery strategy. Specifically, the SPI in the Hazelcast cluster is configured. According to the SPI definition, the user configures the specific implementation of the SPI in the "META-INF / services" directory of the project's JAR file. The file name for the Redis-based service discovery strategy can be "Hazelcast Discovery SPI". "com.hazelcast.spi.discovery.DiscoveryStrategyFactory" is the service discovery SPI interface exposed by Hazelcast and serves as the entry point for the service discovery strategy to adapt to Hazelcast. This file contains the implementation of this interface, and here, the strategy factory for the service discovery strategy is configured. The strategy factory refers to the specific process of creating a discovery strategy, creating a specific discovery strategy based on the declared SPI service. In other words, this invention enables the Hazelcast cluster to discover service discovery strategies by configuring the SPI.

[0090] Furthermore, the cluster framework is configured according to the service discovery strategy, specifically the Hazelcast cluster configuration file. This configuration file mainly includes the following parts: First, enabling the service discovery switch and disabling multicast instructs the Hazelcast cluster to execute the user-provided service discovery strategy. Second, configuring the Redis-based service discovery strategy and related parameters for its execution, such as Redis connection information and registry information. This completes the configuration of the service discovery strategy for the cluster.

[0091] Furthermore, as the application is deployed and started, service discovery and cluster building begin. The service discovery strategy is divided into three phases, which are executed at different times. In response to the startup of the first application, Hazelcast node instantiation is performed. The registration phase is executed first. In this phase, the first node and its information are obtained, and a connection between the first node and Redis is created. Then, a node information registration request is sent to Redis based on the first node information.

[0092] Furthermore, after registration is complete, a monitoring thread is started to monitor and maintain the information of the first node after registration. Specifically, the monitoring thread's work involves periodically polling according to the relevant parameters in the service discovery strategy: obtaining the currently executing node and its information, comparing it with the first node. If the current node information matches the first node information, the node information will be updated periodically according to the update time configured in the service discovery strategy parameters; otherwise, the information will be cleared and the Redis connection released based on the current node's last maintenance time and registration information expiration time. This achieves dynamic adjustment of nodes.

[0093] Further, after completing the registration phase, the discovery phase, i.e., cluster setup, is executed. In this phase, the node information registry is first retrieved from Redis, all node information is parsed, and the existing node list is informed to Hazelcast. The first node determines its role in cluster setup based on the node list. This includes: if the node information registry only contains the first node's information, the first node will elect itself as the master node and be responsible for maintaining and building the cluster; if the node information registry contains information for other nodes besides the first node, the first node will join the cluster as a slave node, subject to approval by the master node. This completes the application cluster setup.

[0094] Furthermore, when a node exits normally, the Hazelcast node instance will be destroyed. That is, when the second application leaves the cluster, firstly, the second node and its information are obtained, then a node information unregistration request is sent to Redis, and finally the Redis connection resources are released, so that the second application leaves the cluster.

[0095] The application cluster building method provided by this invention implements a service discovery strategy based on Redis, successfully building a Hazelcast application cluster in a cloud environment and achieving the goal of providing unified external services. It also changes the predicament of being unable to build a cluster due to environmental changes, meeting the cluster building capabilities that cloud-era applications should possess. Furthermore, this method is compatible with native, public cloud, private cloud, and customized deployments, promoting the unification of cluster building methods for various environments, greatly reducing system maintenance costs, and improving efficiency and customer satisfaction.

[0096] A second aspect of the present invention provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the application cluster assembly method as described above. The computer device provided by the present invention, in which the processor executes the computer program to implement the steps of the above-described application cluster assembly method, can achieve the technical effects of the above-described document processing method, and will not be elaborated further.

[0097] A third aspect of the present invention provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the application cluster assembly method as described above. The computer-readable storage medium provided by the present invention, in which the computer program, when executed by a processor, implements the steps of the above-described application cluster assembly method, can achieve the technical effects of the above-described application cluster assembly method, and will not be elaborated further.

[0098] In the description of this specification, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance, unless otherwise expressly specified and limited. The terms "connection," "installation," and "fixing," etc., should be interpreted broadly. For example, "connection" can mean a fixed connection, a detachable connection, or an integral connection; it can mean a direct connection or an indirect connection through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0099] In the description of this specification, the terms "one embodiment," "some embodiments," "specific embodiment," etc., refer to a specific feature, structure, material, or characteristic described in connection with that embodiment or example, which is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0100] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An application cluster setup method, characterized by, The application comprises the following steps: In response to the first application starting, the first node and the first node information are acquired, and the connection between the first node and the service discovery strategy is created; A node information registration request is initiated to the service discovery strategy according to the first node information; The node information registration table is acquired in the service discovery strategy; The identity of the first node is determined according to the first node information and the node information registration table; The cluster is formed according to the identity of the first node; The service discovery strategy is realized based on Redis; Before the step of acquiring the first node and the first node information and creating the connection between the first node and the service discovery strategy, the following steps are further included: The service provider interface of the cluster framework is connected with the service discovery strategy; The cluster framework is configured according to the service discovery strategy; The step of configuring the cluster framework according to the service discovery strategy specifically comprises the following steps: The service discovery switch of the cluster framework is turned on, and the multicast of the cluster framework is turned off; The service discovery strategy and the related parameters executed by the service discovery strategy are configured to the cluster framework; The related parameters include the Redis address, the Redis port, the Redis authentication password, the Redis library, the node information registration table, the node information maintenance update interval and the node information expiration time.

2. The method of claim 1, wherein, The step of determining the identity of the first node according to the first node information and the node information registration table specifically comprises the following steps: If the node information registration table only contains the first node information, the identity of the first node is the master node; If the node information registration table contains other node information, the identity of the first node is the slave node.

3. The method of claim 1 or 2, wherein, The step of forming the cluster according to the identity of the first node specifically comprises the following steps: If the identity of the first node is the master node, the cluster is maintained by the master node; If the identity of the first node is the slave node, the slave node sends a join request to the cluster, and the master node audits the join request.

4. The method of claim 1, wherein the application cluster is formed by a cluster of applications. After the step of initiating the node information registration to the service discovery strategy according to the first node information, the following steps are further included: The monitoring thread is started to maintain the registered first node information.

5. The method of claim 4, wherein, The step of starting the monitoring thread to maintain the registered first node information specifically comprises the following steps: The current node and the current node information are acquired; If the current node information is the first node information, the information is periodically updated according to the related parameters executed by the service discovery strategy; If the current node information is not the first node information, the information is cleared and the connection with the service discovery strategy is disconnected according to the last maintenance time of the current node and the related parameters executed by the service discovery strategy.

6. The method of claim 1, wherein, The application further comprises the following steps: In response to the second application closing, the second node and the second node information are acquired; A node information deregistration request is initiated to the service discovery strategy according to the second node information; The service discovery strategy is disconnected with the second node.

7. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The computer program is executed by the processor to implement the steps of the application cluster group building method according to any one of claims 1 to 6.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the application cluster group building method according to any one of claims 1 to 6.