Registration center configuration method, device, computer equipment and storage medium
By introducing the configuration acquisition service provided by third-party devices in distributed applications, the external configuration of the registration center is realized, which solves the problem of low reliability of the registration center configuration and improves the stability and security of the system.
Patent Information
- Application Number
- CN202310301088.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-24
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2043-03-24
AI Technical Summary
In the existing technology, the registration center configuration method has the problem of low reliability. Especially under the service-oriented scale expansion and unitized architecture, the application system is highly dependent on configuration information, resulting in high transformation costs and easy production risks.
By responding to the configuration acquisition service call request of the distributed application, using the target configuration acquisition service provided by the third-party device, receiving and sending the configuration information of the registration center, the connection between the distributed application and the registration center is realized, and an externalized configuration method is adopted to decouple the configuration management of the application and the registration center.
It improves the reliability of the registration center configuration, avoids the application system's strong dependence on the registration center server address, reduces transformation costs, and reduces production risks.
Smart Images

Figure CN116647468B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a registration center configuration method, apparatus, computer equipment, storage medium, and computer program product. Background Art
[0002] With the development of the Internet, the use of microservice architecture has become a common choice in enterprise-level software development. Its purpose is to split the complete system into multiple independently deployable components, each of which is a separate service. Different service clusters are organized and managed through a registration center, and communication between services is carried out through Remote Procedure Call (RPC) technology.
[0003] RPC calls are a key way for nodes in a microservice cluster to communicate with each other. During RPC calls, the client needs to clearly know which servers are available. This process is called service registration and discovery, and the distributed registry plays a crucial role in this entire process. In microservice framework applications in related technologies, during application startup (client or server), the application's (client or server's) registry-related attribute information stored in the application configuration file must be loaded. Once the application obtains this information, it establishes a connection with the registry for subsequent service registration and discovery.
[0004] However, with the development of the Internet, the scale of service is getting larger and larger, and the deployment of registration center clusters is becoming increasingly complex, especially with the prevalence of modular architecture. Applications usually need to configure multiple registration center clusters. The configuration method in related technologies stores and loads relevant attribute information of registration. The application system is highly dependent on configuration information. If the registration center involves deployment modification, the IP address needs to be changed, the modification cost is high, and it is easy to cause production risks.
[0005] Therefore, the registration center configuration method in the related art has the problem of low reliability. Summary of the Invention
[0006] Based on this, it is necessary to provide a registration center configuration method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve the reliability of registration center configuration in order to address the above technical problems.
[0007] In a first aspect, the present application provides a registration center configuration method. The method includes:
[0008] In response to a configuration acquisition service call request sent by a distributed application under a microservice framework, determining a target configuration acquisition service for the distributed application to call;
[0009] Receiving, through the target configuration acquisition service, a configuration information acquisition request sent by the distributed application; the configuration information acquisition request is an acquisition request initiated by the distributed application for the target registration center; the configuration information acquisition request carries a target registration center identifier corresponding to the target registration center;
[0010] Acquire the configuration information of the target registry according to the target registry identifier;
[0011] The target configuration acquisition service is used to send the configuration information of the target registry to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registry.
[0012] In one embodiment, the acquiring the configuration information of the target registry according to the target registry identifier includes:
[0013] Get the configuration information of the registry center;
[0014] The target configuration acquisition service is used to query the configuration information of the target registry in the registry configuration association information according to the target registry identifier.
[0015] In one embodiment, obtaining registration center configuration association information includes:
[0016] In the startup state, sending a configuration association information acquisition request to the database; the database is used to return the configuration association information of the registration center in response to the configuration association information acquisition request;
[0017] The registration center configuration association information is received, and the registration center configuration association information is loaded into a memory.
[0018] In one embodiment, the acquiring service through the target configuration, according to the target registry identifier, querying the configuration information of the target registry in the registry configuration association information, includes:
[0019] The target configuration acquisition service is used to query the configuration information of the target registry according to the target registry identifier in the registry configuration association information stored in the memory.
[0020] In one embodiment, the registration center configuration association information includes a mapping relationship between the configuration information of the registration center and the corresponding registration center identifier; and querying the configuration information of the target registration center in the registration center configuration association information according to the target registration center identifier includes:
[0021] Determining the configuration information corresponding to the target registration center identifier according to the mapping relationship;
[0022] The configuration information corresponding to the target registration center identifier is used as the configuration information of the target registration center.
[0023] In one embodiment, the step of determining a target configuration acquisition service for invoking by a distributed application in a microservice framework in response to a configuration acquisition service invocation request sent by the distributed application includes:
[0024] In response to the configuration acquisition service call request, the metadata of each configuration acquisition service is sent to the distributed application so that the distributed application can obtain a configuration service list; the distributed application is used to filter out target metadata in the configuration service list through a local load balancing strategy; the configuration acquisition service corresponding to the target metadata is the target configuration acquisition service.
[0025] In one embodiment, the step of determining a target configuration acquisition service for invoking by a distributed application in a microservice framework in response to a configuration acquisition service invocation request sent by the distributed application includes:
[0026] In response to the configuration acquisition service call request, the target meta-information is filtered out from the configuration acquisition service list through the local load balancing strategy; the configuration service list includes the meta-information of each configuration acquisition service;
[0027] The configuration acquisition service corresponding to the target meta-information is used as the target configuration acquisition service.
[0028] In a second aspect, the present application also provides a registration center configuration device. The device includes:
[0029] A determination module, configured to determine a target configuration acquisition service for invoking by a distributed application under a microservice framework in response to a configuration acquisition service invocation request sent by the distributed application;
[0030] a receiving module configured to receive, through the target configuration acquisition service, a configuration information acquisition request sent by the distributed application; the configuration information acquisition request is an acquisition request initiated by the distributed application for a target registry; the configuration information acquisition request carries a target registry identifier corresponding to the target registry;
[0031] An acquisition module, configured to acquire configuration information of the target registry according to the target registry identifier;
[0032] The sending module is used to obtain services through the target configuration and send the configuration information of the target registration center to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registration center.
[0033] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are performed:
[0034] In response to a configuration acquisition service call request sent by a distributed application under a microservice framework, determining a target configuration acquisition service for the distributed application to call;
[0035] Receiving, through the target configuration acquisition service, a configuration information acquisition request sent by the distributed application; the configuration information acquisition request is an acquisition request initiated by the distributed application for the target registration center; the configuration information acquisition request carries a target registration center identifier corresponding to the target registration center;
[0036] Acquire the configuration information of the target registry according to the target registry identifier;
[0037] The target configuration acquisition service is used to send the configuration information of the target registry to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registry.
[0038] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0039] In response to a configuration acquisition service call request sent by a distributed application under a microservice framework, determining a target configuration acquisition service for the distributed application to call;
[0040] Receiving, through the target configuration acquisition service, a configuration information acquisition request sent by the distributed application; the configuration information acquisition request is an acquisition request initiated by the distributed application for the target registration center; the configuration information acquisition request carries a target registration center identifier corresponding to the target registration center;
[0041] Acquire the configuration information of the target registry according to the target registry identifier;
[0042] The target configuration acquisition service is used to send the configuration information of the target registry to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registry.
[0043] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:
[0044] In response to a configuration acquisition service call request sent by a distributed application under a microservice framework, determining a target configuration acquisition service for the distributed application to call;
[0045] Receiving, through the target configuration acquisition service, a configuration information acquisition request sent by the distributed application; the configuration information acquisition request is an acquisition request initiated by the distributed application for the target registration center; the configuration information acquisition request carries a target registration center identifier corresponding to the target registration center;
[0046] Acquire the configuration information of the target registry according to the target registry identifier;
[0047] The target configuration acquisition service is used to send the configuration information of the target registry to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registry.
[0048] The above-mentioned registration center configuration method, apparatus, computer equipment, storage medium and computer program product determine the target configuration acquisition service for the distributed application to call by the distributed application in response to the configuration acquisition service call request sent by the distributed application under the microservice framework; receive the configuration information acquisition request sent by the distributed application for the target registration center through the target configuration acquisition service; wherein the configuration information acquisition request carries the target registration center identifier corresponding to the target registration center; obtain the configuration information of the target registration center according to the target registration center identifier; and send the configuration information of the target registration center to the distributed application through the target configuration acquisition service so that the distributed application can establish a connection with the target registration center.
[0049] In this way, distributed applications can obtain the target configuration information of the target registration center by calling the target configuration acquisition service provided by a third-party device to establish a connection with the target registration center. This externalized configuration method is based on a third-party device and uses service calls to obtain the configuration information of the registration center, which decouples the distributed application system and the registration center configuration, and achieves the separation of technical framework and parameter configuration management; it solves the problem of using a localized configuration method in related technologies, that is, storing the configuration information of the registration center in the application configuration file, loading the configuration information in the configuration file during the application startup process, and establishing a connection with the registration center, which leads to production risks caused by the application's strong dependence on the registration center server address; it effectively improves the reliability of the registration center configuration. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1A flowchart of a registration center configuration method according to an embodiment;
[0051] Figure 2 A flowchart of the steps for obtaining configuration information of a target registration center in one embodiment;
[0052] Figure 3 A flowchart of the steps of querying the configuration information of a target registry in the registry configuration association information in one embodiment;
[0053] Figure 4 A flowchart of a registration center configuration method according to another embodiment;
[0054] Figure 5 A schematic diagram of the architecture of a registration center configuration method in one embodiment;
[0055] Figure 6 It is a structural block diagram of a registration center configuration device in one embodiment;
[0056] Figure 7 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0058] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure as detailed in the appended claims.
[0059] The registration center configuration method provided in the embodiments of the present application can be applied to a registration center configuration device. The registration center configuration device can be deployed on a terminal, including but not limited to various personal computers, laptops, smartphones, tablet computers, and portable wearable devices. It is understood that the registration center configuration device can also be deployed on a server, which can be implemented as an independent server or a server cluster consisting of multiple servers. In practical applications, the registration center configuration device can also be named an externalized configuration device.
[0060] In one embodiment, Figure 1 As shown, a registration center configuration method is provided, which is described by taking the application of the method to a registration center configuration device deployed on a server as an example, and includes the following steps:
[0061] Step S110 , in response to a configuration acquisition service call request sent by a distributed application under a microservice framework, determining a target configuration acquisition service for the distributed application to call.
[0062] Among them, distributed applications may include clients and servers.
[0063] Among them, the registration center configuration device provides multiple configuration acquisition services to the outside world.
[0064] In actual applications, the configuration acquisition service can also be named as the registration center configuration acquisition service.
[0065] In a specific implementation, after the distributed application under the microservice framework is started, the distributed application can send a configuration acquisition service call request to the registration center configuration device. The registration center configuration device can respond to the configuration acquisition service call request sent by the distributed application and determine the configuration acquisition service for the distributed application to call as the target configuration acquisition service among the multiple configuration acquisition services provided to the outside world.
[0066] Step S120: Receive a configuration information acquisition request sent by a distributed application through a target configuration acquisition service.
[0067] The configuration information acquisition request is an acquisition request initiated by the distributed application to the target registration center.
[0068] The target registry is the registry to which the distributed application needs to establish a connection.
[0069] The configuration information acquisition request carries the target registration center identifier corresponding to the target registration center.
[0070] Each registration center in the registration center cluster corresponds to a different registration center identifier, and the registration center identifier corresponding to the target registration center is used as the target registration center identifier.
[0071] In a specific implementation, the distributed application can generate a configuration information acquisition request carrying the target registration center identifier for the target registration center based on the target registration center identifier corresponding to the target registration center, and send the configuration information acquisition request to the target configuration acquisition service provided by the registration center configuration device, so that the registration center configuration device can receive the configuration information acquisition request sent by the distributed application through the target configuration acquisition service.
[0072] Step S130: Acquire the configuration information of the target registry according to the target registry identifier.
[0073] In a specific implementation, the registration center configuration device may respond to a configuration information acquisition request sent by a distributed application, and acquire the configuration information of the target registration center according to the target registration center identifier in the stored registration center configuration association information.
[0074] Step S140: Obtain services through target configuration and send configuration information of the target registry to the distributed application.
[0075] The configuration information of the target registration center includes at least the address (URL) of the registration center, and may also include the timeout period (timeout), the number of retries (retries) and the like for connecting to the registration center.
[0076] The configuration information of the target registry is used for the distributed application to establish a connection with the target registry.
[0077] In a specific implementation, the registration center configuration device can obtain services through target configuration and send the configuration information of the target registration center to the distributed application, so that the distributed application can initialize the connection with the target registration center according to the configuration information of the target registration center, so that the distributed application can realize subsequent service registration and discovery.
[0078] In the above-mentioned registration center configuration method, the target configuration acquisition service for the distributed application to call is determined by responding to the configuration acquisition service call request sent by the distributed application under the microservice framework; the configuration information acquisition request sent by the distributed application for the target registration center is received through the target configuration acquisition service; wherein the configuration information acquisition request carries the target registration center identifier corresponding to the target registration center; the configuration information of the target registration center is obtained according to the target registration center identifier; and the configuration information of the target registration center is sent to the distributed application through the target configuration acquisition service so that the distributed application can establish a connection with the target registration center.
[0079] In this way, distributed applications can obtain the target configuration information of the target registration center by calling the target configuration acquisition service provided by a third-party device to establish a connection with the target registration center. This externalized configuration method is based on a third-party device and uses service calls to obtain the configuration information of the registration center, which decouples the distributed application system and the registration center configuration, and achieves the separation of technical framework and parameter configuration management; it solves the problem of using a localized configuration method in related technologies, that is, storing the configuration information of the registration center in the application configuration file, loading the configuration information in the configuration file during the application startup process, and establishing a connection with the registration center, which leads to production risks caused by the application's strong dependence on the registration center server address; it effectively improves the reliability of the registration center configuration.
[0080] In one embodiment, Figure 2 As shown, step S130, obtaining the configuration information of the target registry according to the target registry identifier, includes:
[0081] Step S210: Obtain registration center configuration related information.
[0082] Step S220: Obtain service through target configuration, and query the configuration information of the target registry in the registry configuration association information according to the target registry identifier.
[0083] In a specific implementation, when the registration center configuration device obtains the configuration information of the target registration center based on the target registration center identifier, the registration center configuration device can first obtain and store the registration center configuration association information when it is started. In this way, the target configuration acquisition service of the registration center configuration device can receive and respond to the configuration information acquisition request, and query and obtain the configuration information of the target registration center in the registration center configuration association information based on the target registration center identifier.
[0084] The technical solution of this embodiment obtains registry configuration association information; uses the target configuration acquisition service, and then queries the target registry's configuration information within the registry configuration association information based on the target registry's identifier. This decoupling of applications and registry configuration information is achieved by migrating localized registry configuration information within the microservice framework to an externalized registry configuration device. This mitigates production risks associated with applications relying heavily on the registry server address and effectively improves the reliability of registry configuration.
[0085] In one embodiment, obtaining registration center configuration association information includes: in a startup state, sending a configuration association information acquisition request to a database; the database is used to return the registration center configuration association information in response to the configuration association information acquisition request; receiving the registration center configuration association information, and loading the registration center configuration association information into memory.
[0086] The database can be deployed on the server where the registration center configuration device is located, or it can be deployed on the cloud or other network servers.
[0087] The database stores registration center configuration related information.
[0088] In a specific implementation, when the registration center configuration device is in the process of obtaining the registration center configuration associated information, the registration center configuration device is in a startup state, and the registration center configuration device can send a configuration associated information acquisition request to the database. In this way, the database can receive and respond to the configuration associated information acquisition request, and return the registration center configuration associated information to the registration center configuration device. Thus, the registration center configuration device can receive and obtain the registration center configuration associated information, and load the registration center configuration associated information into the memory.
[0089] The technical solution of this embodiment involves sending a configuration association information acquisition request to the database while in the startup state; the database is configured to respond to the configuration association information acquisition request and return the registry center configuration association information; the registry center configuration association information is received and loaded into memory. In this way, the registry center configuration association information is stored using persistence (database storage) and caching (memory storage), which allows for more reliable storage of the registry center configuration association information. This eliminates the need to store the configuration information in the application's configuration file using a localized configuration method, achieving decoupling of the application and registry center configuration information, thereby resolving production risks caused by applications' strong reliance on the registry center server address.
[0090] In one embodiment, obtaining a service through target configuration and querying the configuration information of the target registry in the registry configuration association information according to the target registry identifier includes: obtaining a service through target configuration and querying the configuration information of the target registry in the registry configuration association information stored in the memory according to the target registry identifier.
[0091] In a specific implementation, in the process of obtaining the target configuration service and querying the configuration information of the target registration center in the registration center configuration association information according to the target registration center identifier, the target configuration acquisition service provided by the registration center configuration device can query the configuration information of the target registration center according to the target registration center identifier in the registration center configuration association information stored in the memory to obtain the configuration information of the target registration center.
[0092] This technical solution uses the target configuration acquisition service to query the target registry's configuration information based on the target registry's identifier within the registry configuration association information stored in memory. This allows the target registry's configuration information to be directly retrieved from memory, effectively improving configuration information acquisition efficiency.
[0093] In one embodiment, the registration center configuration association information includes a mapping relationship between the configuration information of each registration center and the corresponding registration center identifier; Figure 3 As shown, according to the target registry identifier, query the configuration information of the target registry in the registry configuration association information, including:
[0094] Step S310: Determine the configuration information corresponding to the target registration center identifier according to the mapping relationship.
[0095] Step S320: Use the configuration information corresponding to the target registry identifier as the configuration information of the target registry.
[0096] In the specific implementation, when obtaining the service through the target configuration, according to the target registration center identifier, in the registration center configuration association information, the configuration information of the target registration center is queried. The target configuration acquisition service can determine the configuration information corresponding to the target registration center identifier based on the mapping relationship between the configuration information of each registration center and the corresponding registration center identifier, and use the configuration information corresponding to the target registration center identifier as the configuration information of the target registration center.
[0097] In the technical solution of this embodiment, the registry configuration association information includes a mapping relationship between each registry's configuration information and its corresponding registry identifier. Based on this mapping relationship, the configuration information corresponding to the target registry identifier is determined; the configuration information corresponding to the target registry identifier is then used as the target registry's configuration information. In this way, based on the one-to-one correspondence between the registry's configuration information and its corresponding registry identifier, the target registry's configuration information can be accurately obtained based on the target registry identifier.
[0098] In one embodiment, in response to a configuration acquisition service call request sent by a distributed application under a microservice framework, a target configuration acquisition service for the distributed application to call is determined, including: in response to the configuration acquisition service call request, sending metadata of each configuration acquisition service to the distributed application so that the distributed application can obtain a list of configuration services.
[0099] Among them, the distributed application is used to filter out target metadata in the configuration service list through the local load balancing strategy.
[0100] Among them, the configuration acquisition service corresponding to the target meta information is the target configuration acquisition service.
[0101] The registration center configuration device stores the meta-information of each configuration acquisition service provided by itself.
[0102] The meta information may include IP address information and / or port information.
[0103] In a specific implementation, when the registration center configuration device responds to a configuration acquisition service call request sent by a distributed application under a microservice framework and determines the target configuration acquisition service to be called by the distributed application, the registration center configuration device can respond to the configuration acquisition service call request and send the metadata of each configuration acquisition service provided by the registration center configuration device to the distributed application, so that the distributed application can obtain a configuration service list. The configuration service list includes the metadata of each configuration acquisition service. In this way, the distributed application can use the local load balancing strategy to filter out the metadata that matches the environment configuration of the distributed application in the configuration service list as the target metadata. The configuration acquisition service corresponding to the target metadata will be used as the target configuration acquisition service to be called by the distributed application. Specifically, the distributed application can call the target configuration acquisition service based on the target metadata corresponding to the target configuration acquisition service to send a configuration information acquisition request to the target configuration acquisition service, so that the registration center configuration device can also determine the configuration acquisition service called by the distributed application among the various configuration acquisition services.
[0104] The technical solution of this embodiment responds to a configuration retrieval service call request by sending metadata about each configuration retrieval service to a distributed application, allowing the distributed application to obtain a list of configuration services. The distributed application then uses a local load balancing policy to filter the target metadata from the list of configuration services. The configuration retrieval service corresponding to the target metadata is designated as the target configuration retrieval service. This allows the distributed application to flexibly determine a matching configuration retrieval service using the load balancing policy, thereby improving access efficiency to the registry center's configuration device.
[0105] In one embodiment, in response to a configuration acquisition service call request sent by a distributed application under a microservice framework, a target configuration acquisition service for the distributed application to call is determined, including: in response to the configuration acquisition service call request, filtering out target metadata in the configuration acquisition service list through a local load balancing strategy; the configuration service list includes metadata of each configuration acquisition service; and the configuration acquisition service corresponding to the target metadata is used as the target configuration acquisition service.
[0106] The configuration acquisition service list includes meta information of each configuration acquisition service provided by the registration center configuration device.
[0107] In a specific implementation, when the registry center configuration device responds to a configuration acquisition service call request sent by a distributed application within a microservice framework and determines the target configuration acquisition service to be called by the distributed application, the registry center configuration device can select an appropriate configuration acquisition service based on the operating status of each configuration acquisition service in the configuration service list using a local load balancing strategy in response to the configuration acquisition service call request. This screens out the metadata of the appropriate configuration acquisition service from the configuration service list and uses it as the target metadata. In this way, the configuration acquisition service corresponding to the target metadata, i.e., the selected appropriate configuration acquisition service, will serve as the target configuration acquisition service to be called by the distributed application.
[0108] It should be noted that, in actual applications, the registration center configuration device may also provide only one configuration acquisition service, which is directly used as the target configuration acquisition service for distributed applications to call.
[0109] The technical solution of this embodiment, in response to a configuration acquisition service call request, uses a local load balancing policy to filter target metadata from a list of configuration acquisition services; the list of configuration services includes metadata for each configuration acquisition service; and the configuration acquisition service corresponding to the target metadata is used as the target configuration acquisition service. In this way, the local load balancing policy of the registry center configuration device selects the appropriate configuration acquisition service as the target configuration acquisition service for distributed applications to call, effectively improving the availability and access efficiency of the registry center configuration device.
[0110] In another embodiment, Figure 4 As shown, a registration center configuration method is provided, which is applied to a registration center configuration device, comprising the following steps:
[0111] Step S410: In the startup state, a configuration related information acquisition request is sent to the database.
[0112] Step S420: Receive registration center configuration association information, and load the registration center configuration association information into the memory.
[0113] Step S430: In response to the configuration acquisition service call request sent by the distributed application under the microservice framework, a target configuration acquisition service for the distributed application to call is determined.
[0114] Step S440: Receive a configuration information acquisition request sent by a distributed application through a target configuration acquisition service.
[0115] Step S450: Obtain service through target configuration, and determine configuration information corresponding to the target registry identifier based on the mapping relationship between configuration information of each registry and the corresponding registry identifier in the registry configuration association information stored in the memory.
[0116] Step S460: Use the configuration information corresponding to the target registry identifier as the configuration information of the target registry.
[0117] Step S470: Obtain services through target configuration and send configuration information of the target registry to the distributed application.
[0118] It should be noted that the specific limitations of the above steps can refer to the specific limitations of a registration center configuration method above.
[0119] To facilitate understanding by those skilled in the art, Figure 5 Provides a schematic diagram of the architecture of the registration center configuration method. Figure 5 As shown, taking the method applied to the Zookeeper registration center under the Dubbo framework in the RPC (Remote Procedure Call) framework as an example, the externalized configuration device (i.e., the registration center configuration device) can load the mapping relationship between the configuration information of each registration center and the corresponding registration center identifier into the memory, and the configuration information of the registration center includes the address of the registration center; the distributed application (including client A, server A, client B, server B) can be connected to the configuration acquisition service provided by the externalized configuration device through the dubbo sdk (Software Development Kit). The sdk in the distributed application can obtain the configuration information of the registration center that needs to be connected by calling the configuration acquisition service provided by the externalized configuration device, and initialize the connection with the registration center based on the configuration information.
[0120] Specifically, client A and the SDK in server A can obtain the configuration information of registry A (including the address of registry A) to which a connection is to be established by calling the configuration acquisition service provided by the externalized configuration device, and initialize a connection with registry A based on the address of registry A. Client B and the SDK in server B can obtain the configuration information of registry B (including the address of registry B) to which a connection is to be established by calling the configuration acquisition service provided by the externalized configuration device, and initialize a connection with registry B based on the address of registry B.
[0121] It should be noted that this method can also be applied to other RPC frameworks, such as the microservice framework SpringCloud. In addition, the type of registration center is not limited to Zookeeper, and can also be other types such as Eureka and Nacos.
[0122] In this way, the technical solution of this embodiment can flexibly obtain the configuration information of the registration center through service calling, thereby improving access efficiency.
[0123] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0124] Based on the same inventive concept, embodiments of the present application also provide a registration center configuration device for implementing the aforementioned registration center configuration method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations in the one or more registration center configuration device embodiments provided below can be found in the aforementioned limitations of the registration center configuration method and will not be further elaborated here.
[0125] In one embodiment, Figure 6 As shown, a registration center configuration device is provided, including: a determination module 610, a receiving module 620, an acquisition module 630 and a sending module 640, wherein:
[0126] The determination module 610 is configured to determine a target configuration acquisition service to be called by the distributed application in response to a configuration acquisition service call request sent by the distributed application under the microservice framework.
[0127] The receiving module 620 is used to receive the configuration information acquisition request sent by the distributed application through the target configuration acquisition service; the configuration information acquisition request is an acquisition request initiated by the distributed application for the target registration center; the configuration information acquisition request carries the target registration center identifier corresponding to the target registration center.
[0128] The acquisition module 630 is configured to acquire the configuration information of the target registry according to the target registry identifier.
[0129] The sending module 640 is configured to obtain services through the target configuration and send the configuration information of the target registry to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registry.
[0130] In one embodiment, the acquisition module 630 is specifically configured to acquire registry configuration association information; through the target configuration acquisition service, according to the target registry identifier, query the configuration information of the target registry in the registry configuration association information.
[0131] In one embodiment, the acquisition module 630 is specifically used to send a configuration association information acquisition request to the database when it is in the startup state; the database is used to return the registration center configuration association information in response to the configuration association information acquisition request; receive the registration center configuration association information, and load the registration center configuration association information into the memory.
[0132] In one embodiment, the acquisition module 630 is specifically configured to acquire services through the target configuration, and query the configuration information of the target registry according to the target registry identifier in the registry configuration association information stored in the memory.
[0133] In one embodiment, the registration center configuration association information includes a mapping relationship between the configuration information of each registration center and the corresponding registration center identifier; the acquisition module 630 is specifically used to determine the configuration information corresponding to the target registration center identifier based on the mapping relationship; and use the configuration information corresponding to the target registration center identifier as the configuration information of the target registration center.
[0134] In one embodiment, the determination module 610 is specifically used to send the metadata of each configuration acquisition service to the distributed application in response to the configuration acquisition service call request, so that the distributed application can obtain the configuration service list; the distributed application is used to filter out the target metadata in the configuration service list through the local load balancing strategy; the configuration acquisition service corresponding to the target metadata is the target configuration acquisition service.
[0135] In one embodiment, the determination module 610 is specifically used to respond to the configuration acquisition service call request, filter out target metadata in the configuration acquisition service list through a local load balancing strategy; the configuration service list includes metadata of each configuration acquisition service; and use the configuration acquisition service corresponding to the target metadata as the target configuration acquisition service.
[0136] Each module in the aforementioned registration center configuration device may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0137] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store registration center configuration association information data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a registration center configuration method is implemented.
[0138] It will be understood by those skilled in the art that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0139] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0140] In response to a configuration acquisition service call request sent by a distributed application under a microservice framework, determining a target configuration acquisition service for the distributed application to call;
[0141] Receiving, through the target configuration acquisition service, a configuration information acquisition request sent by the distributed application; the configuration information acquisition request is an acquisition request initiated by the distributed application for the target registration center; the configuration information acquisition request carries a target registration center identifier corresponding to the target registration center;
[0142] Acquire the configuration information of the target registry according to the target registry identifier;
[0143] The target configuration acquisition service is used to send the configuration information of the target registry to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registry.
[0144] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0145] Get the configuration information of the registry center;
[0146] The target configuration acquisition service is used to query the configuration information of the target registry in the registry configuration association information according to the target registry identifier.
[0147] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0148] In the startup state, sending a configuration association information acquisition request to the database; the database is used to return the configuration association information of the registration center in response to the configuration association information acquisition request;
[0149] The registration center configuration association information is received, and the registration center configuration association information is loaded into a memory.
[0150] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0151] The target configuration acquisition service is used to query the configuration information of the target registry according to the target registry identifier in the registry configuration association information stored in the memory.
[0152] In one embodiment, the registration center configuration association information includes a mapping relationship between configuration information of each registration center and a corresponding registration center identifier; when the processor executes the computer program, the processor further implements the following steps:
[0153] Determining the configuration information corresponding to the target registration center identifier according to the mapping relationship;
[0154] The configuration information corresponding to the target registration center identifier is used as the configuration information of the target registration center.
[0155] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0156] In response to the configuration acquisition service call request, the metadata of each configuration acquisition service is sent to the distributed application so that the distributed application can obtain a configuration service list; the distributed application is used to filter out target metadata in the configuration service list through a local load balancing strategy; the configuration acquisition service corresponding to the target metadata is the target configuration acquisition service.
[0157] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0158] In response to the configuration acquisition service call request, the target meta-information is filtered out from the configuration acquisition service list through the local load balancing strategy; the configuration service list includes the meta-information of each configuration acquisition service;
[0159] The configuration acquisition service corresponding to the target meta-information is used as the target configuration acquisition service.
[0160] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0161] In response to a configuration acquisition service call request sent by a distributed application under a microservice framework, determining a target configuration acquisition service for the distributed application to call;
[0162] Receiving, through the target configuration acquisition service, a configuration information acquisition request sent by the distributed application; the configuration information acquisition request is an acquisition request initiated by the distributed application for the target registration center; the configuration information acquisition request carries a target registration center identifier corresponding to the target registration center;
[0163] Acquire the configuration information of the target registry according to the target registry identifier;
[0164] The target configuration acquisition service is used to send the configuration information of the target registry to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registry.
[0165] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0166] Get the configuration information of the registry center;
[0167] The target configuration acquisition service is used to query the configuration information of the target registry in the registry configuration association information according to the target registry identifier.
[0168] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0169] In the startup state, sending a configuration association information acquisition request to the database; the database is used to return the configuration association information of the registration center in response to the configuration association information acquisition request;
[0170] The registration center configuration association information is received, and the registration center configuration association information is loaded into a memory.
[0171] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0172] The target configuration acquisition service is used to query the configuration information of the target registry according to the target registry identifier in the registry configuration association information stored in the memory.
[0173] In one embodiment, the registration center configuration association information includes a mapping relationship between the configuration information of each registration center and the corresponding registration center identifier; when the computer program is executed by the processor, the following steps are further implemented:
[0174] Determining the configuration information corresponding to the target registration center identifier according to the mapping relationship;
[0175] The configuration information corresponding to the target registration center identifier is used as the configuration information of the target registration center.
[0176] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0177] In response to the configuration acquisition service call request, the metadata of each configuration acquisition service is sent to the distributed application so that the distributed application can obtain a configuration service list; the distributed application is used to filter out target metadata in the configuration service list through a local load balancing strategy; the configuration acquisition service corresponding to the target metadata is the target configuration acquisition service.
[0178] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0179] In response to the configuration acquisition service call request, the target meta-information is filtered out from the configuration acquisition service list through the local load balancing strategy; the configuration service list includes the meta-information of each configuration acquisition service;
[0180] The configuration acquisition service corresponding to the target meta-information is used as the target configuration acquisition service.
[0181] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0182] In response to a configuration acquisition service call request sent by a distributed application under a microservice framework, determining a target configuration acquisition service for the distributed application to call;
[0183] Receiving, through the target configuration acquisition service, a configuration information acquisition request sent by the distributed application; the configuration information acquisition request is an acquisition request initiated by the distributed application for the target registration center; the configuration information acquisition request carries a target registration center identifier corresponding to the target registration center;
[0184] Acquire the configuration information of the target registry according to the target registry identifier;
[0185] The target configuration acquisition service is used to send the configuration information of the target registry to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registry.
[0186] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0187] Get the registry configuration related information;
[0188] The target configuration acquisition service is used to query the configuration information of the target registry in the registry configuration association information according to the target registry identifier.
[0189] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0190] In the startup state, sending a configuration association information acquisition request to the database; the database is used to return the configuration association information of the registration center in response to the configuration association information acquisition request;
[0191] The registration center configuration association information is received, and the registration center configuration association information is loaded into a memory.
[0192] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0193] The target configuration acquisition service is used to query the configuration information of the target registry according to the target registry identifier in the registry configuration association information stored in the memory.
[0194] In one embodiment, the registration center configuration association information includes a mapping relationship between the configuration information of each registration center and the corresponding registration center identifier; when the computer program is executed by the processor, the following steps are further implemented:
[0195] Determining the configuration information corresponding to the target registration center identifier according to the mapping relationship;
[0196] The configuration information corresponding to the target registration center identifier is used as the configuration information of the target registration center.
[0197] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0198] In response to the configuration acquisition service call request, the metadata of each configuration acquisition service is sent to the distributed application so that the distributed application can obtain a configuration service list; the distributed application is used to filter out target metadata in the configuration service list through a local load balancing strategy; the configuration acquisition service corresponding to the target metadata is the target configuration acquisition service.
[0199] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0200] In response to the configuration acquisition service call request, the target meta-information is filtered out from the configuration acquisition service list through the local load balancing strategy; the configuration service list includes the meta-information of each configuration acquisition service;
[0201] The configuration acquisition service corresponding to the target meta-information is used as the target configuration acquisition service.
[0202] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.
[0203] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may 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). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0204] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0205] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A registration center configuration method, characterized in that: The method comprises: In response to a configuration acquisition service call request sent by a distributed application under a microservice framework, determining a target configuration acquisition service for the distributed application to call; Receiving, through the target configuration acquisition service, a configuration information acquisition request sent by the distributed application; the configuration information acquisition request is an acquisition request initiated by the distributed application for the target registration center; the configuration information acquisition request carries a target registration center identifier corresponding to the target registration center; Acquire the configuration information of the target registry according to the target registry identifier; The target configuration acquisition service is used to send the configuration information of the target registry to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registry.
2. The method according to claim 1, characterized in that The acquiring the configuration information of the target registry according to the target registry identifier includes: Get the configuration information of the registry center; The target configuration acquisition service is used to query the configuration information of the target registry in the registry configuration association information according to the target registry identifier.
3. The method according to claim 2, characterized in that The obtaining of registration center configuration related information includes: In the startup state, sending a configuration association information acquisition request to the database; the database is used to return the configuration association information of the registration center in response to the configuration association information acquisition request; The registration center configuration association information is received, and the registration center configuration association information is loaded into a memory.
4. The method according to claim 3, characterized in that The acquiring service through the target configuration, querying the configuration information of the target registry in the registry configuration association information according to the target registry identifier, includes: The target configuration acquisition service is used to query the configuration information of the target registry according to the target registry identifier in the registry configuration association information stored in the memory.
5. The method according to claim 2, characterized in that The registration center configuration association information includes a mapping relationship between configuration information of each registration center and a corresponding registration center identifier; querying the configuration information of the target registration center in the registration center configuration association information according to the target registration center identifier includes: Determining the configuration information corresponding to the target registration center identifier according to the mapping relationship; The configuration information corresponding to the target registration center identifier is used as the configuration information of the target registration center.
6. The method according to claim 1, wherein The step of responding to a configuration acquisition service call request sent by a distributed application under a microservice framework and determining a target configuration acquisition service for the distributed application to call includes: In response to the configuration acquisition service call request, the metadata of each configuration acquisition service is sent to the distributed application so that the distributed application can obtain a configuration service list; the distributed application is used to filter out target metadata in the configuration service list through a local load balancing strategy; the configuration acquisition service corresponding to the target metadata is the target configuration acquisition service.
7. The method according to claim 1, characterized in that The step of responding to a configuration acquisition service call request sent by a distributed application under a microservice framework and determining a target configuration acquisition service for the distributed application to call includes: In response to the configuration acquisition service call request, the target meta-information is filtered out from the configuration acquisition service list through the local load balancing strategy; the configuration service list includes the meta-information of each configuration acquisition service; The configuration acquisition service corresponding to the target meta-information is used as the target configuration acquisition service.
8. A registration center configuration device, characterized in that: The device comprises: A determination module, configured to determine a target configuration acquisition service for invoking by a distributed application under a microservice framework in response to a configuration acquisition service invocation request sent by the distributed application; a receiving module configured to receive, through the target configuration acquisition service, a configuration information acquisition request sent by the distributed application; the configuration information acquisition request is an acquisition request initiated by the distributed application for a target registry; the configuration information acquisition request carries a target registry identifier corresponding to the target registry; An acquisition module, configured to acquire configuration information of the target registry according to the target registry identifier; The sending module is used to obtain services through the target configuration and send the configuration information of the target registration center to the distributed application; the configuration information is used for the distributed application to establish a connection with the target registration center.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Service registration center
CN110049089A
Authentication method and device based on registration center, equipment and storage medium
CN113556357A