Application management method and device, computer equipment, readable storage medium and program product
By obtaining and storing the registration information of the target resources in the computing node of the registration center, the problem of poor data consistency in traditional technology is solved, and centralized storage and consistency management of full registration information is realized.
Patent Information
- Application Number
- CN202510286592.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-06-17
AI Technical Summary
Traditional registration centers are prone to 'brain splitting' when network failures or network partitions, resulting in poor data consistency.
By obtaining the registration information of the target resource in the computing nodes of the registration center and storing this information to an independent storage node, we ensure that all computing nodes have consistent reading and writing sources of data and avoiding data synchronization problems.
It realizes centralized storage and consistency management of full registration information, avoids split brain phenomenon in the registration center, and ensures data consistency of application management.
Smart Images

Figure CN120162385A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of distributed systems, and in particular, to an application management method, device, computer device, computer-readable storage medium, and computer program product. Background Art
[0002] With the development of distributed system technology, distributed systems use a registration center to provide dynamic registration and discovery of application services.
[0003] In traditional technologies, each node of the registration center has a storage node. After an application service provider registers a service with the registration center, the registration center determines the master node through a master election algorithm. The master node writes the instances of each application service into the storage node of the master node, and synchronizes the data of the storage nodes between the nodes through the master node. In the event of a network failure or network partition, a "split brain" phenomenon occurs, and the cluster in the registration center is divided into multiple sub-clusters that do not communicate with each other. Each sub-cluster has a master node for independent business operations, and at this time, data consistency problems will occur.
[0004] However, in current traditional technologies, the registration center uses a master election algorithm to determine the master node for application service registration, resulting in poor data consistency. Summary of the Invention
[0005] Based on this, it is necessary to provide an application management method, device, computer device, computer-readable storage medium, and computer program product for the above technical problems.
[0006] In a first aspect, the present application provides an application management method, which is applied to a registration center. The registration center includes computing nodes and storage nodes, and includes:
[0007] Responding to a registration request from a server, obtaining registration information of a target resource based on a target computing node in the computing nodes;
[0008] Storing each piece of the registration information into the storage node through each target computing node; the storage node contains all registration information.
[0009] In one embodiment, the registration information includes a unique resource name; after storing each piece of the registration information into the storage node through each target computing node, the method further includes:
[0010] Responding to a first discovery request from the server, obtaining the unique resource name of the target resource in the first discovery request;
[0011] Query the registration information corresponding to the target resource in the storage node according to the unique resource name, and feedback the registration information to the server.
[0012] In one embodiment, after storing the registration information in the storage node through each target computing node, the method further includes:
[0013] Determine a target identifier corresponding to the registration information according to a preset policy;
[0014] Store the association relationship between the target identifier and the registration information in the storage node.
[0015] In one embodiment, after storing the registration information in the storage node through each target computing node, the method further includes:
[0016] In response to a second discovery request from a client, determine a target registration information and the target identifier corresponding to the target resource in the second discovery request in the storage node;
[0017] Feedback the target registration information and the target identifier to the client.
[0018] In one embodiment, after storing the registration information in the storage node through each target computing node, the method further includes:
[0019] Receive a resource synchronization request from a client; the resource synchronization request carries a resource to be verified and a verification identifier corresponding to the resource to be verified;
[0020] Determine a target identifier corresponding to the resource to be verified in the storage node through a target computing node, and according to the matching result between the determined target identifier and the verification identifier;
[0021] If the matching result is a successful match, feedback the target identifier to the client;
[0022] If the matching result is a failed match, feedback the target identifier and the registration information corresponding to the target identifier to the client.
[0023] In a second aspect, the present application further provides an application management method, which is applied to a client and includes:
[0024] Send a second discovery request to a registration center; the registration center includes a computing node and a storage node;
[0025] Receive the registration information and the target identifier corresponding to the registration information feedback by the registration center; the registration information is stored in the storage node of the registration center;
[0026] Determine the target identifier as the verification identifier of the registration information and store the verification identifier and the registration information.
[0027] In a third aspect, the present application further provides an application management system, and the system includes:
[0028] A registration center, which includes a computing node and a storage node, and is used to respond to a registration request from a server, obtain registration information of a target resource based on a target computing node in the computing node; store each piece of the registration information into the storage node through each target computing node; the storage node contains all registration information;
[0029] A server, which is used to send a registration request to the registration center.
[0030] In one embodiment, the system further includes:
[0031] A client, which is used to send a second discovery request to the registration center; receive the registration information and the target identifier corresponding to the registration information feedback by the registration center; determine the target identifier as the verification identifier of the registration information and store the verification identifier and the registration information.
[0032] The registration center is used to, in response to a second discovery request from the client, determine the target registration information and the target identifier corresponding to the target resource in the second discovery request in the storage node; feedback the target registration information and the target identifier to the client.
[0033] In a fourth aspect, the present application further provides an application management device, and the device is applied to a registration center and includes:
[0034] A first acquisition module, which is used to, in response to a registration request from a server, obtain registration information of a target resource based on a target computing node in the computing node;
[0035] A first storage module, which is used to store each piece of the registration information into the storage node through each target computing node; the storage node contains all registration information.
[0036] In one embodiment, the registration information includes a unique resource name; the device further includes:
[0037] A second acquisition module, which is used to, in response to a first discovery request from the server, obtain the unique resource name of the target resource in the first discovery request;
[0038] A first query module, which is used to query the registration information corresponding to the target resource in the storage node according to the unique resource name and feedback the registration information to the server.
[0039] In one embodiment, the device further includes:
[0040] A first determination module, configured to determine a target identifier corresponding to the registration information according to a preset policy;
[0041] A second storage module, configured to store the association relationship between the target identifier and the registration information in the storage node.
[0042] In one embodiment, the device further includes:
[0043] A second determination module, configured to, in response to a second discovery request from a client, determine target registration information and the target identifier corresponding to a target resource in the second discovery request in the storage node;
[0044] A first feedback module, configured to feedback the target registration information and the target identifier to the client.
[0045] In one embodiment, the device further includes:
[0046] A first receiving module, configured to receive a resource synchronization request from a client; the resource synchronization request carries a resource to be verified and a verification identifier corresponding to the resource to be verified;
[0047] A third determination module, configured to determine a target identifier corresponding to the resource to be verified in the storage node through a target computing node, and according to a matching result between the determined target identifier and the verification identifier;
[0048] A second feedback module, configured to, if the matching result is a successful match, feedback the target identifier to the client;
[0049] A third feedback module, configured to, if the matching result is a failed match, feedback the target identifier and the registration information corresponding to the target identifier to the client.
[0050] In a fifth aspect, the present application further provides an application management device, which is applied to a server side and includes:
[0051] A sending module, configured to send a second discovery request to a registration center; the registration center includes a computing node and a storage node;
[0052] A second receiving module, configured to receive registration information and a target identifier corresponding to the registration information feedback by the registration center; the registration information is stored in the storage node of the registration center;
[0053] A third storage module, configured to determine the target identifier as the verification identifier of the registration information and store the verification identifier and the registration information.
[0054] In a sixth aspect, the present application further provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0055] In response to a registration request from a server, obtain registration information of a target resource based on a target computing node in the computing nodes;
[0056] Store each piece of the registration information into the storage node through each target computing node; the storage node contains all registration information.
[0057] In a seventh aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0058] In response to a registration request from a server, obtain registration information of a target resource based on a target computing node in the computing nodes;
[0059] Store each piece of the registration information into the storage node through each target computing node; the storage node contains all registration information.
[0060] In an eighth aspect, the present application further provides a computer program product, including a computer program. When the computer program is executed by a processor, the following steps are implemented:
[0061] In response to a registration request from a server, obtain registration information of a target resource based on a target computing node in the computing nodes;
[0062] Store each piece of the registration information into the storage node through each target computing node; the storage node contains all registration information.
[0063] For the above application management method, apparatus, computer device, computer-readable storage medium, and computer program product, in response to a registration request from a server, obtain registration information of a target resource based on a target computing node in the computing nodes; store each piece of the registration information into the storage node through each target computing node; the storage node contains all registration information. By using this method, the registration information of the target resource is stored by an independent storage node, so that the source of data reading and writing for each computing node is the same, realizing that all registration information is stored in a location shared by each computing node. Each computing node can directly read and write this storage node without data synchronization between computing nodes, avoiding the split-brain phenomenon in the registration center, and thus ensuring data consistency in application management in the registration center. Description of the Drawings
[0064] To more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the following will briefly introduce the drawings required for use in the description of the embodiments of the present application or the related art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0065] Figure 1 It is an application environment diagram of the application management method in an embodiment;
[0066] Figure 2 It is a schematic flowchart of the application management method applied to the registration center in an embodiment;
[0067] Figure 3 It is a schematic flowchart of the registration center responding to the first discovery request of the server in an embodiment;
[0068] Figure 4 It is a schematic flowchart of the registration center generating a target identifier and storing it in the storage node in an embodiment;
[0069] Figure 5 It is a schematic flowchart of the registration center responding to the second discovery request of the client in an embodiment;
[0070] Figure 6 It is a schematic flowchart of the registration center responding to the resource synchronization request of the client in an embodiment;
[0071] Figure 7 It is a signaling diagram of an example of the registration center responding to the resource synchronization request of the client in an embodiment;
[0072] Figure 8 It is a schematic flowchart of the application management applied to the client in an embodiment;
[0073] Figure 9 It is a structural block diagram of the application management device applied to the registration center in an embodiment;
[0074] Figure 10 It is an internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0075] In order to make the purpose, technical solutions and advantages of the present application clearer, the following further details the present application in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0076] The application management method provided by the embodiments of the present application can be applied to, for exampleFigure 1 In the application environment shown. Among them, the registration center 100 communicates with the server 200 through the network. The registration center includes a computing node 101 and a storage node 102. The storage node 102 can store the data that the registration center 100 needs to process. The storage node can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. In response to the registration request of the server 200, the registration center 100 obtains the registration information of the target resource based on the target computing node in the computing node 101; the registration center 100 stores each registration information in the storage node 102 through each target computing node 101; the storage node 102 contains the full registration information. The registration center 100 can be a distributed system architecture, including multiple computing nodes and a storage node shared by each computing node. The registration center 100 is used to manage and coordinate functions such as service discovery, service registration, and configuration management, maintain the registration information of all application services provided by the server 200 in the distributed system, and provide a communication bridge between the server and the client; the server 200 refers to an application program or microservice instance that provides services, and can be an independent unit in the distributed system, responsible for processing client requests and providing specific business logic or functions.
[0077] In an exemplary embodiment, as Figure 2 shown, an application management method is provided. Taking the registration center in Figure 1 as an example, the method includes the following steps 202 to 204. Among them:
[0078] Step 202, in response to the registration request of the server, obtain the registration information of the target resource based on the target computing node in the computing node.
[0079] Among them, the target resource can be the application service, data or message of the server. For example, the product search service, order processing service, etc. in the e-commerce system. However, only the application service cannot constitute a complete system, and related data and messages are also needed to support its operation. In the e-commerce system, data such as product information, user information, and order records are the basis for the application service to perform business processing. The product search service needs to filter and display eligible products according to the product data; the order processing service needs to complete operations such as payment and delivery according to the order data. Messages play a role in communication and coordination. In the e-commerce system, when a user places an order successfully, the order processing service can send a message to the inventory management service to notify it to reduce the inventory of the corresponding product.
[0080] In a distributed system, different components may need to call different types of resources. Registering data and messages as target resources allows other components to easily discover and call these resources. For example, a data analysis service may need to call certain data for analysis; a message processing service may need to subscribe to and process specific messages. Through a registration center, these services can quickly find the required resources and perform corresponding operations.
[0081] In the embodiments of the present application, in a distributed system, in order to ensure that the target resources in the server can be called, when the application service of the server starts, the configuration of the server changes, or the data changes, the server needs to send a registration request to the registration center. Specifically, the server can send a registration request to the registration center through an HTTP request or other communication protocols. The registration request contains the registration information of the target resources. Among them, the registration information includes the unique resource name (service name), which is the name of the application service to be written into the registration center, and this name is unique; the IP (Internet Protocol Address) address, which is the IP address or domain name of the server where the current application service is located; the port number, which is the port number used by the current application service; the Namespace, which is the grouping attribute of the registration center, that is, a logical concept used in the registration center to isolate different projects or application services, and is used for the application service to register data in the registration center; other custom metadata, for example, custom data in the Key-value format.
[0082] After the registration center receives the registration request sent by the server, a load balancer is deployed at the network entry of the registration center, which is responsible for distributing the registration request to the backend computing nodes according to the load balancing policy, that is, determining the target computing node among the computing nodes. The target computing node receives the registration request through the network listening port and parses the registration request to extract the registration information of the target resources. Optionally, the computing node can also verify the registration information to ensure the integrity and legality of the information. For example, check whether the unique resource name conforms to the specification, whether the IP address and port number are valid, etc.
[0083] Step 204, store each piece of registration information in a storage node through each target computing node.
[0084] Among them, the storage node contains all the registration information.
[0085] In the embodiments of the present application, the registration center can store each piece of registration information in a storage node through the target computing node. Since the storage node is a storage structure independent of each computing node, each computing node stores the registration information in the storage node after receiving the registration request. Therefore, the storage node in the registration center contains the registration information of all target resources.
[0086] In a specific embodiment, after the target computing node in the registration center completes parsing the registration request and obtains the registration information in the registration request, the target computing node formats the registration information into a format supported by the storage space of the storage node, such as JSON (JavaScript Object Notation), XML (Extensible Markup Language), binary format, etc. The target computing node writes the formatted registration information into the shared storage space. The storage operation can be implemented through an insert statement of a database, a write operation of a key-value store, etc.
[0087] The storage space of the storage node can be implemented through a centralized database, or a storage cluster composed of multiple storage nodes, and implemented through a distributed database, distributed cache, distributed search engine, etc., providing persistent storage capabilities, avoiding the loss of data after restart caused by storing registration information in the JVM (Java Virtual Machine) memory, and the storage cluster has an independent data consistency mechanism. For example, if the storage space of the storage node is a distributed storage system, the computing node needs to ensure that the data is synchronized in all copies, and it is implemented through the synchronization mechanism provided by the distributed storage system, such as the Raft algorithm, the Paxos algorithm, etc. At the same time, after storing the registration information, the computing node can perform a consistency check to ensure the consistency of the data. For example, the registration information in the storage space can be read and verified, or the registration information can be verified using a consistent hashing algorithm, version control, and other mechanisms.
[0088] Optionally, after successfully storing the registration information, the computing node generates a response message including registration success status information, and feeds it back to the server to notify the server of the processing result of the registration request.
[0089] In an optional embodiment, the registration center can also receive and process the registration request through different target computing nodes. Specifically, when the registration center receives the registration request, the first target computing node is determined through the load balancing strategy, and the registration request is received and parsed through the first target computing node to obtain the registration information. However, the first target computing node no longer stores the registration information, but sends the registration information to the second target computing node. The second target computing node is used to store the registration information in the storage node. By decoupling request processing and data storage, the functions of different nodes can be expanded and optimized more flexibly.
[0090] In the above application management method, the registration information of the target resource is stored through an independent storage node, so that the source of data reading and writing by each computing node is the same, realizing that all registration information is stored in a location shared by each computing node. The computing node can directly read and write this storage node without data synchronization between computing nodes, avoiding the split-brain phenomenon in the registration center, and thus ensuring the data consistency of application management in the registration center.
[0091] In an exemplary embodiment, as Figure 3 shown, the registration information includes a unique resource name; after step 204, the method further includes steps 302 to 304. Among them:
[0092] Step 302, in response to a first discovery request from the server, obtain the unique resource name of the target resource in the first discovery request.
[0093] In the embodiment of the present application, when the implementation of an application service on the server depends on other application services, when the application service is started, it is necessary to obtain the address and port information of other services it depends on in order to communicate with the application services it depends on. At this time, the server sends a first discovery request to the registration center.
[0094] In response to the first discovery request sent by the server, the registration center determines the target computing node for receiving and processing the discovery request according to the same principle as in step 202. The specific principle of determining the target computing node in the computing node will not be elaborated in this embodiment. Then, the registration center parses the first discovery request through the target computing node, obtains the unique resource name of the target resource in the first discovery request, and uses it as the basis for querying the registration information of the target resource. This unique resource name is usually an identifier that can uniquely identify a service, data, or message.
[0095] Step 304, query the registration information corresponding to the target resource in the storage node according to the unique resource name, and feedback the registration information to the server.
[0096] In the embodiment of the present application, the registration center accesses the storage node through the target computing node, and queries the registration information of the target resource in the storage node by using the extracted unique resource name. Specifically, the target computing node is responsible for processing the first discovery request of the client, but the target computing node itself does not directly store the registration information. The target computing node needs to obtain the registration information of the target service from the storage node. Furthermore, the target computing node initiates a query request to the storage node through an internal network (for example, RPC (Remote Procedure Call), API (Application Programming Interface) in HTTP (Hypertext Transfer Protocol) such as HTTP API), etc.). For example, the target computing node can query service information from the storage node through an HTTP GET request.
[0097] After receiving the query request from the target computing node, the storage node starts to search for the registration information corresponding to the unique resource name in the query request. First, the storage node searches for a record that matches the unique resource name in its internal data storage. For example, if the registration information stored in the storage node of the registration center includes field information such as the unique resource name, IP address, and port number, the storage node determines the field information such as the IP address and port number corresponding to the unique resource name and feeds it back to the target computing node. After receiving the registration information returned by the storage node, the target computing node can feed back the registration information to the server.
[0098] In this embodiment, the registration information of the target resource is centrally stored by an independent storage node, ensuring that the data sources of all computing nodes are consistent, avoiding the split-brain phenomenon caused by data synchronization problems between computing nodes, and thus ensuring the consistency and reliability of the data in the registration center.
[0099] In an exemplary embodiment, as Figure 4 shown, after step 204, the method further includes steps 402 to 404. Among them:
[0100] Step 402, determining a target identifier corresponding to the registration information according to a preset policy.
[0101] In the embodiments of the present application, after obtaining the registration information, the registration center may generate a corresponding target identifier for the registration information according to a prediction strategy as the version number of the registration information. Specifically, when a new target resource needs to be registered, the registration center will analyze the registration information of the target resource according to a preset strategy and generate a unique target identifier. The target identifier may be a string, a number, or other forms of unique identifier, which is used to uniquely identify the service or resource. The preset strategy may be to monotonically increase the generation of the target identifier corresponding to the registration information. For example, the monotonically increasing target identifier means that each time the registration information of the target resource changes, the target identifier is automatically incremented by 1 to ensure that the target identifier is always monotonically increasing.
[0102] Optionally, the preset strategy may also be to determine the target identifier according to the timestamp, that is, each time the registration information changes, the registration center obtains the current system timestamp and uses the system timestamp as the target identifier of the registration information. For example, the target identifier may be 1672531200000 (January 1, 2025 00:00:00).
[0103] Step 404, store the association relationship between the target identifier and the registration information in the storage node.
[0104] In the embodiments of the present application, after generating the target identifier, the registration center needs to establish an association relationship between the target identifier and the registration information to ensure that the corresponding registration information can be quickly searched and accessed through the target identifier later. The registration center stores the generated target identifier and its association relationship with the registration information in the storage node. The storage node is a shared data storage component for each computing node, responsible for saving all registration information and its association relationship, so that each computing node can perform read and write operations on the data in the storage node. The storage node can use a variety of data structures (such as key-value storage, database tables, etc.) and storage technologies to persistently store the registration information and its association relationship.
[0105] The target identifier is used to verify whether the registration information of the target resource in the registration center is consistent with the registration information of the target resource in the client when the client performs data synchronization.
[0106] In this embodiment, by centrally storing the association relationship between the target identifier and the registration information, it is ensured that the data sources accessed by all computing nodes are consistent, avoiding data inconsistency and split-brain phenomena. The target identifier, as a unique identifier, can quickly search and access the corresponding registration information in the storage node, and avoid the client receiving all the registration information for data synchronization when performing data synchronization, thereby reducing the bandwidth consumption of the client for data synchronization and improving the efficiency of the client for data synchronization.
[0107] In an exemplary embodiment, such as Figure 5As shown, after step 204, the method further includes steps 502 to 504. Among them:
[0108] Step 502, in response to a second discovery request from the client, determine the target registration information and target identifier corresponding to the target resource in the second discovery request at the storage node.
[0109] In an embodiment of the present application, in response to a second discovery request from the client, the registration center parses the second discovery request and extracts the target resource in the second discovery request. Among them, the target resource can be referred to by a unique resource name. The registration center accesses the storage node through the target computing node, uses the extracted unique resource name to find the corresponding target registration information in the full-scale registration information in the storage node, and determines the target identifier of the unique resource name in the storage node according to the association relationship between the unique resource name and the target identifier.
[0110] Step 504, feedback the target registration information and the target identifier to the client.
[0111] In an embodiment of the present application, after the target computing node receives the target registration information and the target identifier returned by the storage node, it organizes the target registration information and the target identifier into a format for responding to the second discovery request of the client. Furthermore, the registration center feeds back the target registration information and the target identifier to the client through the target computing node, so as to enable the client to perform communication access to the application service according to the target registration information.
[0112] In a specific embodiment, taking an application program with a microservices architecture as an example for illustration, the application program includes an order service, a payment service, and a user service. When the payment service is started, the server sends a registration request to the registration center. The registration request includes the registration information of the unique resource name "payment-service", the IP address "192.168.1.100", and the port number "8080". The registration center stores the registration information in the storage node and generates a target identifier "Payment Service - v1" according to a preset policy. When the order service needs to call the payment service, the order service client sends a second discovery request to the registration center. The request includes the target resource name "payment-service". The registration center parses the request through the target computing node and extracts the target resource name "payment-service". The registration center accesses the storage node through the target computing node to query the target registration information and target identifier related to "payment-service".
[0113] After the storage node search, the target registration information (IP: "192.168.1.100", port: "8080") and the target identifier "Payment Service - v1" are found. The storage node feeds back the target registration information and the target identifier to the target computing node, and then the target computing node feeds back the target registration information and the target identifier to the client, enabling the order service to communicate with the payment service using the obtained IP and port to complete the business logic.
[0114] In this embodiment, the storage node centrally stores all registration information and its association with the target identifier, ensuring that the data sources accessed by all computing nodes are consistent, avoiding data inconsistency and split - brain phenomena, so that after the client obtains the target registration information and the target identifier, it can quickly communicate with the services it depends on, ensuring that the registration center can accurately respond to the service discovery requests of the client.
[0115] In an exemplary embodiment, the client can synchronize the registration information of the client with the registration information of the registration center at a preset period, aiming to check whether the target resources cached locally are the latest or need to be updated. As Figure 6 shown, after step 204, the method further includes steps 602 to 608. Among them:
[0116] Step 602, receive the resource synchronization request from the client.
[0117] Among them, the resource synchronization request carries the resource to be verified and the verification identifier corresponding to the resource to be verified.
[0118] In the embodiment of the present application, after the client sends a resource synchronization request to the registration center, the registration center receives the resource synchronization request through the target computing node in the computing node, and the target computing node parses the resource synchronization request to extract the unique resource name and the verification identifier of the resource to be verified carried in the resource synchronization request. The resource to be verified can be a service, data, or other resources, and the verification identifier is used to represent the version number of the resource to be verified stored by the current client, for verifying the latest status of the resource.
[0119] Step 604, determine the target identifier corresponding to the resource to be verified in the storage node through the target computing node, and based on the matching result between the determined target identifier and the verification identifier.
[0120] In an embodiment of the present application, after the registration center receives a resource synchronization request, it processes the request through a target computing node. The target computing node is responsible for operations such as parsing the request and interacting with the storage node. The target computing node looks up the target identifier corresponding to the resource to be verified in the storage node through the unique resource name of the resource to be verified, and compares it with the verification identifier provided by the client to determine whether the registration information of the resource to be verified cached in the client matches the registration information of the resource to be verified in the registration center, that is, whether the verification identifier provided by the client is consistent with the target identifier in the registration center.
[0121] Step 606, if the matching result is a successful match, feedback the target identifier to the client.
[0122] In an embodiment of the present application, if the target identifier in the storage node is consistent with the verification identifier provided by the client, it means that the resource to be verified locally on the client is already the latest version and does not need to be updated. The registration center feeds back the target identifier to the client, and the client can continue to use the registration information cached locally.
[0123] Step 608, if the matching result is a failed match, feedback the target identifier and the registration information corresponding to the target identifier to the client.
[0124] In an embodiment of the present application, if the target identifier in the storage node is inconsistent with the verification identifier provided by the client, it means that the resource locally on the client is not the latest and needs to be updated. The registration center feeds back the target identifier and its corresponding registration information to the client. The registration information includes the latest IP address, port, etc. of the resource to be verified, so that the client can perform synchronous updates. For example, taking the resource to be verified as a certain service as an example, the original registration information of this service included three IP addresses, IP1, IP2, and IP3, which had this service. As the service load increased, the service provider updated the registration information to add IP4. Then, when the client calls this service, it can also access IP4 to communicate with the service. Therefore, when the client and the registration center perform resource synchronization, if the target identifier does not match the verification identifier, the registration center feeds back the latest registration information and the target identifier to the client together.
[0125] In a specific embodiment, as Figure 7 shown, taking the target resource as an application service as an example for illustration, the resource synchronization request is a service synchronization request, including:
[0126] Step 710, the provider of the application initiates a service registration request;
[0127] Step 711, the registration center stores the service and records the version number as 1;
[0128] Step 720, the registration center responds to the service discovery request initiated by the consumer of the application and obtains the registered service data;
[0129] Step 721, the registration center feeds back the service data and the version number to the consumer of the application;
[0130] Step 730, the consumer of the service receives the service data and the version number and stores the service data and the version number in the JVM memory;
[0131] Step 740, when the service data changes, the provider of the application initiates a new registration request to the registration center and sends the change information to the registration center;
[0132] Step 741, the registration center receives the new registration request, records the changed service data according to the change information, and automatically increments the version number by 1 to obtain the updated version number as version 2;
[0133] Step 750, the consumer of the application periodically sends a service synchronization request and passes the local version number 1;
[0134] Step 751, the registration center receives the service synchronization request. If the local version number in the service synchronization request is the same as the version number of the storage node in the registration center, it feeds back the version number as 1. At the same time, the feedback data is empty;
[0135] Step 752, after the consumer of the application receives the version number fed back by the registration center, if the returned version number is the same as the version number stored in the JVM memory, it does not update the service data;
[0136] Step 760, the consumer of the application periodically sends a service synchronization request and passes the local version number 1;
[0137] Step 761, the registration center receives the service synchronization request. If the local version number in the service synchronization request is different from the version number of the storage node in the registration center, it feeds back the version number as 2. At the same time, it feeds back the new service data;
[0138] Step 762, after the consumer of the application receives the version number fed back by the registration center, if the returned version number is different from the version number stored in the JVM memory, it updates the local service data and updates the version number to 2.
[0139] In this embodiment, by comparing the verification identifier with the target identifier, the registration center can determine whether the resources on the client side are the latest version, so as to decide whether resource synchronization is required, and additional bandwidth consumption can be reduced during the data synchronization process. When the matching is successful, only the target identifier is fed back, further reducing the data transmission volume and improving the efficiency; when the matching fails, the latest registration information is fed back to ensure that the client obtains the latest resources, strengthening the consistency of the stored data between the client side and the registration center.
[0140] In an exemplary embodiment, as Figure 8 shown, an application management method is provided. Taking the method applied to Figure 8 the client 300 in it as an example for illustration, it includes the following steps 802 to step 806. Among them:
[0141] Step 802, send a second discovery request to the registration center.
[0142] Among them, the registration center includes a computing node and a storage node. The computing node is responsible for processing requests and responses, and the storage node is responsible for storing all registration information and the target identifiers corresponding to each registration information.
[0143] In the embodiment of the present application, the client sends a second discovery request to the registration center. The second discovery request contains relevant information about the target resource to be searched, such as the unique resource name, etc.
[0144] Step 804, receive the registration information and the target identifier corresponding to the registration information fed back by the registration center.
[0145] Among them, the registration information is stored in the storage node of the registration center.
[0146] In the embodiment of the present application, after receiving the second discovery request, the registration center queries the storage node through the computing node to obtain the registration information and the target identifier corresponding to the target resource. The computing node feeds back the obtained registration information (such as IP address, port number, etc.) and the target identifier (such as version number) to the client.
[0147] Step 806, determine the target identifier as the verification identifier of the registration information and store the verification identifier and the registration information.
[0148] In the embodiment of the present application, after receiving the registration information and the target identifier, the client determines the target identifier as the verification identifier of the registration information. The verification identifier is used to mark the version or status of the registration information. The client stores the verification identifier and the registration information in the local storage for subsequent use. The storage method can be memory, file or other forms of storage.
[0149] In this embodiment, by using the target identifier as the verification identifier, the client can use this verification identifier in subsequent operations to verify whether the registration information stored locally is the latest version, ensuring the timeliness and consistency of the client resources. After the client stores the verification identifier and the registration information, it can directly use this information locally without having to send requests to the registration center every time, thus reducing the network communication overhead and improving the system response speed. By verifying the verification identifier, the transmission of the full amount of registration information during data synchronization is avoided, thereby reducing additional bandwidth consumption during the data synchronization process and ensuring that the registration information stored locally is always consistent with the registration center, thus ensuring the reliability of service calls.
[0150] In an exemplary embodiment, an application management system is provided, and the system includes:
[0151] A registration center, which includes computing nodes and storage nodes, and is used to respond to the registration request of the server, obtain the registration information of the target resource based on the target computing node in the computing nodes; store each registration information to the storage node through each target computing node; the storage node contains the full amount of registration information;
[0152] A server, which is used to send a registration request to the registration center.
[0153] In an exemplary embodiment, the system further includes:
[0154] A client, which is used to send a second discovery request to the registration center; receive the registration information and the target identifier corresponding to the registration information fed back by the registration center; determine the target identifier as the verification identifier of the registration information and store the verification identifier and the registration information;
[0155] The registration center is used to respond to the second discovery request of the client, determine the target registration information and the target identifier corresponding to the target resource in the second discovery request in the storage node; feed back the target registration information and the target identifier to the client.
[0156] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0157] Based on the same inventive concept, an embodiment of the present application further provides an application management device for implementing the above-mentioned application management method. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the application management device provided below can refer to the limitations on the application management method in the above text, and will not be repeated here.
[0158] In an exemplary embodiment, as Figure 9 shown, an application management device 900 is provided. This device 900 is applied to a registration center and includes: a first acquisition module 901 and a first storage module 902, where:
[0159] The first acquisition module 901 is configured to, in response to a registration request from a server, acquire registration information of a target resource based on a target computing node in a computing node;
[0160] The first storage module 902 is configured to store each piece of registration information to a storage node through each target computing node; the storage node contains all registration information.
[0161] In one of the embodiments, the registration information includes a unique resource name; the device 900 further includes:
[0162] A second acquisition module, configured to, in response to a first discovery request from a server, acquire the unique resource name of the target resource in the first discovery request;
[0163] A first query module, configured to query the registration information corresponding to the target resource in the storage node according to the unique resource name, and feedback the registration information to the server.
[0164] In one of the embodiments, the device 900 further includes:
[0165] A first determination module, configured to determine a target identifier corresponding to the registration information according to a preset policy;
[0166] A second storage module, configured to store the association relationship between the target identifier and the registration information in a storage node.
[0167] In one embodiment, the apparatus 900 further includes:
[0168] A second determination module, configured to, in response to a second discovery request from a client, determine a target registration information and a target identifier corresponding to a target resource in the second discovery request in a storage node;
[0169] A first feedback module, configured to feedback the target registration information and the target identifier to the client.
[0170] In one embodiment, the apparatus 900 further includes:
[0171] A first reception module, configured to receive a resource synchronization request from a client; the resource synchronization request carries a resource to be verified and a verification identifier corresponding to the resource to be verified;
[0172] A third determination module, configured to determine a target identifier corresponding to the resource to be verified in a storage node through a target computing node, and based on a matching result between the determined target identifier and the verification identifier;
[0173] A second feedback module, configured to, if the matching result is a successful match, feedback the target identifier to the client;
[0174] A third feedback module, configured to, if the matching result is a failed match, feedback the target identifier and the registration information corresponding to the target identifier to the client.
[0175] In an exemplary embodiment, an application management apparatus is provided. The apparatus is applied to a server side and includes: a sending module, a second reception module, and a third storage module, where:
[0176] The sending module is configured to send a second discovery request to a registration center; the registration center includes a computing node and a storage node;
[0177] The second reception module is configured to receive registration information and a target identifier corresponding to the registration information feedback by the registration center; the registration information is stored in the storage node of the registration center;
[0178] The third storage module is configured to determine the target identifier as a verification identifier of the registration information and store the verification identifier and the registration information.
[0179] Each module in the above application management apparatus can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in a processor in a computer device in a hardware form or be independent of the processor, or can be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the above respective modules.
[0180] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in Figure 10 . The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store registration information. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements an application management method.
[0181] Those skilled in the art can understand that Figure 10 the structure shown in is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0182] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the following steps are implemented:
[0183] In response to a registration request from the server, obtain the registration information of the target resource based on the target computing node in the computing node;
[0184] Store each registration information to the storage node through each target computing node; the storage node contains all registration information.
[0185] In an embodiment, when the processor executes the computer program, the following steps are further implemented:
[0186] In response to a first discovery request from the server, obtain the unique resource name of the target resource in the first discovery request;
[0187] Query the registration information corresponding to the target resource in the storage node according to the unique resource name, and feedback the registration information to the server.
[0188] In an embodiment, when the processor executes the computer program, the following steps are further implemented:
[0189] Determine the target identifier corresponding to the registration information according to the preset policy;
[0190] Store the association relationship between the target identifier and the registration information in the storage node.
[0191] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0192] In response to the second discovery request of the client, determine the target registration information and the target identifier corresponding to the target resource in the second discovery request in the storage node;
[0193] Feedback the target registration information and the target identifier to the client.
[0194] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0195] Receive the resource synchronization request of the client; the resource synchronization request carries the resource to be verified and the verification identifier corresponding to the resource to be verified;
[0196] Determine the target identifier corresponding to the resource to be verified in the storage node through the target computing node, and according to the matching result between the determined target identifier and the verification identifier;
[0197] If the matching result is successful, feedback the target identifier to the client;
[0198] If the matching result is failed, feedback the target identifier and the registration information corresponding to the target identifier to the client.
[0199] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0200] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0201] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0202] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logics, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.
[0203] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope recorded in this application.
[0204] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. An application management method, characterized in that: The method is applied to a registration center, the registration center includes a computing node and a storage node, and the method includes: In response to a registration request from the server, obtaining registration information of a target resource based on a target computing node among the computing nodes; Each registration information is stored in the storage node through each target computing node; the storage node contains the full amount of registration information.
2. The method according to claim 1, characterized in that The registration information includes a unique resource name; after each target computing node stores each registration information in the storage node, the method further includes: In response to the first discovery request of the server, obtaining a unique resource name of the target resource in the first discovery request; The registration information corresponding to the target resource is queried in the storage node according to the unique resource name, and the registration information is fed back to the server.
3. The method according to claim 1, characterized in that After storing each registration information in the storage node through each target computing node, the method further includes: Determine the target identifier corresponding to the registration information according to a preset strategy; The association relationship between the target identifier and the registration information is stored in the storage node.
4. The method according to claim 3, characterized in that After storing each registration information in the storage node through each target computing node, the method further includes: In response to a second discovery request from the client, determining, at the storage node, target registration information and the target identifier corresponding to the target resource in the second discovery request; The target registration information and the target identifier are fed back to the client.
5. The method according to claim 3, characterized in that: After storing each registration information in the storage node through each target computing node, the method further includes: Receive a resource synchronization request from a client; the resource synchronization request carries a resource to be checked and a check identifier corresponding to the resource to be checked; Determine, in the storage node, a target identifier corresponding to the resource to be checked, through a target computing node, and determine a matching result between the target identifier and the check identifier; If the matching result is a successful match, the target identifier is fed back to the client; If the matching result is a matching failure, the target identifier and the registration information corresponding to the target identifier are fed back to the client.
6. An application management method, characterized in that: The method is applied to a client, and the method comprises: Sending a second discovery request to a registration center; the registration center includes a computing node and a storage node; receiving the registration information fed back by the registration center and the target identifier corresponding to the registration information; the registration information is stored in a storage node of the registration center; The target identifier is determined as the verification identifier of the registration information, and the verification identifier and the registration information are stored.
7. An application management system, characterized in that: The system comprises: A registration center, the registration center includes a computing node and a storage node, and is used to respond to a registration request from a server, obtain registration information of a target resource based on a target computing node among the computing nodes; store each registration information to the storage node through each target computing node; the storage node contains the full amount of registration information; The server is used to send a registration request to the registration center.
8. The system according to claim 7, characterized in that The system further comprises: The client is used to send a second discovery request to the registration center; receive the registration information fed back by the registration center and the target identifier corresponding to the registration information; determine the target identifier as the verification identifier of the registration information and store the verification identifier and the registration information; The registration center is used to respond to the second discovery request of the client, determine the target registration information and the target identifier corresponding to the target resource in the second discovery request at the storage node; and feed back the target registration information and the target identifier to the client.
9. An application management device, characterized in that: The device comprises: A first acquisition module, configured to respond to a registration request from a server and acquire registration information of a target resource based on a target computing node among the computing nodes; The first storage module is used to store each registration information to the storage node through each target computing node; the storage node contains the full amount of registration information.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Micro-service registration center cluster and information processing method thereof
CN112087333A
Service management method and device, electronic equipment and computer readable storage medium
CN114615320A
Identification resource distributed storage method and system
CN114879903A
Node processing method, electronic equipment and computer storage medium
CN116701051A
Method for realizing synchronization of client end data and server end data
CN1852137A