CN113094074B - Service cluster updating method and device - Google Patents
Service cluster updating method and device Download PDFInfo
- Publication number
- CN113094074B CN113094074B CN202110499647.3A CN202110499647A CN113094074B CN 113094074 B CN113094074 B CN 113094074B CN 202110499647 A CN202110499647 A CN 202110499647A CN 113094074 B CN113094074 B CN 113094074B
- Authority
- CN
- China
- Prior art keywords
- service
- server
- data storage
- identity information
- node
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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 Transfer Between Computers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application provides a service cluster updating method and device, which are used for solving the problem of low flexibility of the current cluster updating method adopting manual configuration file modification. The method comprises the following steps: when a first server of a service end starts to join a service cluster, registering own 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; a first server of the server side acquires identity information of a server of the server side included in the service cluster from the data storage node and stores the identity information; 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 stored by the data storage node.
Description
Technical Field
The present disclosure relates to the field of cloud technology services, and in particular, to a method and an apparatus for updating a service cluster.
Background
At present, various open-source micro-service registries, such as Eureka, cosul and the like, exist in the market, and the registration and management functions of the micro-services are realized and are divided into a server side and a client side. The server is mainly used for providing registration of the service and storing registration information, and is used for providing a service registry. The clients are divided into service providers and service consumers, the service providers are responsible for registering own services to the service terminals, and the service consumers are responsible for pulling service registries from the service terminals and consuming the services.
The current 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 as to form the cluster. However, if the nodes in the cluster undergo migration, replacement, expansion and contraction, etc., the configuration file of each node in the cluster needs to be manually modified, and the configuration files of all clients need to be updated. Therefore, the static updating method of the cluster 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 a method and a device for updating 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 a method for updating a service cluster, including:
when a first server of a service end starts to join a service cluster, registering own identity information to a data storage node, wherein the data storage node is used for storing the identity information of a server of the service end included in the service cluster;
the first server acquires the identity information of a server side included in the service cluster from the data storage node and stores the identity information;
When the first server determines that the server of the server side included in the service cluster changes, updating the stored identity information of the server side according to the identity information of the server side included in the service cluster 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 first server is stored from the server of the server side included in the service cluster in the data storage node to form the service cluster. And under the condition that the server of the server stored by the data storage node is updated, the updated content can be timely obtained and the identity information of the server stored by the data storage node can be synchronously updated. The service cluster is automatically updated, the service cluster is not required to be updated 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 into other servers in the cluster, so that the service cluster can provide services better.
In a second aspect, an embodiment of the present application provides another method for updating a service cluster, including:
After the server of the client is started, acquiring the identity information of the server included in the service cluster from the data storage node and storing the identity information;
the data storage node is used for storing the identity information of a server side included in the service cluster;
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 server node from the data storage node, and updates the stored information according to the identity information of the server 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 at the client is ensured, and the server can conveniently 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, the identity information of the first server is registered to a data storage node, and the data storage node is used for storing the identity information of the 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;
The memory is used for storing the identity information of the server of the service end 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 in the data storage node.
In a possible implementation manner, the processor is specifically configured to, when determining that a server of a service end included in the service cluster changes:
periodically acquiring servers of the service terminals included in the service cluster from the data storage node, and determining that the servers of the service terminals included in the service cluster are changed according to the acquired servers of the service terminals 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 of the service end included in the service cluster to change.
In one possible implementation, the processor, after registering the identity information of the first server with the data storage node, is further configured to:
and 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 one possible implementation manner, the identity information of 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 included in the service cluster from the data storage node after the client is started;
the memory is used for storing the identity information of the server of the service end 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 in the data storage node;
the data storage node is used for storing identity information of a server side included in the service cluster.
In a possible implementation manner, the processor is specifically configured to, when determining that a server of a service end included in the service cluster changes:
periodically acquiring servers of the service terminals included in the service cluster from the data storage node, and determining that the servers of the service terminals included in the service cluster are changed according to the acquired servers of the service terminals 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 of the service end included in the service cluster to change.
In one possible implementation manner, the identity information of 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 updating 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 of the service end included in the service cluster;
the processing unit 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 in the data storage node.
In a sixth aspect, an embodiment of the present application provides another service cluster updating apparatus, including:
the processing unit is used for acquiring the identity information of the server included in the service cluster from the data storage node after the client is started;
the storage unit is used for storing the identity information of the server of the service end included in the service cluster;
the processing unit 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 in the data storage node;
the data storage node is used for storing identity information of a server side included in the service cluster.
In a seventh aspect, embodiments of the present application further provide a computer storage medium having stored therein computer program instructions which, when run on a computer, cause the computer to perform the method as set forth in the first aspect.
Technical effects brought about by any implementation manner of the third aspect to the seventh aspect may be referred to technical effects brought about by corresponding implementation manners of the first aspect to the second aspect, and 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 that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
Fig. 1 is a architecture diagram of a cluster deployment system of Eureka according to an embodiment of the present disclosure;
fig. 2 is a flowchart of an updating method of a Eureka cluster provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of a state table according to an embodiment of the present disclosure;
fig. 4 is an interaction process between a Eureka server and a Eureka client provided in an embodiment of the present application;
FIG. 5 is a schematic diagram of a service registry according to an embodiment of the present application;
FIG. 6 is a flowchart of another method for updating Eureka cluster according to 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 by an embodiment of the present application;
Fig. 9A is a schematic structural diagram of a server of a Eureka server provided in an embodiment of the present application;
fig. 9B is a schematic structural diagram of a server of a eurka client according to an embodiment of the present application;
fig. 10 is a schematic diagram of an apparatus for implementing a Eureka cluster update according to an embodiment of the present application.
Detailed Description
For purposes of clarity, embodiments and advantages of the present application, the following description will make clear and complete the exemplary embodiments of the present application, with reference to the accompanying drawings in the exemplary embodiments of the present application, it being apparent that the exemplary embodiments described are only some, but not all, of the examples of the present application.
Based on the exemplary embodiments described herein, all other embodiments that may be obtained by one of ordinary skill in the art without making any inventive effort are within the scope of the claims appended hereto. Furthermore, while the disclosure is presented in the context of an exemplary embodiment or embodiments, it should be appreciated that the various aspects of the disclosure may, separately, comprise a complete embodiment.
It should be noted that the brief description of the terms in the present application is only for convenience in understanding the embodiments described below, and is not intended to limit the embodiments of the present application. Unless otherwise indicated, these terms should be construed in their ordinary and customary meaning.
The current registry is divided into a server and a client. The server side is a service cluster formed by one or more servers of the server side. The server of the client registers the own service to the server of the server, and a service registry is generated in the server of the server, or the service registry is acquired from the server of the server to consume the service. At present, the service cluster deployment method adopts a configuration file to deploy the clusters, wherein the configuration file indicates the addresses of servers of all service ends in the service cluster, and all nodes are deployed according to the addresses to form the service cluster. However, if the servers of the servers in the service cluster change, the configuration files of the respective servers need to be manually modified when the cluster needs to be updated, and the configuration files of all clients also need to be modified. Not only increases the manual workload, but also is contrary to the currently mainstream stateless cloud service concept.
In view of this, the present application proposes a method and apparatus for updating a service cluster. When the server of the server is started, the identity information of the server is registered to the data storage node, and the identity information of the servers of other servers is acquired from the data storage node and stored to form a service cluster. When the service cluster changes, the server of the service end 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.
Note that, the registry referred to in the present application may employ Eureka, consul, zookeeper technology or the like, where identity information of clients stored in a server of a server included in the service cluster of Eureka may 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) 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 will be described below by taking the registration center as an example using the Eureka technology. The node of the service end adopting the Eureka technology is called as a Eureka service end node, and the client node adopting the Eureka technology is called as a Eureka client for short.
Referring to fig. 1, a cluster deployment system architecture diagram of Eureka is shown. In the service cluster including the Eurka service end nodes in the Eurka cluster deployment system shown in fig. 1, it should be noted that the number of Eurka service end nodes included in the service cluster is not specifically limited in the present application, and in fig. 1, description is given by taking an example that the service cluster includes a first Eurka service end node 101 and a second Eurka service end node 102. Also included in the system shown in fig. 1 are a first Eureka client 103 and a second Eureka client 104. 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 the wallet function may be regarded as a service provider, and a client corresponding to the payment function may be regarded as a service consumer, and the payment function as the service consumer may implement payment by calling the wallet function as the service provider. Illustratively, in the system shown in fig. 1, the first eurka client 103 is taken as a client implementing a service provider function, and the second eurka client 104 is taken as a client implementing a service consumption function as an example. It should be noted that fig. 1 is only an example, and the number of the eurka 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 or multiple data storage nodes, where a plurality of data storage nodes form a storage system, and in fig. 1, a data storage node is illustrated as an example.
In the system shown in fig. 1, the Eureka server 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 node may include its own server address, port, or name of a service provided by itself. The Eureka server node may also periodically access the data storage node 105, obtain and save identity information of other Eureka server nodes except itself, and may also form a service cluster with other Eureka server nodes except itself.
The eurka server node is further configured to receive the identity information registered by the first eurka client, and may store the identity information of the first eurka client in a service registry, or may store the identity information of each eurka client in other forms, which is not limited in this application. In fig. 1, the first Eureka client is known as a service provider, so the first Eureka client can register information of a name of a provided service, an address, a port, etc. of its own server into a Eureka service end node. The Eureka server node may also send the identity information registered by the first Eureka client to other Eureka server nodes in the service cluster, e.g., may send a service registry to other Eureka server nodes. The Eureka server node is further configured to receive a request sent by the second Eureka client to obtain the service registry, and send 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 save it.
The data storage node 105 shown in fig. 1 is configured to receive the identity information registered by the Eureka server node, and may store the identity information of the Eureka server node in the form of a state table. In some embodiments, the data storage node 105 may also send a notification message to the eurka client and the eurka server node when the identity information of the eurka server node changes, for notifying the number of the eurka server nodes of the service cluster to change, such as capacity expansion, capacity contraction, and the like of the eurka server node. And the Eureka client and the Eureka server node can timely acquire identity information of the Eureka server node included in the updated 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 specifically limited in this application.
The following describes an update method of the Eureka cluster provided in the embodiment of the present application. For ease of description, the Eureka server node will be referred to hereinafter simply as a service node, i.e. a service cluster is made up of one or more service nodes. The Eureka clients are simply referred to as clients, and clients for realizing the service providing function among the Eureka clients are referred to as service providing clients, and clients for realizing the consuming service function among the Eureka clients are referred to as consuming service clients.
Referring to fig. 2, a flowchart of a method for updating a eurka cluster provided in an embodiment of the present application, where the flowchart of the method shown in fig. 2 is applied to a eurka server, the method specifically may include:
and 201, when the first service node starts to join the service cluster, registering own identity information to the 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 can be included in the service cluster. Alternatively, the identity information of the service node may include information such as a name of the service provided, an address of a server corresponding to the service node, an ID of a port or a device, and the like.
As an alternative, after the data storage node receives the identity information of the service node included in the service cluster, the identity information of the service node may be stored in the form of a table. Illustratively, the table used to store the service node identity information is referred to herein as a state table. As an example, the contents of the state table may be seen in fig. 3.
202, the first service node obtains and stores identity information of 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 the first service node acquires the identity information of the service node, the identity information of the first service node may be first excluded, and the identity information of other service nodes except the first service node may be acquired. Alternatively, the first service node may acquire the state table, and save 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 node.
Alternatively, changes to service nodes included in the service cluster may include changes to service nodes that migrate, replace or add new service nodes, reduce service nodes, and so on. When the first service node determines that the service node included in the service cluster changes, the identity information of the changed service node can be obtained from the data storage node, and the identity information of the service node included in the service cluster stored by the first service node is updated. Or when the service node stored in the data storage node changes, the data storage node can update the state table, and the first service node can access the data storage node to acquire the latest state table and update the identity information of the service node included in the service cluster stored by the first service node according to the content of the latest state table.
As an example, if the address of the second service node in the service nodes stored in the data storage node changes, the data storage node updates the address of the second service node in the state table, and the first service node updates 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 to 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 service cluster stored by the first service node.
In some embodiments, the first service node may determine that a 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 method of configuring an update timer, when the configuration update timer expires, 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 that the service node included in the service cluster changes. The first service node may determine that the service nodes included in the service cluster change according to the received notification message.
As an alternative, 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, and when the heartbeat timer expires, send a heartbeat packet to the data storage node. The heartbeat packet is used to indicate the working state of the first service node, for example, may be used to indicate a state that the first service node is in when working normally or a state that the first service node fails to work normally. After receiving the heartbeat packet sent by the first service node, the data storage node can update the state table in time. For example, if the data storage node does not receive a heartbeat packet sent by the first service node within a period of time, the first service node may be deleted from the state table.
The interaction between the Eureka server and the data storage node, and the process of implementing the cluster update method, are described above in connection with the flowchart shown in FIG. 2. The method of implementing cluster updates in the Eureka client side will be described below. For the sake of scheme integrity, before introducing the Eureka client side to implement the cluster update method, the interaction between the Eureka server side and the Eureka client side is first briefly introduced. Referring to fig. 4, an interaction process between a Eureka server and a Eureka client is provided in an embodiment of the present application. In the flowchart shown in fig. 4, the service cluster is described by taking an example that the service cluster includes two nodes, that is, the service cluster includes only a first service node and a second service node.
And 401, providing service client start-up, and registering 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, a port, and the like.
Alternatively, 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 may be seen in fig. 5.
402, after receiving the identity information of the providing service client, the first service node sends the identity information of the providing service client to the second service node.
After receiving the identity information of the providing service client, the first service node can detect whether the service cluster where the first service node is currently located contains other service nodes, and after detecting, the first service node discovers that the service cluster contains the second service node, so that the identity information of the providing service client is sent to the second service node.
Alternatively, the first service node may also send the service registry to the second service node.
403, the consuming service client obtains the identity information of the providing service client from the service node, calls the providing service client, and consumes the service.
Optionally, if the consuming service client needs to consume the service, the service node may be accessed, a service registry may be obtained, and the providing service client may be remotely invoked to consume the service according to the identity information of the providing service client indicated in the service registry. It should be noted that the consuming service client may access the first service node, or may access the second service node to obtain the service registry. For example, suppose that the serving client is a wallet-corresponding server of WeChat, and the consuming serving client is a payment function-corresponding server 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 finish payment.
It should be noted that, the interaction between the Eureka server and the Eureka client received in FIG. 4 is only an example, and the number of service nodes and clients is not limited in the actual interaction scenario.
In the above, the interactions between the Eureka server and the Eureka client are introduced. It can be known that the Eureka client needs to know the information of the Eureka server node no matter when performing consuming service or registering service, 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 server node. The cluster updating method proposed in the present application will be described further below. Referring to fig. 6, another method for updating a Eureka cluster is provided in an embodiment of the present application. The method is applied to the Eureka client and specifically comprises the following steps:
and 601, after the client is started, acquiring and storing 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 providing service client or a consuming service client.
The client may acquire the identity information of the service node from the data storage node, or may acquire 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 nodes included in the service cluster are changed, acquiring updated identity information of the service nodes from the data storage node.
When the client determines that the service node included in the service cluster changes, the identity information of the changed service node can be obtained from the data storage node, and the identity information of the service node included in the service cluster stored by the client is updated. Or when the service node stored in the data storage node changes, the data storage node can update the state table, and the client can update the identity information of the service node stored by the client according to the latest state table.
In some embodiments, the client may determine that a serving node included in the serving cluster changes by two ways:
(1) The client can 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 expires, 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 nodes change, the data storage node may send a notification message to the client, where the notification message is used to notify that the service nodes included in the service cluster change. The client may determine that a service node included in the service cluster is changed according to the received notification message.
In the following, for further understanding of the method for updating the Eureka cluster proposed in the present application, a description will be given with reference to specific embodiments.
Referring to fig. 7, a flowchart of a specific implementation of cluster update is provided in an embodiment of the present application. In the flowchart shown in fig. 7, an example is described in which three service nodes are included in a service cluster. For convenience of description, in the present embodiment, the three service nodes are referred to as a first service node, a second service node, and a third service node, respectively. The method specifically comprises the following steps:
701, the first service node is started up to register its own identity information to the data storage node.
The registration process may refer to the process shown in step 201 in fig. 2, and will not be described herein.
And after the data storage node receives the identity information of the first service node, the data storage node stores the identity information of the first service node.
The first service node initiates a periodic transmission of heartbeat packets to the data storage node 702.
The heartbeat packet is used for indicating the working state of the first service node.
Alternatively, the first service node may set a heartbeat timer after registering its own identity information, send a heartbeat packet to the data storage node when the heartbeat timer expires, and restart the heartbeat timer. The method is used for informing the working state of the first service node of the data storage node, and is convenient for the data storage node to update the stored information at any time.
The first service node accesses the data storage node for the first time 703, and obtains information of other service nodes stored in the data storage node.
Since only the first service node registers its own identity information to the data storage node at this time, only the identity information of the first service node is stored in the data storage node. The first service node does not obtain other service node information when it first accesses the data storage node.
The first service node sets 704 a configuration update timer, periodically retrieving information of other service nodes from the data storage node.
Alternatively, the first service node may set a configuration update timer after first accessing the data storage node, and when the configuration update timer expires, make a second access to the data storage node, and restart the configuration update timer. For convenience of description, the configuration update timer set period is set to T1 later. That is, the first service node accesses the data storage node once every interval time T1 to obtain other service node information.
And 705, when the time T1 is not reached, starting the second service node, and registering the identity information of the second service node to the data storage node.
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 be specifically referred to step 702, and will not be described herein.
After the data storage node receives the identity information sent by the second service node, the identity information of the first service node and the second service node can be stored in a table mode. For example, see the state table shown in fig. 3.
And 706, the second service node accesses the data storage node for the first time, and acquires the identity information of other service nodes stored in the data storage node.
Optionally, the second service node may acquire a state table stored in the data storage node, acquire identity information of the first service node according to the state table, and store the identity information, 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 set to T2.
707, when the time reaches the set time T1, the first service node accesses the data storage node, and acquires 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 second service node according to the state table, and can form a service cluster with the second service node.
The third service node is started 708 and registers its own identity information to 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 be specifically referred to step 702, and will not be described herein.
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 may be added to the state table.
709, the third service node accesses the data storage node for the first time, and obtains identity information of other service nodes stored in the data storage node.
Optionally, the third service node may acquire a state table stored in the data storage node, acquire identity information of the first service node and the second service node according to the state table, and store the identity information, 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, a method of setting the configuration update timer may also be used to implement periodic access to the data storage node, which is not described herein.
And 710, when the time reaches the set time T2, the second service node accesses the data storage node to acquire the identity information of other service nodes stored in the data storage node.
The second service node acquires a 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, the service cluster determined by the second service node at this time includes the first service node, the second service node, and the third service node.
And 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 obtains a state table stored in the data storage node, obtains 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, the service cluster determined by the first service node at this time includes the first service node, the second service node, and the third service node.
Thus, 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, another flowchart of a specific implementation of cluster update provided herein is shown. In the flow chart shown in fig. 8, an example is illustrated in which two service nodes are included in a service cluster, which are referred to as a first service node and a second service node, respectively. The method specifically comprises the following steps:
and 801, starting the client, accessing the data storage node, and acquiring the identity information of the service node included in the 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.
The client sets a timer to periodically obtain identity information of the service node from the data storage node 802.
Alternatively, the client may access the data storage node once by setting a timer, determining whether the stored state table is updated when the timer expires, and restarting the timer. The duration set by the timer is set 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, and acquires 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. The client accesses the data storage node, acquires the identity information of the second service node according to the updated state table, and stores the identity information.
So far, the client acquires the latest service cluster, and the latest service cluster can be further stored into the memory. When a certain service node needs to be accessed, the address of the service node can be acquired according to the information stored in the memory to access.
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 method described above, and will not be described in detail herein to avoid repetition. The server 900A includes: processor 901A, memory 902A.
Processor 901A configured to perform:
when a 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 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 in the data storage node.
In a possible implementation manner, the processor 901A is specifically configured to, when determining that a server of a service end included in the service cluster changes:
periodically acquiring servers of the service terminals included in the service cluster from the data storage node, and determining that the servers of the service terminals included in the service cluster are changed according to the acquired servers of the service terminals 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 of the service end included in the service cluster to change.
In one possible implementation, the processor 901A, after registering the identity information of the first server with the data storage node, is further configured to:
And 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 one possible implementation manner, the identity information of 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 method described above, and will not be described in detail herein to avoid repetition. The server 900B includes: processor 901B, 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 stored identity information of the server according to the identity information of the server included in the service cluster stored in the data storage node;
the data storage node is used for storing identity information of a server side included in the service cluster.
In a possible implementation manner, the processor 901B is specifically configured to, when determining that a server of a service end included in the service cluster changes:
periodically acquiring servers of the service terminals included in the service cluster from the data storage node, and determining that the servers of the service terminals included in the service cluster are changed according to the acquired servers of the service terminals 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 of the service end included in the service cluster to change.
In one possible implementation manner, the identity information of 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. 10, an updating apparatus 1000 of a service cluster is provided. The apparatus 1000 is capable of performing the various steps of the method described above and will not be described in detail herein in order to avoid repetition. The apparatus 1000 comprises: a processing unit 1001 and a storage unit 1002.
In one possible scenario:
a processing unit 1001, configured to register, when a first service end node initiates joining 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 the identity information of the service end node included in the service cluster;
The processing unit 1001 is further configured to obtain, 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 in the data storage node.
In a possible implementation manner, the processing unit 1001 is specifically configured to, when determining that a service end node included in the service cluster changes:
periodically acquiring service end nodes included in the service cluster from the data storage nodes, 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 service end nodes included in the service cluster of change.
In a possible implementation manner, the processing unit 1001 is further configured, after registering the identity information of the first service end node with the data storage node, to:
And periodically sending a heartbeat packet to the data storage node, wherein the heartbeat packet is used for indicating the working state of the first service end node.
In a possible implementation manner, the identity information of the server 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 obtain, from the data storage node, identity information of a server node included in the service cluster after the client is started;
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 in the data storage node;
the data storage node is used for storing identity information of a service end node included in the service cluster.
In a possible implementation manner, the processing unit 1001 is specifically configured to, when determining that a service end node included in the service cluster changes:
Periodically acquiring service end nodes included in the service cluster from the data storage nodes, 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 service end nodes included in the service cluster of change.
In a possible implementation manner, the identity information of the server node includes at least one of the following information:
the service name, address or port number of the service end node.
The embodiments of the present application also provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of any of the methods described above.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, 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 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 principles and spirit of the application, but such changes and modifications fall within the scope of the application. While 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. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various modifications and variations can 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 and the equivalents thereof, the present application is intended to cover such modifications and variations.
Claims (9)
1. A method for updating a service cluster, comprising:
when a first server of a service end starts to join a service cluster, registering own identity information to a data storage node so that the storage node stores the identity information of the server of the service end included in the service cluster;
The first server acquires the identity information of a server side included in the service cluster from the data storage node and stores the identity information;
and when the first server determines that the server of the server side included in the service cluster changes according to the notification message sent by the data storage node, updating the stored identity information of the server side according to the identity information of the server side included in the service cluster stored by the data storage node.
2. The method of claim 1, wherein the first server determines that the server of the service end included in the service cluster changes by:
the first server periodically acquires servers of the service ends included in the service cluster from the data storage node, and determines that the servers of the service ends included in the service cluster are changed according to the acquired servers of the service ends 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 the server of the service end included in the service cluster to change.
3. The method of claim 1, wherein after the first server registers its own 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. A method according to any one of claims 1-3, wherein the identity information of the server comprises one or more of an address, a port number of the server.
5. A first server of a server, comprising:
a processor configured to perform:
when the first server starts to join a service cluster, the identity information of the first server is registered to a data storage node so that the storage node stores the identity information of the 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;
the memory is used for storing the identity information of the server of the service end included in the service cluster;
the processor is further configured to determine that the server of the server included in the service cluster changes according to the notification message sent by the data storage node, 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.
6. The first server of claim 5, wherein the processor is further configured to:
the server of the service end included in the service cluster is determined to change in the following manner:
periodically acquiring servers of the service terminals included in the service cluster from the data storage node, and determining that the servers of the service terminals included in the service cluster are changed according to the acquired servers of the service terminals 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 of the service end included in the service cluster to change.
7. The first server of claim 5, wherein the processor is further configured to:
after registering the identity information of the heartbeat packet to the data storage node, periodically sending the heartbeat packet to the data storage node, wherein the heartbeat packet is used for indicating the working state of the first server.
8. A first server according to any of claims 5-7, wherein the identity information of the server side comprises one or more of an address, a port number of the server.
9. A computer readable storage medium storing computer executable instructions which, when invoked by a computer, cause the computer to perform the method of any one of claims 1-4.
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 CN113094074A (en) | 2021-07-09 |
CN113094074B true 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) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114301919B (en) * | 2021-12-30 | 2024-04-05 | 百融云创科技股份有限公司 | ICE frame improvement method based on Kubernetes |
Citations (10)
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 |
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 |
CN108055157A (en) * | 2017-12-19 | 2018-05-18 | 北京奇艺世纪科技有限公司 | The acquisition methods and device of a kind of service node |
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 |
CN112422309A (en) * | 2019-08-23 | 2021-02-26 | 阿里巴巴集团控股有限公司 | System and method for distributed service discovery, storage medium and terminal |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007226400A (en) * | 2006-02-22 | 2007-09-06 | Hitachi Ltd | Computer management method, computer management program, standby server for managing configuration of execution server, and computer system |
CN105245603B (en) * | 2015-10-15 | 2019-02-26 | 北京乐动卓越科技有限公司 | 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 |
CN109412853B (en) * | 2018-10-31 | 2022-05-17 | 中国建设银行股份有限公司 | Distributed service registration storage method, system, device and storage medium |
CN112311869B (en) * | 2020-10-28 | 2022-04-05 | 苏州万店掌网络科技有限公司 | Multi-type micro-service registration center management system and method |
-
2021
- 2021-05-07 CN CN202110499647.3A patent/CN113094074B/en active Active
Patent Citations (10)
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 |
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 |
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 |
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 |
Non-Patent Citations (3)
Title |
---|
High service reliabilty for cluster server system;Deris;《2003 Proceedings IEEE International Conference on Cluster Computing》;280-287 * |
基于ZooKeeper的集群应用配置管理的设计与实现;袁子淇;《中国优秀硕士学位论文全文数据库 信息科技辑》(第2016年01期);I138-237 * |
服务器集群系统高可用模块设计与实现;郭绪晶;《中国优秀硕士学位论文全文数据库 信息科技辑》(第2013年11期);I137-54 * |
Also Published As
Publication number | Publication date |
---|---|
CN113094074A (en) | 2021-07-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109547570B (en) | Service registration method, device, registration center management equipment and storage medium | |
CN110377431B (en) | Service calling method and device under multi-registry scene | |
US7039694B2 (en) | Cluster membership monitor | |
CN107317830B (en) | Method and device for processing service discovery | |
CN111226497A (en) | Service registration in communication networks | |
CN110311900A (en) | A service calling method, device, electronic equipment and storage medium | |
CN112882738A (en) | Configuration information updating method and device under micro-service architecture and electronic equipment | |
CN110391940B (en) | Service address response method, device, system, equipment and storage medium | |
US10110434B2 (en) | Cloud orchestrated cloud connector upgrades | |
CN106210155A (en) | The method and apparatus connecting application server | |
CN113206877A (en) | Session keeping method and device | |
CN111078238A (en) | Method and device for centralized processing of application configuration in container environment | |
CN116566984B (en) | Routing information creation method and device of k8s container cluster and electronic equipment | |
CN115349119A (en) | Method and apparatus for enhanced 5GC recovery when deploying a Network Function (NF) set in a network | |
CN113094074B (en) | Service cluster updating method and device | |
CN109274734B (en) | Service process calling method and device based on Internet of things cloud platform | |
CN114567677A (en) | Data processing method and device and nonvolatile storage medium | |
CN117459444A (en) | Method, device and storage medium for micro-service co-city dual-activity concentric priority routing | |
US20240073092A1 (en) | Deploying network functions of a network slice | |
CN112732456A (en) | Micro-service calling method and device, electronic equipment and storage medium | |
CN105991797A (en) | Method and device for network access by mobile terminal | |
US20220019380A1 (en) | Methods providing network service restoration context and related service instance sets and storage resource nodes | |
CN113626054A (en) | Business service updating method and device | |
CN102118421B (en) | Peer-to-peer network and method for restarting peer nodes | |
CN111522664A (en) | Service resource management and control method and device based on distributed service |
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 |