CN113094074A - Service cluster updating method and device - Google Patents
Service cluster updating method and device Download PDFInfo
- Publication number
- CN113094074A CN113094074A CN202110499647.3A CN202110499647A CN113094074A CN 113094074 A CN113094074 A CN 113094074A CN 202110499647 A CN202110499647 A CN 202110499647A CN 113094074 A CN113094074 A CN 113094074A
- Authority
- CN
- China
- Prior art keywords
- server
- service
- identity information
- data storage
- service cluster
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 56
- 238000013500 data storage Methods 0.000 claims abstract description 183
- 230000006870 function Effects 0.000 description 13
- 230000008859 change Effects 0.000 description 11
- 238000010586 diagram Methods 0.000 description 7
- 230000004048 modification Effects 0.000 description 7
- 238000012986 modification Methods 0.000 description 7
- 230000003993 interaction Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000004590 computer program Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000005012 migration Effects 0.000 description 2
- 238000013508 migration Methods 0.000 description 2
- 230000000737 periodic effect Effects 0.000 description 2
- 241000412611 Consul Species 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000011038 discontinuous diafiltration by volume reduction Methods 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The application provides an updating method and device of a service cluster, which are used for solving the problem of low flexibility of the existing cluster updating method for manually modifying configuration files. The method comprises the following steps: when a first server of a service end starts to join a service cluster, registering the identity information of the first server to a data storage node, wherein the data storage node is used for storing the identity information of the server of the service end included in the service cluster; a first server of a service end acquires and stores identity information of servers of the service end included in a service cluster from a data storage node; and when the first server of the server determines that the server of the server included in the service cluster changes, updating the stored identity information of the server according to the identity information of the server included in the service cluster, which is stored by the data storage node.
Description
Technical Field
The present application relates to the field of cloud technology services, and in particular, to an update method and apparatus for a service cluster.
Background
At present, various open-source micro-service registration centers exist in the market, for example, Eureka, cosul and the like, realize registration and management functions of micro-services, and are divided into two parts, namely a server and a client. The server is mainly used for registering and storing registration information for providing services and providing a service registry. The client is divided into a service provider and a service consumer, the service provider is responsible for registering the service of the client to the server, and the service consumer is responsible for pulling the service registry from the server and consuming the service.
The existing method for deploying the cluster in the registry is a cluster deployment method based on a configuration file, and each node in the cluster deploys each node according to node address information configured in advance in the configuration file, so that the cluster is formed. However, if the nodes in the cluster are changed by migration, replacement, scaling, etc., the configuration file of each node in the cluster needs to be modified manually, and the configuration files of all the clients also need to be updated. Therefore, the method for updating the cluster statically reduces the flexibility of the whole micro-service cluster and is contrary to the current mainstream stateless cloud service concept.
Disclosure of Invention
The embodiment of the application provides an updating method and device of a service cluster, which are used for updating node information in the cluster in real time and improving the flexibility of cluster deployment.
In a first aspect, an embodiment of the present application provides an update method for a service cluster, including:
when a first server of a service end starts to join a service cluster, registering self identity information to a data storage node, wherein the data storage node is used for storing the identity information of the server of the service end included in the service cluster;
the first server acquires and stores the identity information of the server side included in the service cluster from the data storage node;
and when the first server determines that the server of the server included in the service cluster changes, updating the stored identity information of the server according to the identity information of the server included in the service cluster, which is stored by the data storage node.
Based on the scheme, the first server registers the identity information of the first server into the data storage node, and the server of the server side included in the service cluster is served and stored in the data storage node to form the service cluster. And under the condition that the server of the server stored in the data storage node is updated, the updated content can be timely acquired and the identity information of the server stored by the data storage node can be synchronously updated. The automatic updating of the service cluster is realized, the updating of the service cluster is not required to be realized by manually modifying the configuration file, the flexibility of cluster deployment and updating is improved, and the manual workload is reduced. After the service cluster is automatically updated, the first server can share the information of the client stored by the first server to other servers in the cluster, so that the service cluster can better provide services.
In a second aspect, an embodiment of the present application provides another method for updating a service cluster, including:
after a server of a client is started, acquiring and storing identity information of a server included in a service cluster from a data storage node;
the data storage node is used for storing identity information of a server side included in the service cluster;
and when the server of the client determines that the server of the server included in the service cluster changes, updating the stored identity information of the server according to the identity information of the server included in the service cluster stored by the data storage node.
Based on the scheme, the client acquires and stores the identity information of the service end node from the data storage node, and updates the information stored by the client according to the identity information of the service end node stored by the data storage node. By adopting the scheme, the service cluster is automatically updated at the client, the condition that the latest service cluster of the server exists in the client is ensured, and the server is convenient to provide service for the client.
In a third aspect, an embodiment of the present application provides a first server of a server, including:
a processor configured to perform:
when the first server starts to join a service cluster, registering the identity information of the first server to a data storage node, wherein the data storage node is used for storing the identity information of a server side included in the service cluster; acquiring identity information of a server side included in the service cluster from the data storage node;
the memory is used for storing the identity information of the server side included in the service cluster;
the processor is further configured to determine that a server of the server included in the service cluster changes, and update the stored identity information of the server according to the identity information of the server included in the service cluster stored by the data storage node.
In a possible implementation manner, when it is determined that a server of a server included in the service cluster changes, the processor is specifically configured to:
periodically acquiring a server of a server included in the service cluster from the data storage node, and determining that the server of the server included in the service cluster changes according to the acquired server of the server included in the service cluster; or,
receiving a notification message sent by the data storage node; the notification message is used for notifying that the server of the server included in the service cluster changes.
In one possible implementation manner, the processor, after registering the identity information of the first server to the data storage node, is further configured to:
periodically sending a heartbeat packet to the data storage node, wherein the heartbeat packet is used for indicating the working state of the first server.
In a possible implementation manner, the identity information of the server at the server side includes one or more of an address and a port number of the server.
In a fourth aspect, an embodiment of the present application provides a server of a client, including:
the processor is used for acquiring the identity information of the server side included in the service cluster from the data storage node after the client side is started;
the memory is used for storing the identity information of the server side included in the service cluster;
the processor is further configured to determine that a server of a server included in the service cluster changes, and update the stored identity information of the server according to the identity information of the server included in the service cluster stored by the data storage node;
the data storage node is used for storing the identity information of the server side included in the service cluster.
In a possible implementation manner, when it is determined that a server of a server included in the service cluster changes, the processor is specifically configured to:
periodically acquiring a server of a server included in the service cluster from the data storage node, and determining that the server of the server included in the service cluster changes according to the acquired server of the server included in the service cluster; or,
receiving a notification message sent by the data storage node; the notification message is used for notifying that the server of the server included in the service cluster changes.
In a possible implementation manner, the identity information of the server at the server side includes one or more of an address and a port number of the server.
In a fifth aspect, an embodiment of the present application further provides an update apparatus for a service cluster, including:
a processing unit configured to perform:
when a first server of a service end starts to join a service cluster, registering identity information of the first server to a data storage node, wherein the data storage node is used for storing the identity information of the server of the service end included in the service cluster; acquiring identity information of a server side included in the service cluster from the data storage node;
the storage unit is used for storing the identity information of the server side included in the service cluster;
the processing unit is further configured to determine that a server of the server included in the service cluster changes, and update the stored identity information of the server according to the identity information of the server included in the service cluster stored by the data storage node.
In a sixth aspect, an embodiment of the present application provides another apparatus for updating a service cluster, including:
the processing unit is used for acquiring the identity information of the server side included in the service cluster from the data storage node after the client side is started;
the storage unit is used for storing the identity information of the server side included in the service cluster;
the processing unit is further configured to determine that a server of the server included in the service cluster changes, and update the stored identity information of the server according to the identity information of the server included in the service cluster stored by the data storage node;
the data storage node is used for storing the identity information of the server side included in the service cluster.
In a seventh aspect, this application embodiment further provides a computer storage medium, in which computer program instructions are stored, and when the instructions are run on a computer, the instructions cause the computer to execute the method as recited in the first aspect.
For technical effects brought by any one implementation manner of the third aspect to the seventh aspect, reference may be made to the technical effects brought by the implementation manners corresponding to the first aspect to the second aspect, and details are not described here again.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 is a diagram of a cluster deployment system architecture of Eureka according to an embodiment of the present application;
fig. 2 is a flowchart of an updating method of an Eureka cluster according to an embodiment of the present application;
FIG. 3 is a diagram illustrating a state table according to an embodiment of the present application;
fig. 4 is an interaction process between the Eureka server and the Eureka client according to an embodiment of the present application;
fig. 5 is a schematic diagram of a service registry provided in an embodiment of the present application;
fig. 6 is a flowchart of another Eureka cluster updating method provided in an embodiment of the present application;
fig. 7 is a flowchart of a specific Eureka cluster update provided in an embodiment of the present application;
fig. 8 is a flowchart of another specific Eureka cluster update provided in the embodiment of the present application;
fig. 9A is a schematic structural diagram of a server of an Eureka server according to an embodiment of the present application;
fig. 9B is a schematic structural diagram of a server of the Eureka client according to an embodiment of the present application;
fig. 10 is a schematic diagram of an apparatus for implementing Eureka cluster update according to an embodiment of the present application.
Detailed Description
To make the objects, embodiments and advantages of the present application clearer, the following description of exemplary embodiments of the present application will clearly and completely describe the exemplary embodiments of the present application with reference to the accompanying drawings in the exemplary embodiments of the present application, and it is to be understood that the described exemplary embodiments are only a part of the embodiments of the present application, and not all of the embodiments.
All other embodiments, which can be derived by a person skilled in the art from the exemplary embodiments described herein without inventive step, are intended to be within the scope of the claims appended hereto. In addition, while the disclosure herein has been presented in terms of one or more exemplary examples, it should be appreciated that aspects of the disclosure may be implemented solely as a complete embodiment.
It should be noted that the brief descriptions of the terms in the present application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of the present application. These terms should be understood in their ordinary and customary meaning unless otherwise indicated.
The current registration center is divided into a server and a client. The server is a service cluster formed by one or more servers of the server. The server of the client registers the service of the client into the server of the server, generates a service registry in the server of the server, or acquires the service registry from the server of the server to consume the service. At present, a method for deploying a service cluster is to deploy the cluster through a configuration file, indicate addresses of servers of each server in the service cluster in the configuration file, and deploy each node according to the addresses to form the service cluster. However, if the server of the server in the service cluster changes and the cluster needs to be updated, the configuration files of the servers need to be modified manually, and the configuration files of all the clients need to be modified. Not only increases the workload of workers, but also is in violation of the current mainstream stateless cloud service concept.
In view of this, the present application provides an updating method and apparatus for a service cluster. When the server of the server side is started, the identity information of the server is registered to the data storage node, and the identity information of the servers of other server sides is obtained from the data storage node and stored to form a service cluster. When the service cluster changes, the server of the server side can directly acquire the updated identity information of the service cluster from the data storage node to update the service cluster, so that the flexibility and the robustness of the whole micro-service system are improved.
It should be noted that, the registry according to the present application may employ Eureka, consul, zookeeper technologies, etc., where the identity information of the clients stored in the servers of the servers included in the service cluster of Eureka may all be the same. In this application, a node may also be referred to as a server, and a node of a server (hereinafter, simply referred to as a server node) may also be referred to as a server of a server (hereinafter, simply referred to as a server), and a node of a client may also be referred to as a server of a client (hereinafter, simply referred to as a client). The scheme proposed in the present application is described below, taking the registration center as an example, which uses the Eureka technology. A node of the server side adopting the Eureka technology is referred to as an Eureka server-side node, and a client-side node adopting the Eureka technology is referred to as an Eureka client-side.
Referring to fig. 1, a cluster deployment system architecture diagram of Eureka is shown. The Eureka cluster deployment system shown in fig. 1 includes a service cluster formed by Eureka server nodes, it should be noted that the present application does not specifically limit the number of Eureka server nodes included in the service cluster, and in fig. 1, the service cluster includes a first Eureka server node 101 and a second Eureka server node 102 as an example. Fig. 1 also shows a system in which a first Eureka client 103 and a second Eureka client 104 are included. It should be noted that the Eureka client can be divided into two types according to functions: a service provider and a service consumer. For example, a client corresponding to a wallet function may be regarded as a service provider, a client corresponding to a payment function may be regarded as a service consumer, and a payment function as a service consumer realizes payment by calling the wallet function as a service provider. Exemplarily, in the system shown in fig. 1, the first Eureka client 103 is taken as a client for implementing a service provider function, and the second Eureka client 104 is taken as an example for implementing a service consumption function. It should be noted that fig. 1 is only an example, and the number of Eureka clients is not specifically limited in this application. The system shown in fig. 1 may further include a data storage node 105, and of course, there may be only one data storage node mentioned in this application, or there may be a plurality of data storage nodes, where a plurality of data storage nodes form a storage system, and in fig. 1, one data storage node is taken as an example for description.
In the system shown in fig. 1, the Eureka server-side node is configured to register its own identity information in the data storage node 105, for example, the identity information registered by the Eureka server-side node may include its own server address, port, or name of a service provided by itself. The Eureka service end node can also regularly access the data storage node 105, acquire and save the identity information of other Eureka service end nodes except the Eureka service end node, and can also form a service cluster with other Eureka service end nodes except the Eureka service end node.
The Eureka server node is further configured to receive identity information registered by the first Eureka client, and may store the identity information of the first Eureka client in the form of a service registry, and of course, may store the identity information of each Eureka client in another form, which is not specifically limited in this application. As is known in fig. 1, the first Eureka client is a service provider, so the first Eureka client can register information of a name of a service provided, an address of a self server, a port, etc. in the Eureka server node. The Eureka server end node may further send identity information of the first Eureka client registration to other Eureka server end nodes in the service cluster, e.g. may send a service registry to other Eureka server end nodes. The Eureka service end node is also used for receiving a request for acquiring the service registry sent by the second Eureka client and sending the service registry to the second Eureka client.
The Eureka client shown in fig. 1 may periodically access the data storage node 105, obtain identity information of the Eureka server node and store the identity information.
The data storage node 105 shown in fig. 1 is configured to receive the identity information registered by the Eureka server-side node, and may store the identity information of the Eureka server-side node in the form of a state table. In some embodiments, the data storage node 105 may further send a notification message to the Eureka client and the Eureka server-side node when the identity information of the Eureka server-side node changes, for notifying the Eureka server-side node of the service cluster that the number of Eureka server-side nodes changes, such as volume expansion, volume reduction, and the like. Further, the Eureka client and the Eureka server node can timely acquire the updated identity information of the Eureka server node included in the service cluster from the data storage node 105.
It should be noted that fig. 1 is only an example, and the number of the server node, the client node, and the data storage node is not particularly limited.
The update method of the Eureka cluster provided in the embodiment of the present application is described as follows. For convenience of description, the Eureka service end node is referred to as a service node in the following, that is, a service cluster is composed of one or more service nodes. The Eureka client is referred to as a client for short, a client for realizing a service providing function in the Eureka client is referred to as a service providing client, and a client for realizing a consumption service function in the Eureka client is referred to as a consumption service client.
Referring to fig. 2, a flowchart of an updating method for an Eureka cluster provided in an embodiment of the present application, where the flowchart of the method shown in fig. 2 is applied to an Eureka server, and the method specifically includes:
201, when a first service node starts to join a service cluster, the first service node registers its own identity information to a data storage node.
The data storage node is used for storing identity information of service nodes included in the service cluster, and one or more service nodes may be included in the service cluster. Optionally, the identity information of the service node may include information such as a name of the provided service, an address of a server corresponding to the service node, a port, or an ID of the device.
As an optional manner, after receiving the identity information of the service node included in the service cluster, the data storage node may store the identity information of the service node in the form of a table. Illustratively, the table for storing service node identity information is referred to herein as a state table. As an example, the contents of the state table can be seen in fig. 3.
202, the first service node obtains and stores the identity information of the service nodes included in the service cluster from the data storage node.
The first service node may access the data storage node after registering the identity information of the first service node, and obtain the identity information of the service node stored in the data storage node. Optionally, since the service node stored in the data storage node includes the first service node, when acquiring the identity information of the service node, the first service node may first exclude its own identity information and acquire the identity information of other service nodes except the first service node. Or, the first service node may also obtain the state table, and store the identity information of other service nodes except the first service node in the state table.
And 203, when the first service node determines that the service nodes included in the service cluster are changed, acquiring the updated identity information of the service nodes from the data storage nodes.
Optionally, the change of the service node included in the service cluster may include a change of the service node such as migration, replacement or addition of a new service node, reduction of the service node, and the like. When the first service node determines that the service node included in the service cluster changes, the first service node may obtain the identity information of the changed service node from the data storage node, and update the identity information of the service node included in the service cluster stored by the first service node. Or when the service nodes stored in the data storage node change, the data storage node updates the state table, and the first service node can access the data storage node to obtain the latest state table and update the identity information of the service nodes included in the service cluster stored in the first service node according to the content of the latest state table.
As an example, if an address of a second service node in the service nodes stored in the data storage node changes, the data storage node may update the address of the second service node in the state table, and the first service node may update the address of the second service node stored in the first service node according to the updated state table.
As another example, if a service node is added, the added service node registers its own identity information in the data storage node. The first service node can access the data storage node, acquire and store the identity information of the newly added service node, and add a new node in the self-stored service cluster.
In some embodiments, the first service node may determine that the service node included in the service cluster has changed by:
(1) the first service node may periodically access the data storage node and detect whether there is a change in the service node stored in the data storage node, for example, by setting a configuration update timer, when the configuration update timer times out, the first service node restarts the timer and accesses the data storage node, checks whether there is a change in the service node stored therein, or checks whether there is a change in the state table stored therein.
(2) When the stored service node changes, the data storage node may send a notification message to the first service node, where the notification message is used to notify the service node included in the service cluster that the service node changes. The first service node may determine that the service node included in the service cluster is changed according to the received notification message.
As an optional manner, after the first service node registers its own identity information with the data storage node, the first service node may also periodically send a heartbeat packet to the data storage node, for example, by setting a heartbeat timer, when the heartbeat timer times out, the heartbeat packet is sent to the data storage node once. The heartbeat packet is used to indicate a working state of the first service node, for example, may be used to indicate a state in which the first service node is in a normal working state or a state in which the first service node fails to work normally when a fault occurs. After the data storage node receives the heartbeat packet sent by the first service node, the state table can be updated in time. For example, if the data storage node does not receive a heartbeat packet sent by the first serving node within a period of time, the first serving node may be deleted from the state table.
In the above, the interaction between the Eureka server and the data storage node and the process of implementing the cluster update method are described with reference to the flowchart shown in fig. 2. A method for implementing cluster update on the Eureka client side will be described below. For completeness of the scheme, before describing the Eureka client to implement the cluster update method, first, the interaction between the Eureka server and the Eureka client is briefly described. Referring to fig. 4, an interactive process between a Eureka server and a Eureka client is provided for the embodiment of the present application. In the flowchart shown in fig. 4, the service cluster includes two nodes, that is, the service cluster includes only a first service node and a second service node.
401, the providing service client starts to register its own identity information to the first service node.
The identity information of the service providing client may include information such as a name of the service provided, an address of the server, and a port.
Optionally, the first service node may store the identity information of the service providing client in the form of a table, and the table for storing the identity information of the service providing client is referred to as a service registry. As an example, the contents of the service registry can be seen in fig. 5.
402, after receiving the identity information of the service providing client, the first service node sends the identity information of the service providing client to the second service node.
After receiving the identity information of the service providing client, the first service node can detect whether the current service cluster contains other service nodes, and after detecting that the service cluster contains the second service node, the first service node sends the identity information of the service providing client to the second service node.
Alternatively, the first service node may further send the service registry to the second service node.
And 403, the consumption service client acquires the identity information of the service providing client from the service node, and calls the service providing client to consume the service.
Optionally, if the consumption service client needs to consume the service, the consumption service client may access the service node, obtain the service registry, and remotely invoke the service providing client and consume the service according to the identity information of the service providing client indicated in the service registry. It should be noted that the consuming service client may access the first service node, or may also access the second service node to obtain the service registry. For example, assume that the service providing client is a server corresponding to a wallet of WeChat, and the consumption service client is a server corresponding to a payment function of WeChat. The server corresponding to the payment function can acquire the address of the server corresponding to the wallet function through the service node, and remotely call the server corresponding to the wallet through the address to complete payment.
It should be noted that fig. 4 receives the interaction between the Eureka server and the Eureka client as an example, and the number of the service nodes and the clients is not limited in an actual interaction scenario.
Above, the interaction between the Eureka server and the Eureka client is introduced. It can be known that the information of the Eureka service end node needs to be known by the Eureka client no matter when the Eureka client performs consumption service or service registration, so the Eureka client also needs to acquire the update condition of the service cluster in time so as to determine the information of the Eureka service end node. The cluster update method proposed in the present application will be described in the following. Referring to fig. 6, another Eureka cluster updating method is provided in the embodiments of the present application. The method is applied to the Eureka client, and specifically comprises the following steps:
601, after the client is started, the client acquires and stores the identity information of the service nodes included in the service cluster from the data storage node.
It should be noted that the client referred to herein may be a service providing client or a service consuming client.
The client acquires the identity information of the service node from the data storage node, or acquires a state table as shown in fig. 3 from the data storage node, where the state table indicates the identity information of the service node included in the service cluster.
And 602, when the client determines that the service node included in the service cluster is changed, the client acquires the updated identity information of the service node from the data storage node.
When the client determines that the service node included in the service cluster changes, the client can acquire the identity information of the changed service node from the data storage node and update the identity information of the service node included in the self-stored service cluster. Or, when the service node stored in the data storage node changes, the data storage node may update the state table, and the client may update the identity information of the service node stored in the client according to the latest state table.
In some embodiments, the client may determine that the service node included in the service cluster has changed in two ways:
(1) the client may periodically access the data storage node and detect whether there is a change in the service node stored in the data storage node. For example, by setting a timer, when the timer reaches a time-out, the client accesses the data storage node, checks whether there is a change in the service node stored therein, or checks whether there is a change in the state table stored therein, and restarts the timer.
(2) When the stored service node changes, the data storage node may send a notification message to the client, where the notification message is used to notify the service node included in the service cluster that the service node changes. The client may determine that the service node included in the service cluster is changed according to the received notification message.
In the following, for further understanding of the update method of the Eureka cluster proposed in the present application, reference will be made to specific embodiments.
Referring to fig. 7, a flowchart specifically implementing cluster update is provided in the embodiment of the present application. In the flowchart shown in fig. 7, the example in which three service nodes are included in the service cluster is described. For convenience of description, in this embodiment, the three service nodes are respectively referred to as a first service node, a second service node, and a third service node. The method specifically comprises the following steps:
701, a first service node starts to register the identity information of the first service node to a data storage node.
Specifically, the registration process may refer to the process shown in step 201 in fig. 2, and is not described herein again.
And after receiving the identity information of the first service node, the data storage node stores the identity information of the first service node.
The first serving node initiates sending heartbeat packets to the data storage node periodically 702.
The heartbeat packet is used for indicating the working state of the first service node.
Optionally, the first service node may set a heartbeat timer after registering the identity information of the first service node, send a heartbeat packet to the data storage node when the heartbeat timer times out, and restart the heartbeat timer. The method and the device are used for informing the working state of the first service node of the data storage node, and the data storage node can conveniently update the stored information at any time.
703, the first service node accesses the data storage node for the first time, and acquires information of other service nodes stored in the data storage node.
At this time, only the first service node registers its own identity information in the data storage node, so that only the identity information of the first service node is stored in the data storage node. Therefore, the first service node does not acquire the information of other service nodes when accessing the data storage node for the first time.
The first serving node sets 704 a configuration update timer, periodically obtaining information of other serving nodes from the data storage node.
Optionally, the first service node may set a configuration update timer after accessing the data storage node for the first time, perform re-access to the data storage node when the configuration update timer times out, and restart the configuration update timer. For convenience of description, the configuration update timer set duration is subsequently set to T1. That is, the first service node accesses the data storage node once at interval T1 to obtain other service node information.
705, the second service node starts up and registers its own identity information to the data storage node, when the time T1 is not reached.
After registering the identity information with the data storage node, the second service node may also periodically send a heartbeat packet to the data storage center, which may specifically refer to step 702, and is not described herein again.
After receiving the identity information sent by the second service node, the data storage node may store the identity information of the first service node and the second service node in the form of a table. See, for example, the state table shown in fig. 3.
And 706, the second service node accesses the data storage node for the first time to acquire the identity information of other service nodes stored in the data storage node.
Optionally, the second service node may obtain a state table stored in the data storage node, obtain and store the identity information of the first service node according to the state table, and may form a service cluster with the first service node.
Optionally, after the second service node accesses the data storage node for the first time, the second service node may also implement periodic access to the data storage node by setting a configuration update timer, and for convenience of description, the set duration of the configuration update timer set by the second service node is subsequently set to T2.
707, when the time reaches the set time T1, the first service node accesses the data storage node to obtain the identity information of the other service nodes stored in the data storage node.
The first service node acquires a state table stored in the data storage node, acquires and stores the identity information of the second service node according to the state table, and can form a service cluster together with the second service node.
The third serving node starts 708 and registers its own identity information with the data storage node.
After registering the identity information with the data storage node, the third service node may also periodically send a heartbeat packet to the data storage center, which may specifically refer to step 702, and is not described herein again.
After the data storage node receives the identity information of the third service node, the state table may be updated, and the identity information of the third service node is added to the state table.
709, the third service node accesses the data storage node for the first time, and obtains the identity information of other service nodes stored in the data storage node.
Optionally, the third service node may obtain a state table stored in the data storage node, obtain and store the identity information of the first service node and the second service node according to the state table, and may form a service cluster with the first service node and the second service node.
Optionally, after the third service node accesses the data storage node for the first time, the third service node may also implement periodic access to the data storage node by using a method of setting a configuration update timer, which is not described herein again.
710, when the time reaches the set time T2, the second service node accesses the data storage node to obtain the identity information of other service nodes stored in the data storage node.
And the second service node acquires the state table, acquires and stores the identity information of the third service node according to the state table, and adds the third service node in the service cluster. That is, at this time, the service cluster determined by the second service node includes the first service node, the second service node, and the third service node.
711, when the time reaches 2 × T1, the first service node accesses the data storage node, and acquires the identity information of other service nodes stored in the data storage node.
The first service node acquires a state table stored in the data storage node, acquires and stores the identity information of the third service node according to the state table, and adds the third service node in the service cluster. That is, at this time, the service cluster determined by the first service node includes the first service node, the second service node, and the third service node.
And at this point, the service cluster construction of the three service nodes is completed.
In the following, a method for updating a service cluster at a client side is described in a specific embodiment. Referring to fig. 8, there is shown another flow chart specifically implementing cluster updating provided by the present application. In the flowchart shown in fig. 8, it is described that two service nodes are included in the service cluster, and the two service nodes are referred to as a first service node and a second service node, respectively. The method specifically comprises the following steps:
and 801, starting a client, accessing a data storage node, and acquiring identity information of a service node included in a service cluster.
Alternatively, the identity information of the service node stored in the data storage node may be stored in the form of a state table. As an example, assuming that the state table only includes the identity information of the first service node at this time, the client accesses the data storage node, and obtains and stores the identity information of the first service node according to the state table.
And 802, the client sets a timer and periodically acquires the identity information of the service node from the data storage node.
As an alternative, the client may set a timer, and when the timer times out, the client accesses the data storage node once to determine whether the stored state table is updated, and restarts the timer. And subsequently setting the time length set by the timer as T.
803, when the time does not reach the set time T, the data storage node receives the identity information of the second service node and updates the state table.
And 804, when the time reaches the set time T, the client accesses the data storage node again to acquire the identity information of the service node included in the service cluster.
At this time, the service nodes stored in the data storage node include a first service node and a second service node. And the client accesses the data storage node, acquires and stores the identity information of the second service node according to the updated state table.
Therefore, the client acquires the latest service cluster, and can further store the latest service cluster in the memory. When a certain service node needs to be accessed, the address of the service node can be obtained according to the information stored in the memory, and the access is carried out.
Based on the same concept as the above method, as shown in fig. 9A, a first server 900A of a server is provided. The server 900A is capable of performing the various steps of the above-described method, and will not be described in detail herein to avoid repetition. The server 900A includes: a processor 901A, a memory 902A.
A processor 901A configured to perform:
when a first server starts to join a service cluster, registering identity information of the first server to a data storage node, wherein the data storage node is used for storing the identity information of a server of a service end included in the service cluster; acquiring identity information of a server side included in the service cluster from the data storage node;
a memory 902A, configured to store identity information of a server included in the service cluster;
the processor 901A is further configured to determine that a server of a server included in the service cluster changes, and update the stored identity information of the server according to the identity information of the server included in the service cluster stored by the data storage node.
In a possible implementation manner, when determining that a server of a server included in the service cluster changes, the processor 901A is specifically configured to:
periodically acquiring a server of a server included in the service cluster from the data storage node, and determining that the server of the server included in the service cluster changes according to the acquired server of the server included in the service cluster; or,
receiving a notification message sent by the data storage node; the notification message is used for notifying that the server of the server included in the service cluster changes.
In a possible implementation manner, the processor 901A, after registering the identity information of the first server to the data storage node, is further configured to:
periodically sending a heartbeat packet to the data storage node, wherein the heartbeat packet is used for indicating the working state of the first server.
In a possible implementation manner, the identity information of the server at the server side includes one or more of an address and a port number of the server.
Based on the same concept as the above method, as shown in fig. 9B, a server 900B of a client is provided. The server 900B is capable of performing the various steps of the above-described method, and will not be described in detail herein to avoid repetition. The server 900B includes: a processor 901B, and a memory 902B.
The processor 901B is configured to obtain, from the data storage node, identity information of a server included in the service cluster after the client is started;
a memory 902B, configured to store identity information of a server included in the service cluster;
the processor 901B is further configured to determine that a server of a server included in the service cluster changes, and update the stored identity information of the server according to the identity information of the server included in the service cluster stored by the data storage node;
the data storage node is used for storing the identity information of the server side included in the service cluster.
In a possible implementation manner, when determining that a server of a server included in the service cluster changes, the processor 901B is specifically configured to:
periodically acquiring a server of a server included in the service cluster from the data storage node, and determining that the server of the server included in the service cluster changes according to the acquired server of the server included in the service cluster; or,
receiving a notification message sent by the data storage node; the notification message is used for notifying that the server of the server included in the service cluster changes.
In a possible implementation manner, the identity information of the server at the server side includes one or more of an address and a port number of the server.
Based on the same concept as the method described above, as shown in fig. 10, an updating apparatus 1000 of a service cluster is provided. The apparatus 1000 is capable of performing the steps of the above-described method, and will not be described in detail herein to avoid repetition. The apparatus 1000 comprises: processing unit 1001, storage unit 1002.
In one possible scenario:
a processing unit 1001, configured to register, when a first service end node starts to join a service cluster, identity information of the first service end node to a data storage node, where the data storage node is configured to store identity information of service end nodes included in the service cluster;
the processing unit 1001 is further configured to acquire, from the data storage node, identity information of a service end node included in the service cluster;
a storage unit 1002, configured to store identity information of a service end node included in the service cluster;
the processing unit 1001 is further configured to determine that a service end node included in the service cluster changes, and update the stored identity information of the service end node according to the identity information of the service end node included in the service cluster stored by the data storage node.
In a possible implementation manner, when determining that a service end node included in the service cluster changes, the processing unit 1001 is specifically configured to:
periodically acquiring the service end nodes included in the service cluster from the data storage node, and determining that the service end nodes included in the service cluster are changed according to the acquired service end nodes included in the service cluster; or,
receiving a notification message sent by the data storage node; the notification message is used for notifying the server node included in the service cluster of the change.
In a possible implementation manner, the processing unit 1001, after registering the identity information of the first service end node with the data storage node, is further configured to:
periodically sending a heartbeat packet to the data storage node, the heartbeat packet indicating the working state of the first service end node.
In one possible implementation, the identity information of the serving end node includes at least one of the following information:
the service name, address or port number of the service end node.
In another possible scenario:
the processing unit 1001 is configured to, after the client is started, obtain identity information of a service end node included in the service cluster from the data storage node;
a storage unit 1002, configured to store identity information of a service end node included in the service cluster;
the processing unit 1001 is further configured to determine that a service end node included in the service cluster changes, and update the stored identity information of the service end node according to the identity information of the service end node included in the service cluster stored by the data storage node;
wherein, the data storage node is used for storing the identity information of the service end node included in the service cluster.
In a possible implementation manner, when determining that a service end node included in the service cluster changes, the processing unit 1001 is specifically configured to:
periodically acquiring the service end nodes included in the service cluster from the data storage node, and determining that the service end nodes included in the service cluster are changed according to the acquired service end nodes included in the service cluster; or,
receiving a notification message sent by the data storage node; the notification message is used for notifying the server node included in the service cluster of the change.
In one possible implementation, the identity information of the serving end node includes at least one of the following information:
the service name, address or port number of the service end node.
Embodiments of the present application also provide a computer-readable medium, on which a computer program is stored, which when executed by a processor implements the steps of any of the methods described above.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
While specific embodiments of the present application have been described above, it will be appreciated by those skilled in the art that these are by way of example only, and that the scope of the present application is defined by the appended claims. Various changes and modifications to these embodiments may be made by those skilled in the art without departing from the spirit and principles of this application, and these changes and modifications are intended to be included within the scope of this application. While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
Claims (10)
1. An updating method for a service cluster, comprising:
when a first server of a service end starts to join a service cluster, registering self identity information to a data storage node, wherein the data storage node is used for storing the identity information of the server of the service end included in the service cluster;
the first server acquires and stores the identity information of the server side included in the service cluster from the data storage node;
and when the first server determines that the server of the server included in the service cluster changes, updating the stored identity information of the server according to the identity information of the server included in the service cluster, which is stored by the data storage node.
2. The method of claim 1, wherein the first server determining that a server of the server included in the service cluster has changed comprises:
the first server periodically acquires the server of the server included in the service cluster from the data storage node, and determines that the server of the server included in the service cluster changes according to the acquired server of the server included in the service cluster; or,
the first server receives a notification message sent by the data storage node; the notification message is used for notifying that the server of the server included in the service cluster changes.
3. The method of claim 1, wherein after the first server registers its identity information with the data storage node, the method further comprises:
the first server periodically sends a heartbeat packet to the data storage node, wherein the heartbeat packet is used for indicating the working state of the first server.
4. The method according to any one of claims 1 to 3, wherein the identity information of the server side comprises one or more of an address and a port number of the server.
5. An updating method for a service cluster, comprising:
after a server of a client is started, acquiring and storing identity information of a server included in a service cluster from a data storage node;
the data storage node is used for storing identity information of a server side included in the service cluster;
and when the server of the client determines that the server of the server included in the service cluster changes, updating the stored identity information of the server according to the identity information of the server included in the service cluster stored by the data storage node.
6. The method of claim 5, wherein the determining, by the server of the client, that the server of the server included in the service cluster has changed comprises:
the server of the client periodically acquires the server of the server included in the service cluster from the data storage node, and determines that the server of the server included in the service cluster changes according to the acquired server of the server included in the service cluster; or,
the server of the client receives a notification message sent by the data storage node; the notification message is used for notifying that the server of the server included in the service cluster changes.
7. The method according to claim 5 or 6, wherein the identity information of the server at the server side comprises one or more of an address and a port number of the server.
8. A first server of a server, comprising:
a processor configured to perform:
when the first server starts to join a service cluster, registering the identity information of the first server to a data storage node, wherein the data storage node is used for storing the identity information of a server side included in the service cluster; acquiring identity information of a server side included in the service cluster from the data storage node;
the memory is used for storing the identity information of the server side included in the service cluster;
the processor is further configured to determine that a server of the server included in the service cluster changes, and update the stored identity information of the server according to the identity information of the server included in the service cluster stored by the data storage node.
9. A server on a client, the server comprising:
the processor is used for acquiring the identity information of the server side included in the service cluster from the data storage node after the client side is started;
the memory is used for storing the identity information of the server side included in the service cluster;
the processor is further configured to determine that a server of a server included in the service cluster changes, and update the stored identity information of the server according to the identity information of the server included in the service cluster stored by the data storage node;
the data storage node is used for storing the identity information of the server side included in the service cluster.
10. A computer-readable storage medium having stored thereon computer-executable instructions which, when invoked by a computer, cause the computer to perform the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110499647.3A CN113094074B (en) | 2021-05-07 | 2021-05-07 | Service cluster updating method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110499647.3A CN113094074B (en) | 2021-05-07 | 2021-05-07 | Service cluster updating method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113094074A true CN113094074A (en) | 2021-07-09 |
CN113094074B CN113094074B (en) | 2024-03-19 |
Family
ID=76664289
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110499647.3A Active CN113094074B (en) | 2021-05-07 | 2021-05-07 | Service cluster updating method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113094074B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114301919A (en) * | 2021-12-30 | 2022-04-08 | 百融云创科技股份有限公司 | Kubernetes-based ICE (Internet encryption and encryption Equipment) frame improvement method |
Citations (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6847993B1 (en) * | 2000-05-31 | 2005-01-25 | International Business Machines Corporation | Method, system and program products for managing cluster configurations |
US20070220323A1 (en) * | 2006-02-22 | 2007-09-20 | Eiichi Nagata | System and method for highly available data processing in cluster system |
CN103581276A (en) * | 2012-08-09 | 2014-02-12 | 北京亿赞普网络技术有限公司 | Cluster management device and system, service client side and corresponding method |
CN105245603A (en) * | 2015-10-15 | 2016-01-13 | 北京乐动卓越科技有限公司 | Cluster server control method and system |
CN105871649A (en) * | 2016-06-21 | 2016-08-17 | 上海帝联信息科技股份有限公司 | Node server, service side and configuration file updating method thereof and updating control method |
CN106302596A (en) * | 2015-06-03 | 2017-01-04 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus of service discovery |
CN108055157A (en) * | 2017-12-19 | 2018-05-18 | 北京奇艺世纪科技有限公司 | The acquisition methods and device of a kind of service node |
CN109412853A (en) * | 2018-10-31 | 2019-03-01 | 中国建设银行股份有限公司 | Distributed Services register storage method, system, device and storage medium |
CN109714358A (en) * | 2019-01-15 | 2019-05-03 | 广东工业大学 | A kind of injection molding MES cloud platform of micro services |
CN110365750A (en) * | 2019-06-25 | 2019-10-22 | 苏宁云计算有限公司 | Service registration system and method |
CN110830539A (en) * | 2018-08-14 | 2020-02-21 | 贵州白山云科技股份有限公司 | Network storage system and method |
CN110971449A (en) * | 2019-10-25 | 2020-04-07 | 武汉烽火众智数字技术有限责任公司 | Service management and control system based on micro-service architecture |
CN110971702A (en) * | 2019-12-10 | 2020-04-07 | 中国建设银行股份有限公司 | Service calling method and device, computer equipment and storage medium |
CN112311869A (en) * | 2020-10-28 | 2021-02-02 | 苏州万店掌网络科技有限公司 | Multi-type micro-service registration center management system and method |
CN112422309A (en) * | 2019-08-23 | 2021-02-26 | 阿里巴巴集团控股有限公司 | System and method for distributed service discovery, storage medium and terminal |
-
2021
- 2021-05-07 CN CN202110499647.3A patent/CN113094074B/en active Active
Patent Citations (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6847993B1 (en) * | 2000-05-31 | 2005-01-25 | International Business Machines Corporation | Method, system and program products for managing cluster configurations |
US20070220323A1 (en) * | 2006-02-22 | 2007-09-20 | Eiichi Nagata | System and method for highly available data processing in cluster system |
CN103581276A (en) * | 2012-08-09 | 2014-02-12 | 北京亿赞普网络技术有限公司 | Cluster management device and system, service client side and corresponding method |
CN106302596A (en) * | 2015-06-03 | 2017-01-04 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus of service discovery |
CN105245603A (en) * | 2015-10-15 | 2016-01-13 | 北京乐动卓越科技有限公司 | Cluster server control method and system |
CN105871649A (en) * | 2016-06-21 | 2016-08-17 | 上海帝联信息科技股份有限公司 | Node server, service side and configuration file updating method thereof and updating control method |
CN108055157A (en) * | 2017-12-19 | 2018-05-18 | 北京奇艺世纪科技有限公司 | The acquisition methods and device of a kind of service node |
CN110830539A (en) * | 2018-08-14 | 2020-02-21 | 贵州白山云科技股份有限公司 | Network storage system and method |
CN109412853A (en) * | 2018-10-31 | 2019-03-01 | 中国建设银行股份有限公司 | Distributed Services register storage method, system, device and storage medium |
CN109714358A (en) * | 2019-01-15 | 2019-05-03 | 广东工业大学 | A kind of injection molding MES cloud platform of micro services |
CN110365750A (en) * | 2019-06-25 | 2019-10-22 | 苏宁云计算有限公司 | Service registration system and method |
CN112422309A (en) * | 2019-08-23 | 2021-02-26 | 阿里巴巴集团控股有限公司 | System and method for distributed service discovery, storage medium and terminal |
CN110971449A (en) * | 2019-10-25 | 2020-04-07 | 武汉烽火众智数字技术有限责任公司 | Service management and control system based on micro-service architecture |
CN110971702A (en) * | 2019-12-10 | 2020-04-07 | 中国建设银行股份有限公司 | Service calling method and device, computer equipment and storage medium |
CN112311869A (en) * | 2020-10-28 | 2021-02-02 | 苏州万店掌网络科技有限公司 | Multi-type micro-service registration center management system and method |
Non-Patent Citations (5)
Title |
---|
DERIS: "High service reliabilty for cluster server system", 《2003 PROCEEDINGS IEEE INTERNATIONAL CONFERENCE ON CLUSTER COMPUTING》, pages 280 - 287 * |
JREBEL: "Guide to Microservices Resilience Patterns", Retrieved from the Internet <URL:https://www.jrebel.com/blog/microservices-resilience-patterns> * |
一响贪欢: "微服务Eureka使用详解", pages 1 - 6, Retrieved from the Internet <URL:https://www.cnblogs.com/yxth/p/10845640.html> * |
袁子淇: "基于ZooKeeper的集群应用配置管理的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 2016, pages 138 - 237 * |
郭绪晶: "服务器集群***高可用模块设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 2013, pages 137 - 54 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114301919A (en) * | 2021-12-30 | 2022-04-08 | 百融云创科技股份有限公司 | Kubernetes-based ICE (Internet encryption and encryption Equipment) frame improvement method |
CN114301919B (en) * | 2021-12-30 | 2024-04-05 | 百融云创科技股份有限公司 | ICE frame improvement method based on Kubernetes |
Also Published As
Publication number | Publication date |
---|---|
CN113094074B (en) | 2024-03-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11080144B2 (en) | System and method for managing blockchain nodes | |
CN109547570B (en) | Service registration method, device, registration center management equipment and storage medium | |
EP3490224B1 (en) | Data synchronization method and system | |
US7039694B2 (en) | Cluster membership monitor | |
CN111615066B (en) | Distributed micro-service registration and calling method based on broadcast | |
JP7326443B2 (en) | NF service consumer restart detection using direct signaling between NFs | |
CN107291750B (en) | Data migration method and device | |
CN107357571B (en) | Maintenance method and system for equipment component program | |
CN110377431B (en) | Service calling method and device under multi-registry scene | |
CN104601702B (en) | Cluster remote procedure calling (PRC) method and system | |
CN108769124B (en) | Application deployment method, device, server and storage medium of PaaS platform | |
CN108628716B (en) | Information receiving and managing system, method and device | |
CN111538763A (en) | Method for determining main node in cluster, electronic equipment and storage medium | |
CN110391940A (en) | Response method, device, system, equipment and the storage medium of address of service | |
CN115150419B (en) | Configuration and access method and system for hybrid cloud object storage | |
CN110881055A (en) | Micro-service processing method and device based on Redis | |
US11153173B1 (en) | Dynamically updating compute node location information in a distributed computing environment | |
CN108132807B (en) | Parameter loading method and device | |
CN113094074B (en) | Service cluster updating method and device | |
CN114553867A (en) | Cloud-native cross-cloud network monitoring method and device and storage medium | |
CN112511595B (en) | Message pushing method and message service system | |
US9525607B2 (en) | Connectivity notification | |
CN115065686B (en) | Configuration method, device and system of distributed load balancing system | |
CN112073322B (en) | Discovery method and device of network tester | |
US20230146880A1 (en) | Management system and management method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |