Configuration update method, device, system, electronic device, and readable storage medium
By configuring the server to push changes configuration data to services corresponding to grayscale conditions, and handling updates in combination with the application server's preset configuration components, the problem of slow response and high overhead in the existing technology of service configuration updates is solved, and the efficiency of software project research and development and verification is improved.
Patent Information
- Application Number
- CN202111426080.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-11-26
AI Technical Summary
In the prior art, service configuration update response is slow and overhead is large, which affects the efficiency of software project research and development and verification.
By receiving the change operation of preset environment configuration, determining the change configuration data, and obtaining its corresponding grayscale conditions, pushing the change configuration data to the services corresponding to the grayscale conditions, the application server monitors and processes the pushed configuration updates through the preset configuration components.
It improves the response speed of service configuration updates, reduces overhead, and thus improves the efficiency of software project research and development and verification.
Smart Images

Figure CN114035826B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a configuration updating method, device, system, electronic device and readable storage medium. Background Art
[0002] In software project development, different commonly used environments are usually included, such as development environment, test environment, pre-release environment, production environment, etc. Or, it can also include temporary environments generated due to project needs, such as stress testing environment, automated verification environment, test environment, and other temporary environments that require isolated verification. The configurations of different services in different environments are different.
[0003] Currently, when the configuration of a service changes during software project development, the running service needs to be restarted, and the changed configuration needs to be actively pulled after the restart to update the service. It can be seen that the above configuration update method has slow response and high overhead, which affects the efficiency of software project development and verification. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a configuration update method, device, system, electronic device and readable storage medium to improve the response speed of service configuration update and reduce overhead, thereby improving the efficiency of software project development and verification. The specific technical solution is as follows:
[0005] In a first aspect of the implementation of the present invention, a configuration update method is first provided, which is applied to a system including a configuration server and an application server. The method may include:
[0006] The configuration server receives a change operation on at least one configuration item in a preset environment configuration, and determines change configuration data, wherein the preset environment configuration includes a namespace and a service configuration corresponding to the namespace, and the service configuration includes at least one configuration item;
[0007] The configuration server obtains the grayscale condition corresponding to the changed configuration data;
[0008] The configuration server sends the changed configuration data to the service corresponding to the grayscale condition;
[0009] The application server registers at least one configuration item of a service in a preset configuration component, and listens to the changed configuration data pushed by the configuration server through the preset configuration component; obtains the configuration item to be updated from the changed configuration data through the preset configuration component, and obtains the service to be updated through the configuration item to be updated in at least one of the services, wherein the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated; calls the configuration item of the service to be updated through the preset configuration component, and updates the configuration item of the service to be updated according to the configuration item to be updated.
[0010] In a second aspect of the present invention, another configuration update method is provided, which is applied to a configuration server. The method may include:
[0011] receiving a change operation on at least one configuration item in the preset environment configuration, and determining change configuration data, wherein the preset environment configuration includes a namespace and a service configuration corresponding to the namespace, and the service configuration includes at least one configuration item;
[0012] Obtaining a grayscale condition corresponding to the changed configuration data;
[0013] The changed configuration data is sent to the service corresponding to the grayscale condition, and the changed configuration data is used by the service corresponding to the grayscale condition to respond to the change operation to update the configuration item.
[0014] In a third aspect of the present invention, another configuration update method is provided, which is applied to an application server. The method may include:
[0015] Register at least one configuration item of a service in a preset configuration component, and monitor the configuration change data pushed by the configuration server through the preset configuration component;
[0016] Acquire a configuration item to be updated from the changed configuration data through the preset configuration component, and acquire a service to be updated through the configuration item to be updated in at least one of the services, wherein the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated;
[0017] The configuration item of the service to be updated is called by the preset configuration component, and the configuration item of the service to be updated is updated according to the configuration item to be updated.
[0018] In a fourth aspect of the present invention, a configuration update system is provided. The system may include a configuration server and an application server.
[0019] The configuration server is used to receive a change operation on at least one configuration item in a preset environment configuration, determine the changed configuration data, obtain the grayscale condition corresponding to the changed configuration data, and then send the changed configuration data to the service corresponding to the grayscale condition, wherein the preset environment configuration includes a namespace and a service configuration corresponding to the namespace, and the service configuration includes at least one configuration item;
[0020] The application server is used to register the configuration item of at least one service in the preset configuration component, and listen to the changed configuration data pushed by the configuration server through the preset configuration component; obtain the configuration item to be updated from the changed configuration data through the preset configuration component, and obtain the service to be updated through the configuration item to be updated in at least one of the services, wherein the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated; call the configuration item of the service to be updated through the preset configuration component, and update the configuration item of the service to be updated according to the configuration item to be updated.
[0021] In a fifth aspect of the implementation of the present invention, a configuration update device is provided, which is applied to a configuration server, and the device may include:
[0022] A change data determination module, used to receive a change operation corresponding to a preset environment configuration and determine change configuration data, wherein the preset environment configuration includes a namespace and a service configuration, and the namespace includes an application environment and a service name;
[0023] A grayscale condition determination module, used to obtain the grayscale condition corresponding to the changed configuration data;
[0024] The service configuration update module is used to send the changed configuration data to the service corresponding to the grayscale condition, and the changed configuration data is used for the service corresponding to the grayscale condition to respond to the change operation to change the service configuration.
[0025] In a sixth aspect of the implementation of the present invention, another configuration update device is provided, which is applied to an application server and may include:
[0026] A service registration module, used to register at least one configuration item of a service in a preset configuration component, and monitor the configuration change data pushed by the configuration server through the preset configuration component;
[0027] a data parsing module, configured to obtain a configuration item to be updated from the changed configuration data through the preset configuration component, and obtain a service to be updated through the configuration item to be updated in at least one of the services, wherein the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated;
[0028] The configuration update module is used to call the configuration item of the service to be updated through the preset configuration component, and update the configuration item of the service to be updated according to the configuration item to be updated.
[0029] According to a seventh aspect of the present invention, there is provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0030] Memory, used to store computer programs;
[0031] The processor is used to execute any of the configuration update methods described above when executing the program stored in the memory.
[0032] In an eighth aspect of the implementation of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute any of the configuration update methods described above.
[0033] In a ninth aspect of the implementation of the present invention, there is also provided a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the configuration updating methods described above.
[0034] The configuration update method provided by the embodiment of the present invention is applied to a system, wherein the system includes a configuration server and an application server. The configuration server can receive a change operation on at least one configuration item in a preset environment configuration, thereby determining the changed configuration data, and then obtaining the grayscale condition corresponding to the changed configuration data, and sending the changed configuration data to the service corresponding to the grayscale condition; the application server can register the configuration items of the service in the configuration component, and obtain the configuration items to be updated therefrom by listening to the changed configuration data pushed by the configuration server through a preset configuration component, and obtain the service to be updated through the configuration items to be updated in the service, and then call the configuration items of the server to be updated through the configuration component, and update the configuration items of the service to be updated based on the configuration items to be updated. When receiving a change operation that causes a configuration item to change, the configuration server generates corresponding changed configuration data and actively pushes the changed configuration data to the service corresponding to the grayscale condition. The service corresponding to the grayscale condition in the application server can respond to the aforementioned change operation according to the changed configuration data to update the configuration item. That is, the service can automatically and conveniently update the changed configuration items according to the changed configuration data pushed by the configuration server. There is no need to actively pull the changed configuration data and then restart the service as a whole to load the pulled configuration data, thereby improving the response speed of service configuration updates, reducing overhead, and thereby improving the efficiency of software project research and development and verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0036] Figure 1 is a flowchart of the steps of a first configuration update method provided by an embodiment of the present invention;
[0037] Figure 2 is a flowchart of the steps of a second configuration update method provided by an embodiment of the present invention;
[0038] Figure 3 is a flowchart of the steps of a third configuration update method provided by an embodiment of the present invention;
[0039] Figure 4 is a schematic diagram of the architecture of a configuration update system provided by an embodiment of the present invention;
[0040] Figure 5 is an interactive flow chart of a configuration update method provided by an embodiment of the present invention;
[0041] Figure 6 is an application example diagram of a configuration update method provided by an embodiment of the present invention;
[0042] Figure 7 is a structural block diagram of a configuration updating device provided by an embodiment of the present invention;
[0043] Figure 8 is a structural block diagram of another configuration updating device provided by an embodiment of the present invention
[0044] Fig. 9 It is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0045] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0046] Figure 1 is a flowchart of the steps of a first configuration update method provided by an embodiment of the present invention, the method is applied to a configuration server, such as Figure 1 As shown, the method may include:
[0047] Step 101: Receive a change operation on at least one configuration item in the preset environment configuration, and determine the changed configuration data, wherein the preset environment configuration includes a namespace and a service configuration corresponding to the namespace, and the service configuration includes at least one configuration item.
[0048] In an embodiment of the present invention, a configuration server is used to store configuration data such as business configuration, security configuration, storage configuration, and third-party interface configuration for different preset environment configurations. The preset environment configuration may be configuration data corresponding to different services in different environments, wherein the same preset environment configuration may correspond to one or more services. Optionally, the preset environment configuration may include a namespace and a service configuration, wherein the namespace may include an application environment and a service name, so that services with different application environments and service names have different namespaces corresponding to them. At this time, the service configuration is corresponded to the namespace, and only the configuration data corresponding to the service name and application environment are retrieved through the namespace, thereby enabling environmental isolation and categorized management of the service configuration.
[0049] Optionally, the application environment may include at least one of development (Development, DEV), testing (TEST), and production (Production, PRO).
[0050] Optionally, the service name may be player, etc.
[0051] Optionally, the service configuration may include specific definitions of different configuration items of the service. For example, the service configuration may be described in textual content through properties (class), xml (Extensible Markup Language), JSON (JavaScript Object Notation), txt (text document), etc., where each line of properties represents a specific configuration item, and the configuration item name and configuration value are connected with an equal sign. The content of xml must comply with the xml specification, the content of JSON must comply with the JSON specification, and the content of txt can be customized.
[0052] In an embodiment of the present invention, a change operation may be an operation such as modification, copying, adding, deleting, etc. of configuration data stored in a configuration server, and may be performed by developers, testers, operation and maintenance personnel, etc. For example, a preset environment configuration may be a change to a namespace, or a change to a service configuration. Optionally, it may include modification, copying, etc. of a namespace, or modification, copying, adding, deleting, etc. of configuration items such as an interface switch, a local cache switch, and a third-party interface address in the service configuration. After receiving a change operation on a configuration item, a configuration item whose content has changed may be used as changed configuration data. For example, a configuration item whose name, configuration value, etc. has changed after the change operation may be used as changed configuration data. The embodiment of the present invention does not impose any specific limitation on this.
[0053] Step 102: Obtain the grayscale condition corresponding to the changed configuration data.
[0054] In the embodiment of the present invention, grayscale refers to a publishing method with a smooth transition between black and white, that is, the service is first launched in a partial range, and then the online range is gradually expanded. The use of grayscale publishing method when configuration updates occur can effectively reduce the risk of service failures that may be caused by configuration updates. When a service failure caused by a configuration update occurs, it is limited to service failures within the grayscale range, which ensures the security of local verification and can control the scope of risk impact.
[0055] In an embodiment of the present invention, a grayscale condition corresponding to the changed configuration data can be obtained, wherein the grayscale condition refers to a scope condition of the service to which the changed configuration data is applicable. Optionally, the grayscale condition may refer to a scope condition that limits the target customer group, such as a grayscale condition that may be released to users with a registration time of more than 1 year, to users with a registration time of less than 3 months, to users who log in more than 3 times in a day, etc. The grayscale condition may also refer to a scope condition that limits the number of releases, such as a grayscale condition that may be released to 1% of users; the grayscale condition may be a preset grayscale condition, such as a preset grayscale condition for a configuration item, a preset environment configuration, etc., so that the changed configuration data determined for the preset environment configuration and the change operation of the configuration item can be released according to the preset grayscale condition, or can be determined according to the change operation, such as when the change operation changes the configuration item, the release scope of the change is also set, so that when receiving the change of the configuration item by the change operation, the grayscale condition set by the change operation for the configuration item can be determined, or the setting of the grayscale condition can be received after determining the change configuration data.
[0056] Step 103: Send the changed configuration data to the service corresponding to the grayscale condition, and the changed configuration data is used for the service corresponding to the grayscale condition to respond to the change operation and update the configuration item.
[0057] In an embodiment of the present invention, after determining the changed configuration data and obtaining the grayscale condition corresponding to the changed configuration data, the changed configuration data can be sent to the service corresponding to the grayscale condition. After obtaining the changed configuration data, the service corresponding to the grayscale condition responds to the change operation to make business adjustments. Without restarting the entire service, the changed configuration items in the service within the grayscale condition are updated.
[0058] The configuration update method provided by the embodiment of the present invention is applied to a configuration server, and can receive a change operation on at least one configuration item in a preset environment configuration, thereby determining the changed configuration data, and then obtaining the grayscale condition corresponding to the changed configuration data, and sending the changed configuration data to the service corresponding to the grayscale condition, so that the service corresponding to the grayscale condition can respond to the aforementioned change operation according to the changed configuration data to update the configuration item, that is, the service can perform business updates on the changed configuration items according to the push of the changed configuration data, without the need to actively pull the changed configuration data and then restart the service as a whole to load the pulled configuration data, thereby improving the response speed of the service configuration update, reducing overhead, and thus improving the efficiency of software project research and development and verification.
[0059] Figure 2 is a flowchart of the steps of a second configuration update method provided by an embodiment of the present invention, the method is applied to a configuration server, such as Figure 2 As shown, the method may include:
[0060] Step 201: Build a preset environment configuration corresponding to at least one service.
[0061] In an embodiment of the present invention, a preset environment configuration corresponding to at least one service is constructed, which may be to first construct a standard environment such as a DEV environment, a TEST environment, and a PRO environment. Optionally, according to application requirements, the DEV environment may not set permission requirements, and developers may adjust configuration data as needed; the TEST environment may set certain permission requirements so that testers can synchronize configuration changes from the DEV environment as needed, and then confirm and verify to review whether the configuration changes meet product requirements; the PRO environment may set higher permission requirements, and operation and maintenance personnel have the authority to synchronize configuration changes from the TEST environment and perform online or rollback operations. Optionally, the above construction can be completed on the configuration server.
[0062] In the embodiment of the present invention, the preset environment configuration may correspond to the relevant description of the aforementioned step 101. Further, the namespace (namespace) may include an environment identifier (env), an application environment (APPENV), a service name (PROJECT), etc. For example, taking the service name player project as an example, the namespace of the production environment is env.pro.player, the namespace of the development environment is env.dev.player, the namespace of the test environment is env.test.player, the namespace of the pre-release environment is env.pre.player, and other custom environments such as the stress test environment env.stress.player, etc. The above player projects have different namespaces under different environment identifiers, which can correspond to the service configuration of the player project in different environments, thereby realizing the isolation of configuration data of different environments. Further, by copying and changing the namespace, the development, testing, operation and maintenance, and product personnel can conveniently manage the namespace, so that different services can be isolated and managed in different environments. The service configuration may correspond to the relevant description of the aforementioned step 101. To avoid repetition, it will not be repeated here.
[0063] Step 202: Receive a configuration acquisition request sent by a service to be configured, wherein the configuration acquisition request includes the namespace, and the service to be configured is any service in at least one of the services.
[0064] In an embodiment of the present invention, a service can point to a standard environment through a configuration environment (CONFIGENV), and use an application environment (APPENV) to point to a service configuration corresponding to the service. The service configuration is stored in a predetermined namespace, and a configuration acquisition request is used for a service request to obtain the corresponding service configuration. The service should first specify one of the standard environments DEV, TEST, and PRO, and provide a namespace, so that the service configuration corresponding to the service can be determined according to the namespace, and the standard environment and the application environment under the standard environment can also be located through the namespace.
[0065] In an embodiment of the present invention, after constructing the preset environment configuration corresponding to the service, since different preset environment configurations have different namespaces and correspond to different service configurations, any service to be configured in the service can obtain the required service configuration from the configuration server. At this time, the configuration server can obtain the namespace provided by the configuration service through a configuration acquisition request to determine the service configuration required by the service to be configured.
[0066] Step 203: Obtain the service configuration corresponding to the namespace.
[0067] In the embodiment of the present invention, among the namespaces stored in the configuration server and the service configurations corresponding to the namespaces, the configuration server may obtain the service configuration corresponding to the service to be configured according to the namespaces included in the configuration acquisition request.
[0068] Optionally, step 203 includes:
[0069] Step S11: Obtain at least one configuration item corresponding to the namespace.
[0070] In the embodiment of the present invention, configuration items refer to different items in the scope of configuration management. A single service may correspond to one or more configuration items. The configuration items between different services may be the same or different. The main attributes of each configuration item may include name, file status, version, author, date, etc. Since the namespace corresponds to the service configuration, and the service configuration includes at least one configuration item corresponding to the service, at least one configuration item corresponding to the service to be configured can be obtained based on the namespace provided by the service to be configured.
[0071] Step S12: Obtain the grayscale value corresponding to each of the configuration items.
[0072] In the embodiment of the present invention, the grayscale value may refer to the range of the configuration item being online in the service. For example, if the grayscale value is 1%, 1% of the service adopts the configuration item and 99% adopts other configuration items. If the grayscale value is 10%, 10% of the service adopts the configuration item and 90% adopts other configuration items. Each configuration item may have a corresponding grayscale value pre-set or may have a grayscale value specified by the service to be configured. The embodiment of the present invention does not impose any specific limitation on this.
[0073] Step S13: When the gray value matches the service to be configured, the configuration item is used as target configuration data corresponding to the service to be configured.
[0074] In an embodiment of the present invention, according to the upper range indicated by the gray value, the configuration item may be hit in the service to be configured and needs to be adopted. According to the gray value and the configuration item, the service to be configured that needs to adopt the configuration can be determined, thereby determining the target configuration data corresponding to the configuration item. For example, when the gray value is 1%, it can indicate that 1% of the services randomly selected from the total number or part of the number apply the configuration item, or it can indicate that after the total number or part of the number of services are sorted according to the preset sorting conditions, the services in the first 1% or the first 1% in the sorting order in the positive order apply the configuration. At this time, if the service to be configured is within the random 1% range, or within the first 1% or the first 1% in the sorting order in the positive order, it is determined that the service to be configured is hit and the configuration item is adopted, and the configuration item is used as the target configuration data corresponding to the service to be configured. If the service to be configured is not within the above range and is not hit, other configuration items may be adopted, and the configuration item is not used as the target configuration data.
[0075] Optionally, the preset sorting conditions can be set according to the configuration status of the service or the status of the user using the service. For example, the configuration status can be a configuration version, a running end, etc. The configuration version can include a stable version, a test version, a development version, etc. The running end can include a computer end, a mobile end, etc. The user status can be an internal test user, a registered user, an unregistered user, etc. The embodiment of the present invention does not impose specific restrictions on this.
[0076] Step S14: splice each of the target configuration data corresponding to the service to be configured to determine the service configuration corresponding to the service to be configured.
[0077] In an embodiment of the present invention, depending on the configuration items and grayscale values, there may be multiple target configuration data for the same service to be configured. At this time, each target configuration data corresponding to the service to be configured can be spliced to determine the service configuration corresponding to the service to be configured. The embodiment of the present invention does not impose specific restrictions on the splicing rules of the target configuration data.
[0078] Step 204: Send the service configuration to the service, where the service configuration is used to configure the service to be configured.
[0079] In an embodiment of the present invention, after determining the service configuration corresponding to the service according to the name space, the service configuration can be sent to the service to be configured, and the service to be configured can be configured according to the service configuration. Optionally, the service to be configured can include different services, and the services can include different configuration items. The service to be configured can be configured according to different configuration items in the service configuration.
[0080] Step 205: Receive a change operation on at least one configuration item in the preset environment configuration, and determine the changed configuration data, wherein the preset environment configuration includes a namespace and a service configuration corresponding to the namespace, and the service configuration includes at least one configuration item.
[0081] In the embodiment of the present invention, step 205 may correspond to the relevant description of the aforementioned step 101, and will not be described again here to avoid repetition.
[0082] Step 206: Obtain the grayscale condition corresponding to the changed configuration data.
[0083] In the embodiment of the present invention, step 206 may correspond to the relevant description of the aforementioned step 102, and will not be described again here to avoid repetition.
[0084] Step 207: Send the changed configuration data to the service corresponding to the grayscale condition, and the changed configuration data is used for the service corresponding to the grayscale condition to respond to the change operation and update the configuration item.
[0085] In the embodiment of the present invention, step 207 may correspond to the relevant description of the aforementioned step 103, and will not be described again here to avoid repetition.
[0086] The configuration update method provided by the embodiment of the present invention is applied to a configuration server, and can receive a change operation on at least one configuration item in a preset environment configuration, thereby determining the changed configuration data, and then obtaining the grayscale condition corresponding to the changed configuration data, and sending the changed configuration data to the service corresponding to the grayscale condition, so that the service corresponding to the grayscale condition can respond to the aforementioned change operation according to the changed configuration data to update the configuration item, that is, the service can perform business updates on the changed configuration items according to the push of the changed configuration data, without the need to actively pull the changed configuration data and then restart the service as a whole to load the pulled configuration data, thereby improving the response speed of the service configuration update, reducing overhead, and thus improving the efficiency of software project research and development and verification.
[0087] Figure 3 is a flowchart of the steps of a third configuration update method provided by an embodiment of the present invention, which is applied to an application server, such as Figure 3 As shown, the method may include:
[0088] Step 301: register at least one configuration item of a service in a preset configuration component, and monitor the configuration change data pushed by a configuration server through the preset configuration component.
[0089] In an embodiment of the present invention, an application server is used to support a host operating system for running services. In the host operating system, CONFIGENV (configuration environment) and APPENV (application environment) of each service can be defined to mark the environment in which the service runs. Among them, the application server and configuration server are only used for functional distinction. In actual applications, the application server and configuration server can be implemented on the same server or on different servers.
[0090] In an embodiment of the present invention, a preset configuration component can also be built into the service during the service development stage. Since the update requirements of different services and different configuration items may be different, the configuration items of the service that needs to adopt the solution of the present invention can be optionally registered in the preset configuration component. Each service may include different businesses, and each business may include different configuration items. The configuration items of some businesses in the service can also be registered in the preset configuration component according to the update requirements, so that the preset configuration component can perform targeted updates on the configuration items of the service.
[0091] Optionally, the preset configuration component is any one of a Java component, a Windows system dynamic library, and a Linux system dynamic library.
[0092] In an embodiment of the present invention, the preset configuration component can be a Java component (Jar package), a Windows system dynamic library (DLL, Dynamic Link Library), a Linux system dynamic library (so, shared object, dynamic library), etc., which can be integrated into the source code of the service during the development stage, so as to automatically realize the configuration of the service during the service startup process.
[0093] In an embodiment of the present invention, the preset configuration component can monitor the push message of the configuration server to obtain the changed configuration data sent by the configuration server, wherein the relevant description of the configuration server sending the changed configuration data can correspond to the relevant description of the aforementioned step 101, and will not be repeated here to avoid repetition.
[0094] Step 302: Obtain a configuration item to be updated from the changed configuration data through the preset configuration component, and obtain a service to be updated through the configuration item to be updated in at least one of the services, wherein the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated.
[0095] In an embodiment of the present invention, the configuration item on which the change operation is performed can be determined as the configuration item to be updated. By parsing the changed configuration data through the preset configuration component, the configuration item to be updated included therein can be determined. At this time, the preset configuration component can determine the service to be updated corresponding to the configuration item to be updated based on the registered service and the configuration items included in the service.
[0096] Step 303: Call the configuration item of the service to be updated through the preset configuration component, and update the configuration item of the service to be updated according to the configuration item to be updated.
[0097] In the embodiment of the present invention, after the service to be updated is determined in the service, the configuration items of the service to be updated can be called through the preset configuration component, and the configuration items of the service to be updated can be updated according to the configuration items to be updated, so that the configuration items of the specified update can be updated without restarting the service. Furthermore, the business to be updated in the service can be determined according to the business to which the configuration items to be updated belong, so that the configuration items of the business to be updated can be updated according to the configuration items to be updated, thereby avoiding the impact on the normal operation of other businesses without restarting the service. Moreover, when modifying the configuration, it is only necessary to perform the change operation in the configuration server, and the service can receive the changed configuration data pushed by the configuration server of the specified environment and update it, which effectively improves the efficiency of service update.
[0098] Optionally, before step 301, the method further includes:
[0099] Step S21: Send a configuration acquisition request to the configuration server through the preset configuration component, where the configuration acquisition request includes the namespace.
[0100] In an embodiment of the present invention, the preset configuration component can also be used to obtain the name space of the corresponding environment of the service operation during the service startup process, wherein the preset configuration component can obtain the pre-defined CONFIGENV and APPENV environment variables from the host operating system where the service runs, and generate a name space based on the CONFIGENV, APPENV environment variables and information such as the service name of the service.
[0101] The following takes the preset configuration component as a Jar package as an example:
[0102] Configure a project with the module name core-base (core base module) in the service, and the output target is the core-base.jar package (core base module java package).
[0103] During the service startup process, the values of the environment variables CONFIGENV and APPENV are read from the system based on the jar package. If CONFIGENV and APPENV are not set in the system, the default is dev.
[0104] String configEnv=Optional.ofNullable(System.getenv("CONFIGENV")).orElse("dev");
[0105] (Read the value of the environment variable CONFIGENV from the system. If CONFIGENV is not set in the system, the default value of CONFIGENV is dev)
[0106] String appEnv=Optional.ofNullable(System.getenv("APPENV")).orElse("dev")
[0107] (Read the value of the environment variable APPENV from the system. If APPENV is not set in the system, the default value of APPENV is dev)
[0108] Step S22: Receive the service configuration obtained by the configuration server according to the name space.
[0109] Step S23: parsing the service configuration through the preset configuration component to perform service configuration.
[0110] In the embodiment of the present invention, the preset configuration component is also used to obtain the service configuration corresponding to the service through the namespace, wherein the namespace may be sent to the server storing the preset environment configuration, and the service configuration corresponding to the namespace returned by the configuration server may be obtained, or the corresponding service configuration may be determined through the namespace in the preset environment configuration stored locally; the preset configuration component is also used to parse the service configuration, that is, to determine the correspondence between different configuration items and services and businesses in the service configuration, thereby completing the configuration of different services and businesses.
[0111] For example, taking the preset configuration component as a Jar package, the namespace of the project configuration is generated based on the Jar package, a connection is initiated to the configuration server based on the namespace, and the service configuration returned by the configuration server is obtained, and then the configuration is parsed and saved locally. The implementation process is as follows:
[0112] String nameSpace="env."+appEnv+"."+projectName;
[0113] (The namespace is composed of the prefix "env." concatenated with the appEnv obtained in the above step S21, and then concatenated with "." and the project name)
[0114] boolean valueNull = false;
[0115] (Define a temporary value object valueNull and set the initial value to false)
[0116] try{
[0117] (try{} is an exception handling mechanism. When an exception occurs in the logic processing in the try{} code segment, it jumps to the catch(Exception e){} code segment for execution)
[0118] / / Get the remote config value
[0119] CloudConfig cloudConfig=ConfigServer.builder().
[0120] withEnv(configEnv).withNamespace(nameSpace).build();
[0121] (Define cloud configuration cloudConfig and initialize it;
[0122] Use configEnv obtained in step S21 and assign it to its member Env through .withEnv;
[0123] Use the nameSpace obtained by splicing to assign it to its member NameSpace through .withNameSpace;
[0124] Build is done via .build())
[0125] if(Objects.nonNull(cloudConfig)){
[0126] (If the cloudConfig object is not Null, that is, valid, enter the code segment in {})
[0127] String content=cloudConfig.getProperty("content",null);
[0128] (Define a temporary configuration content object named content;
[0129] Read properties from cloudConfig cloud configuration data (.getProperty), the property field name is content;
[0130] The read result is assigned to the content object)
[0131] if(!StringUtils.isEmpty(content)){
[0132] (Call the isEmpty method in the string method set (StringUtils) to determine whether the content is empty. The symbol ! before StringUtils means to negate the result of the isEmpty method;
[0133] If the result is not empty, enter the {} code block to execute)
[0134] / / Parse ini format properties configuration
[0135] String[]lines=content.split("\n");
[0136] (Define the string array lines, call the split method on the content configuration to split it into multiple lines using the separator "\n", "\n" represents a line break;
[0137] Assign the split multi-line string to the lines string array)
[0138] Map<String,String> envConfigMap=Maps.newHashMap();
[0139] (Define a temporary hash table, the Key and Value types of the table are both strings, and the table name is envConfigMap)
[0140] Arrays.stream(lines).filter(item->!StringUtils.isEmpty(item)
[0141] &&item.indexOf("=")>0).forEach(item->{
[0142] envConfigMap.put(item.substring(0,item.indexOf("=")),
[0143] item.substring(item.indexOf("=")+1));});
[0144] (Parse the lines string array. The parsing method is:
[0145] 1. Use the stream method of the basic library Arrays to obtain the processed stream object;
[0146] 2. Call the filter method of the stream object to filter the stream;
[0147] 3. The filtering method uses an iterator, and the iterator name is defined as item. The conditions that must be met are a. not empty (!StringUtils.isEmpty), b. the existence of the symbol "=";
[0148] 4. Loop processing, execute the code segment in item->{} for each item.
[0149] 5. Take the string from the 0th position of item to the character before the "=" sign as the KEY of the hash table (item.substring(0,item.indexOf("=")));
[0150] 6. Take the string from the character after the "=" sign to the last character of item as the VALUE of the hash table (item.substring(item.indexOf("="")+1));
[0151] 7. Set the above KEY and VALUE to the local environment configuration hash table (envConfigMap.put(...)))
[0152] / / setting finish end
[0153] Init4jUtils.settingPropValue(envConfigMap);
[0154] (Use the initialization tool Init4jUtils to import the local environment configuration hash table envConfigMap.)
[0155] return;
[0156] Execution ends and returns.
[0157] }
[0158] }
[0159] / / If it is online configuration &&valueNull is empty, interrupt the current operation
[0160] if(appEnv.toLowerCase().trim().equals("prod")&&valueNull){
[0161] throw new RuntimeException("env is prod,config value is null!");
[0162] (If the value of appEnv is prod and valueNull is empty, the code segment will be executed;
[0163] An exception is thrown with the following message: "env is prod, config value is null!")
[0164] }
[0165] }catch(Exception e){
[0166] / / Config configuration loading failed, continue execution
[0167] / / Get config exception
[0168] valueNull = true;
[0169] Set valueNull to true.
[0170] }
[0171] / / Get the directory where the current application is located
[0172] Config cfg = new Config();
[0173] (If you do not enter the return branch in the above code, continue to download the local default configuration items, that is, do not use the cloud configuration;
[0174] Define the configuration object cfg, type is Config. )
[0175] File input;
[0176] (Define the file object input, whose type is File.)
[0177] try{
[0178] (Try opening the configuration file.)
[0179] input=new File(path+Init4jConstant.DEFAULT_FILE);
[0180] The path of the configuration file to be opened is path+Init4jConstant.DEFAULT_FILE, which is the path of the current program and the default file name (Init4jConstant.DEFAULT_FILE).
[0181] }catch(Exception e){
[0182] / / If the local file is not loaded, load the local properties configuration last.
[0183] System.setProperty("spring.profiles.active","default");
[0184] return;
[0185] }
[0186] The configuration update method provided by the embodiment of the present invention is applied to an application server, and can register at least one configuration item of a service in a preset configuration component, and listen to the changed configuration data pushed by the configuration server through the preset configuration component, and then obtain the configuration item to be updated from the changed configuration data through the preset configuration component, and obtain the service to be updated through the configuration item to be updated in the service, the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated; at this time, the configuration item of the service to be updated is called through the preset configuration component, and the configuration item of the service to be updated is updated according to the configuration item to be updated, that is, the service can perform business updates on the changed configuration items according to the changed configuration data pushed by the configuration server, without the need to execute the service to actively pull the changed configuration data, and then restart the service as a whole to load the pulled configuration data, thereby improving the response speed of the service configuration update, reducing the overhead, and thus improving the efficiency of software project development and verification.
[0187] Figure 4 is a schematic diagram of the architecture of a configuration update system provided by an embodiment of the present invention, such as Figure 4 As shown, the system includes a configuration server 401 and an application server 402. The configuration server 401 can store the preset environment configuration and push the changed configuration data to the application server 402 based on the change operation of the configuration items in the preset environment configuration. The application server 402 monitors the push of the configuration server 401, and when receiving the changed configuration data, updates the service according to the changed configuration data. Further, in Figure 4 Based on the system structure shown, Figure 54 is an interactive flow chart of a configuration update method provided by an embodiment of the present invention. The method can be applied to a system including a configuration server 401 and an application server 402. The method may include:
[0188] Step 501: The configuration server 401 receives a change operation on at least one configuration item in a preset environment configuration, and determines change configuration data. The preset environment configuration includes a namespace and a service configuration corresponding to the namespace, and the service configuration includes at least one configuration item.
[0189] Step 502: The configuration server 401 obtains the grayscale condition corresponding to the changed configuration data.
[0190] Step 503: The configuration server 401 sends the changed configuration data to the service corresponding to the grayscale condition.
[0191] In the embodiment of the present invention, steps 501 to 503 may correspond to the relevant descriptions of the aforementioned steps 101 to 103, and will not be described again here to avoid repetition.
[0192] Step 504 : The application server 402 registers at least one configuration item of a service in the preset configuration component, and monitors the changed configuration data pushed by the configuration server 401 through the preset configuration component.
[0193] Step 505: The application server 402 obtains the configuration item to be updated from the changed configuration data through the preset configuration component, and obtains the service to be updated through the configuration item to be updated in at least one of the services, wherein the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated.
[0194] Step 506: The application server 402 calls the configuration item of the service to be updated through the preset configuration component, and updates the configuration item of the service to be updated according to the configuration item to be updated.
[0195] In the embodiment of the present invention, steps 504 to 506 may correspond to the relevant descriptions of the aforementioned steps 301 to 303 , and will not be described again to avoid repetition.
[0196] The configuration update method provided by the embodiment of the present invention is applied to a system, wherein the system includes a configuration server and an application server. The configuration server can receive a change operation on at least one configuration item in a preset environment configuration, thereby determining the changed configuration data, and then obtaining the grayscale condition corresponding to the changed configuration data, and sending the changed configuration data to the service corresponding to the grayscale condition; the application server can register the configuration items of the service in the configuration component, and obtain the configuration items to be updated therefrom by listening to the changed configuration data pushed by the configuration server through a preset configuration component, and obtain the service to be updated through the configuration items to be updated in the service, and then call the configuration items of the server to be updated through the configuration component, and update the configuration items of the service to be updated based on the configuration items to be updated. When receiving a change operation that causes a configuration item to change, the configuration server generates corresponding changed configuration data and actively pushes the changed configuration data to the service corresponding to the grayscale condition. The service corresponding to the grayscale condition in the application server can respond to the aforementioned change operation according to the changed configuration data to update the configuration item. That is, the service can automatically and conveniently update the changed configuration items according to the changed configuration data pushed by the configuration server. There is no need to actively pull the changed configuration data and then restart the service as a whole to load the pulled configuration data, thereby improving the response speed of service configuration updates, reducing overhead, and thereby improving the efficiency of software project research and development and verification.
[0197] Figure 6 is an application example diagram of a configuration update method provided by an embodiment of the present invention, such as Figure 6 As shown, the method is applied to serving Player (player) and configuring the server, and the method may include:
[0198] During the startup of the service Player, the values of CONFIGENV (configuration environment) and APPENV (application environment) in the system are obtained through the preset configuration component, and the values of CONFIGENV and APPENV are concatenated with the service name and other information to generate a namespace, and then a configuration acquisition request containing the namespace is sent to the configuration server;
[0199] When CONFIGENV is DEV (development environment), and the namespace is env.dev.player, the service configuration corresponding to env.dev.player is returned from the configuration server, and the service Player is configured according to the service configuration;
[0200] When CONFIGENV is TEST (test environment), and the namespace is env.test.player, the service configuration corresponding to env.test.player is returned from the configuration server, and the service Player is configured according to the service configuration;
[0201] When CONFIGENV is PRE (pre-release environment), and namespace is env.pre.player, the service configuration corresponding to env.pre.player is returned from the configuration server, and the service Player is configured according to the service configuration;
[0202] When CONFIGENV is PRO (production environment), the namespace is env.pro.player1, and the service configuration corresponding to env.pro.player1 is returned from the configuration server. The service Player is configured according to the service configuration. The service configuration corresponding to env.pro.player1 returned by the configuration server can also include the grayscale value corresponding to each configuration item, so as to perform grayscale release of the service configuration.
[0203] When the configuration server receives the change operation corresponding to env.pro.player1, it can obtain the changed configuration data env.pro.player2, then obtain the grayscale condition corresponding to the changed configuration data env.pro.player2, and send the changed configuration data env.pro.player2 to the service player that meets the grayscale condition.
[0204] The service player updates its operations according to the changed configuration data env.pro.player2.
[0205] Figure 7 is a structural block diagram of a configuration updating device 60 provided in an embodiment of the present invention, such as Figure 7 As shown, the device may include:
[0206] The change data determination module 601 is used to receive a change operation corresponding to a preset environment configuration and determine the change configuration data, wherein the preset environment configuration includes a namespace and a service configuration, and the namespace includes an application environment and a service name;
[0207] A grayscale condition determination module 602 is used to obtain the grayscale condition corresponding to the changed configuration data;
[0208] The service configuration sending module 603 is used to send the changed configuration data to the service corresponding to the grayscale condition, and the changed configuration data is used for the service corresponding to the grayscale condition to respond to the change operation and change the service configuration.
[0209] Optionally, the device further comprises:
[0210] An environment building module, used to build a preset environment configuration corresponding to at least one service;
[0211] A request receiving module, used to receive a configuration acquisition request sent by a service to be configured, wherein the configuration acquisition request includes the namespace, and the service to be configured is any service in at least one of the services;
[0212] A configuration acquisition module, used to acquire the service configuration corresponding to the namespace;
[0213] The configuration sending module is used to send the service configuration to the service to be configured, and the service configuration is used to configure the service to be configured.
[0214] Optionally, the configuration acquisition module includes:
[0215] A configuration item acquisition submodule, used to acquire at least one configuration item corresponding to the namespace;
[0216] A grayscale value acquisition submodule, used to acquire the grayscale value corresponding to each of the configuration items;
[0217] A configuration data acquisition submodule, configured to use the configuration item as target configuration data corresponding to the service to be configured when the gray value hits the service to be configured;
[0218] The service configuration determination submodule is used to splice each of the target configuration data corresponding to the service to be configured, and determine the service configuration corresponding to the service to be configured.
[0219] The configuration update device provided by the embodiment of the present invention is applied to a configuration server, and can receive a change operation on at least one configuration item in a preset environment configuration, thereby determining the changed configuration data, and then obtaining the grayscale condition corresponding to the changed configuration data, and sending the changed configuration data to the service corresponding to the grayscale condition, so that the service corresponding to the grayscale condition can respond to the aforementioned change operation according to the changed configuration data to update the configuration item, that is, the service can perform business updates on the changed configuration items according to the push of the changed configuration data, without actively pulling the changed configuration data and then restarting the service as a whole to load the pulled configuration data, thereby improving the response speed of the service configuration update and reducing the overhead, thereby improving the efficiency of software project research and development and verification.
[0220] Figure 8 is a structural block diagram of another configuration updating device 70 provided in an embodiment of the present invention. Figure 8 As shown, the device may include:
[0221] The service registration module 701 is used to register at least one configuration item of a service in a preset configuration component, and monitor the configuration change data pushed by the configuration server through the preset configuration component;
[0222] The data parsing module 702 is used to obtain the configuration item to be updated from the changed configuration data through the preset configuration component, and obtain the service to be updated through the configuration item to be updated in at least one of the services, wherein the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated;
[0223] The configuration updating module 703 is used to call the configuration item of the service to be updated through the preset configuration component, and update the configuration item of the service to be updated according to the configuration item to be updated.
[0224] Optionally, the device further comprises:
[0225] A request sending module, configured to send a configuration acquisition request to the configuration server through the preset configuration component, wherein the configuration acquisition request includes the namespace;
[0226] A configuration receiving module, used to receive the service configuration obtained by the configuration server according to the name space;
[0227] The service configuration module is used to parse the service configuration through the preset configuration component to perform service configuration.
[0228] Optionally, the preset configuration component is any one of a Java component, a Windows system dynamic library, and a Linux system dynamic library.
[0229] The configuration updating device provided by the embodiment of the present invention is applied to an application server, and can register at least one configuration item of a service in a preset configuration component, and listen to the changed configuration data pushed by the configuration server through the preset configuration component, and then obtain the configuration item to be updated from the changed configuration data through the preset configuration component, and obtain the service to be updated through the configuration item to be updated in the service, the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated; at this time, the configuration item of the service to be updated is called through the preset configuration component, and the configuration item of the service to be updated is updated according to the configuration item to be updated, that is, the service can perform business updates on the changed configuration items according to the changed configuration data pushed by the configuration server, without the service actively pulling the changed configuration data, and then restarting the service as a whole to load the pulled configuration data, thereby improving the response speed of the service configuration update and reducing the overhead, thereby improving the efficiency of software project development and verification.
[0230] An embodiment of the present invention further provides an electronic device, Fig. 9 is a structural block diagram of an electronic device provided by an embodiment of the present invention, such as Figure 7As shown, it includes a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.
[0231] Memory 803, used for storing computer programs;
[0232] The processor 801 is used to execute the program stored in the memory 803, and implements the following steps:
[0233] receiving a change operation on at least one configuration item in the preset environment configuration, and determining change configuration data, wherein the preset environment configuration includes a namespace and a service configuration corresponding to the namespace, and the service configuration includes at least one configuration item;
[0234] Obtaining a grayscale condition corresponding to the changed configuration data;
[0235] The changed configuration data is sent to the service corresponding to the grayscale condition, and the changed configuration data is used by the service corresponding to the grayscale condition to respond to the change operation to update the configuration item.
[0236] Optionally, the receiving of the change operation corresponding to the preset environment configuration, before determining the changed configuration data, further includes:
[0237] Build a preset environment configuration corresponding to at least one service;
[0238] receiving a configuration acquisition request sent by a service to be configured, wherein the configuration acquisition request includes the namespace, and the service to be configured is any service of at least one of the services;
[0239] Obtain the service configuration corresponding to the namespace;
[0240] The service configuration is sent to the service to be configured, and the service configuration is used to configure the service to be configured.
[0241] Optionally, the obtaining the service configuration corresponding to the namespace includes:
[0242] Obtain at least one configuration item corresponding to the namespace;
[0243] Obtaining the grayscale value corresponding to each of the configuration items;
[0244] In the case where the gray value hits the service to be configured, taking the configuration item as target configuration data corresponding to the service to be configured;
[0245] Each of the target configuration data corresponding to the service to be configured is spliced to determine the service configuration corresponding to the service to be configured.
[0246] The electronic device provided by the embodiment of the present invention can receive a change operation on at least one configuration item in a preset environment configuration, thereby determining the changed configuration data, and then obtaining the grayscale condition corresponding to the changed configuration data, and sending the changed configuration data to the service corresponding to the grayscale condition, so that the service corresponding to the grayscale condition can respond to the aforementioned change operation according to the changed configuration data to update the configuration item, that is, the service can perform business updates on the changed configuration items according to the push of the changed configuration data, without actively pulling the changed configuration data and then restarting the service as a whole to load the pulled configuration data, thereby improving the response speed of the service configuration update and reducing the overhead, thereby improving the efficiency of software project research and development and verification.
[0247] Alternatively, the processor 601 implements the following steps:
[0248] Register at least one service configuration item in the pre-configured configuration component;
[0249] The preset configuration component monitors the configuration change data pushed by the configuration server, wherein the configuration change data is generated based on a change operation on at least one configuration item in the preset environment configuration, and the preset environment configuration is stored in the configuration server;
[0250] Acquire a configuration item to be updated from the changed configuration data through the preset configuration component, and acquire a service to be updated through the configuration item to be updated in at least one of the services, wherein the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated;
[0251] The configuration item of the service to be updated is called by the preset configuration component, and the configuration item of the service to be updated is updated according to the configuration item to be updated.
[0252] Optionally, before the pre-configuration component registers the configuration item of at least one service, the method further includes:
[0253] Sending a configuration acquisition request to the configuration server through the preset configuration component, wherein the configuration acquisition request includes the namespace;
[0254] Receiving a service configuration obtained by the configuration server according to the namespace;
[0255] The service configuration is parsed through the preset configuration component to perform service configuration.
[0256] Optionally, the preset configuration component is any one of a Java component, a Windows system dynamic library, and a Linux system dynamic library.
[0257] The electronic device provided by the embodiment of the present invention can register at least one configuration item of a service in a preset configuration component, and monitor the changed configuration data pushed by the configuration server through the preset configuration component, and then obtain the configuration item to be updated from the changed configuration data through the preset configuration component, and obtain the service to be updated through the configuration item to be updated in the service, the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated; at this time, the configuration item of the service to be updated is called through the preset configuration component, and the configuration item of the service to be updated is updated according to the configuration item to be updated, that is, the service can perform business updates on the changed configuration items according to the changed configuration data pushed by the configuration server, without the service actively pulling the changed configuration data, and then restarting the service as a whole to load the pulled configuration data, thereby improving the response speed of the service configuration update and reducing the overhead, thereby improving the efficiency of software project research and development and verification.
[0258] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0259] The communication interface is used for communication between the above terminal and other devices.
[0260] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0261] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0262] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the configuration update method described in any one of the above embodiments.
[0263] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the configuration updating method described in any one of the above embodiments.
[0264] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0265] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0266] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0267] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A configuration update method, characterized in that: Applied to a system including a configuration server and an application server, the method includes: The configuration server receives a change operation on at least one configuration item in a preset environment configuration, and determines change configuration data, wherein the preset environment configuration includes a namespace and a service configuration corresponding to the namespace, and the service configuration includes at least one configuration item; The configuration server obtains the grayscale condition corresponding to the changed configuration data; The configuration server sends the changed configuration data to the service corresponding to the grayscale condition; The application server registers at least one configuration item of a service in a preset configuration component, and listens to the changed configuration data pushed by the configuration server through the preset configuration component; obtains the configuration item to be updated from the changed configuration data through the preset configuration component, and obtains the service to be updated through the configuration item to be updated in at least one of the services, wherein the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated; calls the configuration item of the service to be updated through the preset configuration component, and updates the configuration item of the service to be updated according to the configuration item to be updated.
2. The method according to claim 1, characterized in that The receiving of a change operation on at least one configuration item in the preset environment configuration and determining the changed configuration data further includes: Build a preset environment configuration corresponding to at least one service; receiving a configuration acquisition request sent by a service to be configured, wherein the configuration acquisition request includes the namespace, and the service to be configured is any service of at least one of the services; Obtain the service configuration corresponding to the namespace; The service configuration is sent to the service to be configured, and the service configuration is used to configure the service to be configured.
3. The method according to claim 2, characterized in that The obtaining the service configuration corresponding to the namespace includes: Obtain at least one configuration item corresponding to the namespace; Obtaining the grayscale value corresponding to each of the configuration items; In the case where the gray value hits the service to be configured, taking the configuration item as target configuration data corresponding to the service to be configured; Each of the target configuration data corresponding to the service to be configured is spliced to determine the service configuration corresponding to the service to be configured.
4. The method according to claim 1, characterized in that Before the pre-configuration component registers the configuration item of at least one service, the method further includes: Sending a configuration acquisition request to the configuration server through the preset configuration component, wherein the configuration acquisition request includes a namespace; Receiving a service configuration obtained by the configuration server according to the namespace; The service configuration is parsed through the preset configuration component to perform service configuration.
5. The method according to claim 4, characterized in that The preset configuration component is any one of a Java component, a Windows system dynamic library, and a Linux system dynamic library.
6. A configuration update system, characterized in that: The system includes a configuration server and an application server. The configuration server is used to receive a change operation on at least one configuration item in a preset environment configuration, determine the changed configuration data, obtain the grayscale condition corresponding to the changed configuration data, and then send the changed configuration data to the service corresponding to the grayscale condition, wherein the preset environment configuration includes a namespace and a service configuration corresponding to the namespace, and the service configuration includes at least one configuration item; The application server is used to register the configuration item of at least one service in the preset configuration component, and listen to the changed configuration data pushed by the configuration server through the preset configuration component; obtain the configuration item to be updated from the changed configuration data through the preset configuration component, and obtain the service to be updated through the configuration item to be updated in at least one of the services, wherein the configuration item to be updated is the configuration item corresponding to the change operation, and the service to be updated is the service including the configuration item to be updated; call the configuration item of the service to be updated through the preset configuration component, and update the configuration item of the service to be updated according to the configuration item to be updated.
7. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, used to implement the configuration update method described in any one of claims 2-5 when executing a program stored in a memory.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the configuration updating method as described in any one of claims 2 to 5 is implemented.
Citation Information
Patent Citations
Method for managing application configuration parameters in concentrated mode and method for configuring application parameters
CN104022894A
Configuration updating method and device and server
CN110099130A