Configuration information determination method and apparatus, device, and storage medium
Patent Information
- Application Number
- CN202211551831.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-05
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2042-12-05
AI Technical Summary
[0003]在上述方法中,为系统内的不同应用配置文件信息时,需要修改不同应用对应的加解密程序做编码适配,以使加解密程序与应用适配,导致获取配置文件信息的流程较长
[0019] This application provides a method, apparatus, device, and storage medium for determining configuration information, applied in scenarios where it is necessary to determine the configuration information corresponding to a configuration file.
Smart Images

Figure CN116225551B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a method, apparatus, device and storage medium for determining configuration information. Background Technology
[0002] Currently, there are several main methods for configuring configuration files for various services in an application: 1) Decrypting the configuration information in the configuration files of each service using a program written by the system component itself, and then connecting to the necessary database, middleware, or other systems to obtain the required configuration file information; 2) Using a third-party or self-packaged configuration file encryption / decryption component (such as jasypt) to decrypt the configuration files of each service to obtain the required configuration file information; 3) Using a configuration center (such as Apollo or Nacos) to uniformly configure all applications within the system, and obtaining the required configuration file information through the configuration center client.
[0003] In the above method, when configuring configuration information for different applications within the system, it is necessary to modify the encryption and decryption programs corresponding to different applications for encoding adaptation to ensure compatibility between the encryption and decryption programs and the applications. This results in a lengthy process for obtaining configuration file information. Consequently, the efficiency of determining the configuration information corresponding to the configuration file is relatively low. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for determining configuration information, which improves the efficiency of determining the configuration information corresponding to the configuration file.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] Firstly, a method for determining configuration information is provided. This method includes: starting a JAVA program, calling the premain entry point of the JAVA agent via Bootstrap, and loading a configuration management plugin through the JAVA agent. The premain entry point is implemented using Sky Walking Agent. The JAVA main method is called via Bootstrap to load the target program configuration file and read preset configuration information from it. The configuration management plugin is called via the JAVA main method, and when the configuration management plugin determines that the preset configuration information in the target program configuration file should be replaced with the target configuration information, the target configuration information is returned to the JAVA main method. The target configuration information is the configuration information pre-set in the configuration management plugin. The preset configuration information in the target program configuration file is replaced with the target configuration information via the JAVA main method.
[0007] In one possible implementation, the method further includes: when the configuration management plugin determines that the preset configuration information in the target program configuration file should not be replaced with the target configuration information, returning the preset configuration information to the JAVA main method; and keeping the preset configuration information in the target program configuration file unchanged.
[0008] In one possible implementation, the target program configuration file includes target keywords; before returning the target configuration information to the JAVA main method when the configuration management plugin determines that the preset configuration information in the target program configuration file should be replaced with the target configuration information, the method further includes: determining whether the target keyword is the keyword corresponding to the target configuration information through the configuration management plugin, and different target configuration information corresponds to different keywords; when it is determined that the target keyword is the keyword corresponding to the target configuration information, it is determined that the preset configuration information in the target program configuration file should be replaced with the target configuration information.
[0009] In one possible implementation, determining whether the target keyword is the same as the keyword corresponding to the target configuration information is done through a configuration management plugin. This includes: calling the configuration management server through the configuration management plugin, and determining whether the target keyword is the same as the keyword corresponding to the target configuration information through the configuration management server.
[0010] In one possible implementation, the method further includes: modifying the pre-set target configuration information in the configuration management plugin through the configuration management server to determine the modified target configuration information; obtaining the modified target configuration information from the configuration management server through the configuration management plugin and triggering a restart of the JAVA program.
[0011] Secondly, a configuration information determination device is provided, comprising: a processing unit and a transmission unit; the processing unit is used to start a JAVA program, call the premain entry point of the JAVA agent through Bootstrap, and load the configuration management plugin through the JAVA agent, the premain entry point being implemented through Sky Walking Agent; the processing unit is also used to call the JAVA main method through Bootstrap to load the target program configuration file through the JAVA main method and read preset configuration information from the target program configuration file; the processing unit is also used to call the configuration management plugin through the JAVA main method; the transmission unit is used to return the target configuration information to the JAVA main method when the configuration management plugin determines that the preset configuration information in the target program configuration file should be replaced with the target configuration information, the target configuration information being the configuration information pre-set in the configuration management plugin; the processing unit is also used to replace the preset configuration information in the target program configuration file with the target configuration information through the JAVA main method.
[0012] In one possible implementation, the transmission unit is further configured to return the preset configuration information to the JAVA main method when the configuration management plugin determines that the preset configuration information in the target program configuration file should not be replaced with the target configuration information; the processing unit is further configured to keep the preset configuration information in the target program configuration file unchanged.
[0013] In one possible implementation, the target program configuration file includes a target keyword; the processing unit is further configured to determine whether the target keyword is the keyword corresponding to the target configuration information 5 through the configuration management plugin, and different target configuration information corresponds to different keywords; the processing unit is further configured to determine to replace the preset configuration information in the target program configuration file with the target configuration information when it is determined that the target keyword is the keyword corresponding to the target configuration information.
[0014] In one possible implementation, the processing unit is further configured to call the configuration management server through the configuration management plugin, and determine through the configuration management server whether the target keyword is the keyword corresponding to the target 0 configuration information.
[0015] In one possible implementation, the processing unit is further configured to modify the target configuration information pre-set in the configuration management plugin through the configuration management server, and determine the modified target configuration information; the transmission unit is further configured to obtain the modified target configuration information from the configuration management server through the configuration management plugin; and the processing unit is further configured to trigger the restart of the JAVA program.
[0016] 5. A third aspect, an electronic device, comprising: a processor and a memory; wherein the memory...
[0017] The processor is used to store one or more programs, which include computer-executable instructions. When the electronic device is running, the processor executes the computer-executable instructions stored in the memory to cause the electronic device to perform a configuration information determination method as described in the first aspect.
[0018] Fourthly, a computer-readable storage medium is provided for storing one or more programs, wherein the one or more programs include instructions that, when executed by a computer, cause the computer to perform a configuration information determination method as described in the first aspect.
[0019] This application provides a method, apparatus, device, and storage medium for determining configuration information, applied in scenarios where it is necessary to determine the configuration information corresponding to a configuration file.
[0020] When configuring the information, you can start a Java program, call the premain entry point of Java agent5 (which has been implemented by SkyWalking Agent) via Bootstrap, and load the configuration management plugin through the Java agent; then, call the Java main method via Bootstrap to load the target program configuration file and read the preset configuration information from the target program configuration file; furthermore, call the configuration management plugin through the Java main method, and then...
[0021] When the management plugin determines that the preset configuration information in the target program's configuration file should be replaced with the target configuration information, it returns the target configuration information pre-set in the configuration management plugin to the Java main method.
[0022] This method replaces the preset configuration information in the target application's configuration file with the target configuration information via the Java main method. When it's necessary to determine the configuration information corresponding to a configuration file, a configuration management plugin can be loaded via the Java agent, and then the configuration management plugin can be called via the Java main method to determine the target configuration information to be replaced. This solves the problem of the lengthy process of obtaining configuration information when determining the configuration information corresponding to different applications within the system, which requires modifying the encryption / decryption programs for encoding adaptation. Therefore, it improves the efficiency of determining the configuration information corresponding to a configuration file. Attached Figure Description
[0023] Figure 1 A schematic diagram of a configuration information determination system structure provided for embodiments of this application;
[0024] Figure 2 A schematic flowchart of a configuration information determination method provided for embodiments of this application. Figure 1 ;
[0025] Figure 3 A schematic flowchart of a configuration information determination method provided for embodiments of this application. Figure 2 ;
[0026] Figure 4 A schematic flowchart of a configuration information determination method provided for embodiments of this application. Figure 3 ;
[0027] Figure 5 A schematic flowchart of a configuration information determination method provided for embodiments of this application. Figure 4 ;
[0028] Figure 6 A schematic flowchart of a configuration information determination method provided for embodiments of this application. Figure 5 ;
[0029] Figure 7 A schematic flowchart of a configuration information determination method provided for embodiments of this application. Figure 6 ;
[0030] Figure 8 A schematic diagram of a configuration information determination device provided for an embodiment of this application;
[0031] Figure 9 This is a schematic diagram of an electronic device structure provided for an embodiment of this application. Detailed Implementation
[0032] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0033] In the description of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. "And / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" and "multiple" refer to two or more. The terms "first," "second," etc., do not limit the quantity or order of execution, and "first," "second," etc., do not necessarily imply differences.
[0034] Currently, when configuring configuration files for each service in an application, you can either write your own program using system components to decrypt the configuration information in the configuration files of each service, and then connect to the necessary databases or other middleware or systems; you can use third-party or self-encapsulated configuration file encryption / decryption components to decrypt the configuration files of each service; you can use a configuration center to uniformly configure each application within the system, and obtain the configuration file information required by the application through the configuration center client; or you can use configuration templates to abstract each service to be configured, deploy proxy service devices on each server within the system, and when changes occur, notify the proxy service devices through the configuration server to control application updates.
[0035] The above method requires intrusive modifications to each subsystem. When configuring information for different applications within the system, the encryption and decryption programs corresponding to different applications need to be modified for encoding adaptation, resulting in a long and cumbersome process. Furthermore, multiple modifications are prone to errors, wasting time and effort.
[0036] This application provides a method for determining configuration information. When it is necessary to determine the configuration information corresponding to a configuration file, a JAVA program can be started. The bootstrap method calls the premain entry point of the JAVA agent, which has been implemented by Sky Walking Agent, and loads the configuration management plugin through the JAVA agent. Then, the bootstrap method calls the JAVA main method to load the target program configuration file and read preset configuration information from it. Further, the JAVA main method calls the configuration management plugin, and when the configuration management plugin determines that the preset configuration information in the target program configuration file should be replaced with the target configuration information, it returns the pre-set target configuration information to the JAVA main method. Thus, the JAVA main method replaces the preset configuration information in the target program configuration file with the target configuration information. Through this method, when it is necessary to determine the configuration information corresponding to a configuration file, the JAVA agent can load the configuration management plugin, and then the JAVA main method can call the configuration management plugin to determine the target configuration information to be replaced. This solves the problem that when determining the configuration information corresponding to a configuration file for different applications within the system, it is necessary to modify the encryption / decryption programs corresponding to different applications for encoding adaptation, resulting in a long process for obtaining configuration information. This improves the efficiency of determining the configuration information corresponding to the configuration file.
[0037] The configuration information determination method provided in this application embodiment can be applied to a configuration information determination system. Figure 1 A schematic diagram of the configuration information determination system is shown. For example... Figure 1 As shown, the configuration information determination system 20 includes a server 21 and a terminal device 22. The server 21 stores data and interacts with the terminal device 22; the terminal device 22 interacts with the server 21 to determine the configuration information corresponding to the configuration file.
[0038] The following describes a method for determining configuration information provided by an embodiment of this application, with reference to the accompanying drawings. Figure 2 As shown in the embodiment of this application, a configuration information determination method is provided and applied to an electronic device. The method includes S201-S204:
[0039] S201. Start the JAVA program, call the premain entry point of the JAVA agent through Bootstrap, and load the configuration management plugin through JAVAagent.
[0040] The premain entry point is implemented through the Sky Walking Agent.
[0041] It is understandable that a JAVA program can be launched through an electronic device, and the premain entry point of the JAVA agent can be called through Bootstrap, thereby loading the adapted configuration management plugin through the JAVA agent.
[0042] Alternatively, the JAVA agent can be the Sky Walking Agent, which can be pre-installed on a server with a configuration management plugin.
[0043] It should be noted that the configuration management plugin can use Java Agent technology to manage the applications to be configured, obtain the configuration parameter data (i.e., target configuration information) of the applications to be configured, determine the search keywords for each parameter in the configuration parameter data based on the obtained configuration parameter data, and generate a unified configuration file. The address of the Java Agent can be added to the startup script of each service within the system, and the search keywords corresponding to the unified configuration information can be configured in the configuration file of each service, and then all services can be started.
[0044] Optionally, the configuration management plugin can obtain the original configuration file of the application to be configured, generate original configuration parameters based on the original configuration file, process the original configuration parameters, and remove duplicate data in the original configuration parameters to obtain the configuration parameter data of the application to be configured. The configuration management plugin can provide the configuration parameter data while the application to be configured is running.
[0045] S202. Call the JAVA main method through Bootstrap to load the target program configuration file and read the preset configuration information from the target program configuration file.
[0046] It is understandable that electronic devices can call the Java main method through Bootstrap to load the target program configuration file through the Java main method. After the Java main method is executed, the Java program runs to the instance initialization phase, and reads the preset configuration information from the target program configuration file during instantiation.
[0047] It should be noted that the preset configuration information can be the original configuration information in the target program's configuration file.
[0048] S203. Call the configuration management plugin through the JAVA main method, and when the configuration management plugin determines that the preset configuration information in the target program configuration file should be replaced with the target configuration information, return the target configuration information to the JAVA main method.
[0049] 5. Among them, the target configuration information is the configuration information pre-set in the configuration management plugin.
[0050] It is understandable that when initializing the application to be configured, the electronic device can call the configuration management plugin through the JAVA main method when loading the target configuration information, and return the target configuration information to the JAVA main method when the configuration management plugin determines that the preset configuration information in the target program configuration file should be replaced with the target configuration information.
[0051] Optionally, when the configuration management plugin determines to replace the preset configuration information in the target program configuration file with the target configuration information, the configuration management plugin can decrypt the target configuration information corresponding to the preset configuration information in the unified configuration file and return the target configuration information to the JAVA main method.
[0052] S204. Replace the preset configuration information in the target program configuration file with the target configuration information through the JAVA main method.
[0053] It is understandable that after the configuration management plugin decrypts the target configuration information corresponding to the preset configuration information in the unified configuration file, the electronic device can replace the preset configuration information in the target program configuration file with the target configuration information through the JAVA main method.
[0054] This application provides a method for determining configuration information. When it is necessary to determine the configuration information corresponding to a configuration file, a JAVA program can be started. The Bootstrap method calls the premain entry point of the JAVA agent, which has been implemented by Sky Walking Agent, and loads the configuration management plugin through the JAVA agent. Then, the Bootstrap method calls the JAVA main method to load the target program configuration file and read preset configuration information from it. Further, the JAVA main method calls the configuration management plugin, and when the configuration management plugin determines that the preset configuration information in the target program configuration file should be replaced with the target configuration information, it returns the pre-set target configuration information to the JAVA main method. Thus, the JAVA main method replaces the preset configuration information in the target program configuration file with the target configuration information. Using this method, when it is necessary to determine the configuration information corresponding to a configuration file, the JAVA agent can load the configuration management plugin, and then the JAVA main method can call the configuration management plugin to determine the target configuration information to be replaced. This solves the problem that when determining the configuration information corresponding to a configuration file for different applications within the system, it is necessary to modify the encryption / decryption programs corresponding to different applications for encoding adaptation, resulting in a long process for obtaining configuration information. This improves the efficiency of determining the configuration information corresponding to the configuration file.
[0055] In a design, such as Figure 3As shown in the embodiment of this application, a configuration information determination method is provided, which further includes steps S301-S302:
[0056] S301. When the configuration management plugin determines that the preset configuration information in the target program configuration file should not be replaced with the target configuration information, the preset configuration information is returned to the JAVA main method.
[0057] It is understandable that electronic devices can use the configuration management plugin to determine whether the preset configuration information in the target program configuration file is the target configuration information. When the configuration management plugin determines that the preset configuration information in the target program configuration file should not be replaced with the target configuration information, it returns the preset configuration information to the JAVA main method.
[0058] Optionally, the configuration management plugin can determine whether the preset configuration information in the target program's configuration file matches the replacement rules, and whether the preset configuration information in the target program's configuration file is the target configuration information. If the preset configuration information in the target program's configuration file matches the target configuration information, then the replacement rules are not met, and the preset configuration information is returned to the Java main method; if the preset configuration information in the target program's configuration file does not match the target configuration information, then the replacement rules are met, and the preset configuration information is not returned to the Java main method.
[0059] S302. Keep the preset configuration information in the target program configuration file unchanged.
[0060] It is understandable that when the JAVA main method receives the configuration information returned by the configuration management plugin as the preset configuration information, it is determined that there is no need to replace the preset configuration information in the target program configuration file, and the preset configuration information in the target program configuration file can remain unchanged.
[0061] In one design, the target program configuration file includes target keywords. For example... Figure 4 As shown, the configuration information determination method provided in this application embodiment includes steps S401-S402 before the method of "returning the target configuration information to the JAVA main method when the preset configuration information in the target program configuration file is determined to be replaced with the target configuration information by the configuration management plugin" in step S203:
[0062] S401. Determine whether the target keyword is the keyword corresponding to the target configuration information through the configuration management plugin.
[0063] Different target configuration information corresponds to different keywords.
[0064] It is understandable that electronic devices can use configuration management plugins to determine whether the target keyword in the target program configuration file is the same as the keyword corresponding to the target configuration information.
[0065] Optionally, the configuration management plugin can determine whether the preset configuration information in the target program configuration file conforms to the replacement rules by judging whether the target keyword in the target program configuration file is the same as the keyword corresponding to the target configuration information. If the target keyword in the target program configuration file is the same as the keyword corresponding to the target configuration information, then the preset configuration information in the target program configuration file does not conform to the replacement rules; if the target keyword in the target program configuration file is not the same as the keyword corresponding to the target configuration information, then the preset configuration information in the target program configuration file conforms to the replacement rules.
[0066] S402. When it is determined that the target keyword is the keyword corresponding to the target configuration information, it is determined that the preset configuration information in the target program configuration file will be replaced with the target configuration information.
[0067] It is understandable that electronic devices can use configuration management plugins to determine whether the target keyword is the same as the keyword corresponding to the target configuration information. When it is determined that the target keyword is the same as the keyword corresponding to the target configuration information, the preset configuration information in the target program configuration file will be replaced with the target configuration information.
[0068] It should be noted that, in cases including steps S401-S402, the method in step S203 above may specifically include "calling the configuration management plugin through the JAVA main method".
[0069] In a design, such as Figure 5 As shown, in the configuration information determination method provided in this application embodiment, the method of "determining whether the target keyword is the keyword corresponding to the target configuration information through the configuration management plugin" in step S401 above specifically includes S501:
[0070] S501: The configuration management plugin calls the configuration management server, and the configuration management server determines whether the target keyword is the keyword corresponding to the target configuration information.
[0071] It is understandable that electronic devices can call the configuration management server through the configuration management plugin, and the configuration management server can determine whether the target keyword is the keyword corresponding to the target configuration information.
[0072] Optionally, the preset configuration information in the target program configuration file can be directly replaced with the target configuration information without using the configuration management plugin. A configuration management server can be added to one of the multiple servers, and then the configuration management plugin can call the configuration management server to achieve a unified transformation solution across hosts (i.e., the management server on one server can uniformly manage the applications to be configured on multiple servers and determine the configuration information corresponding to the configuration file).
[0073] It should be noted that the configuration management server is a device used to obtain the configuration management plugins corresponding to the multiple applications to be configured in the cluster. The configuration manager no longer independently saves the configuration parameter data of each application to be configured, but can save the configuration parameter data of each application to be configured through the configuration management server.
[0074] In a design, such as Figure 6 As shown in the embodiment of this application, a configuration information determination method is provided, which further includes steps S601-S602:
[0075] S601. Modify the target configuration information preset in the configuration management plugin through the configuration management server, and determine the modified target configuration information.
[0076] It is understandable that administrators (operations and maintenance personnel) can modify the target configuration information pre-set in the configuration management plugin through the configuration management server, and electronic devices can then determine the modified target configuration information in the configuration management plugin.
[0077] S602: Obtain the modified target configuration information from the configuration management server through the configuration management plugin, and trigger the restart of the JAVA program.
[0078] It is understandable that electronic devices can obtain modified target configuration information from the configuration management server through the configuration management plugin, and trigger the restart of the JAVA program through the startup manager.
[0079] Optionally, a startup manager can be added to the server where the configuration management server resides among multiple servers. The configuration manager periodically synchronizes the target configuration information and periodically checks whether the target configuration information in the configuration management service has been updated through the configuration management plugin. When the target configuration information in the configuration management service changes, it notifies the startup manager to trigger a restart of the current JAVA program.
[0080] It should be noted that the Startup Manager is used to manage the restart of applications to be configured on multiple servers. The Startup Manager configures the startup method for each application to be configured.
[0081] In one implementation, such as Figure 7 The image shows a method for determining configuration information provided in an embodiment of this application. When it is necessary to determine the configuration information corresponding to the configuration file, the JAVA agent can be invoked through the Bootstrap of the JAVA 5 Virtual Machine (JVM).
[0082] The entry point (implemented by Sky Walking Agent) loads a custom management plugin (configuration management plugin), and the plugin loading process is complete. Then, the Java Virtual Machine's Bootstrap calls the Java main method (main class), which loads the target application.
[0083] The target program configuration file is used, and the preset configuration information is read from the target program configuration file during instantiation. The configuration management plugin is called through the JAVA main method, and this behavior is proxied to the configuration management plugin.
[0084] Furthermore, the configuration management plugin calls the configuration management server, and the configuration management server determines whether the preset configuration information in the target program's configuration file conforms to the replacement rules, and then decrypts it.
[0085] The configuration management plugin receives the target configuration information corresponding to the configuration management plugin and returns the target configuration information to the configuration management plugin. The configuration management plugin records the target configuration information and returns it to the Java main method. When the administrator modifies the target configuration information in the configuration management server, the configuration management plugin periodically pulls the modified target configuration information from the configuration manager, and the configuration manager returns the modified target configuration information to the configuration management plugin.
[0086] The system compares the modified target configuration information with the original target configuration information to determine if the target configuration information has been updated. If the target configuration information has been updated, the system notifies the startup manager to restart the current Java program. The startup manager then triggers the Java Virtual Machine to restart the current Java program.
[0087] This application provides a method for determining configuration information, which is based on a JAVA agent.
[0088] The basic idea behind this technique is to use Java agent technology to proxy the initialization or retrieval methods of the storage class in the configuration files of a subsystem. By reading the replacement configuration from the Java agent, the necessary values are replaced with the configured values. This method requires developing proxy implementations for the initialization or retrieval methods of the storage class corresponding to each subsystem. Then, by injecting the Java agent when the Java Virtual Machine starts, unified configuration across multiple subsystems can be achieved. This method is based on Java agent implementation.
[0089] The basic implementation uses the Sky Walking Agent plugin, followed by a custom password encryption module that uses the Sky Walking Agent plugin to proxy the corresponding subsystem configuration storage class.
[0090] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, it includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0091] This application embodiment can divide a configuration information determination method into functional modules based on the above method example. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. Optionally, the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0092] Figure 8 This is a schematic diagram of a configuration information determining device provided in an embodiment of this application. Figure 8 As shown, a configuration information determining device 40 is used to improve the efficiency of determining the configuration information corresponding to the configuration file, for example, for performing... Figure 2 The diagram illustrates a configuration information determination method. The configuration information determination device 40 includes: a processing unit 401 and a transmission unit 402;
[0093] Processing unit 401 is used to start a JAVA program, call the premain entry point of the JAVA agent through Bootstrap, and load the configuration management plugin through the JAVA agent. The premain entry point is implemented through Sky Walking Agent.
[0094] The processing unit 401 is also used to call the JAVA main method through Bootstrap, so as to load the target program configuration file through the JAVA main method and read the preset configuration information from the target program configuration file;
[0095] Processing unit 401 is also used to call the configuration management plugin through the JAVA main method;
[0096] The transmission unit 402 is used to return the target configuration information to the JAVA main method when the configuration management plugin determines that the preset configuration information in the target program configuration file will be replaced with the target configuration information. The target configuration information is the configuration information preset in the configuration management plugin.
[0097] The processing unit 401 is also used to replace the preset configuration information in the target program configuration file with the target configuration information through the JAVA main method.
[0098] In one possible implementation, the transmission unit 402 is further configured to return the preset configuration information to the JAVA main method when the configuration management plugin determines that the preset configuration information in the target program configuration file will not be replaced with the target configuration information; the processing unit 401 is further configured to keep the preset configuration information in the target program configuration file unchanged.
[0099] In one possible implementation, the target program configuration file includes target keywords; processing unit 401 is further configured to determine, through a configuration management plugin, whether the target keywords correspond to the keywords of the target configuration information, wherein different target configuration information corresponds to different keywords; processing unit 401
[0100] It is also used to determine, when the target keyword is determined to be the keyword corresponding to the target configuration information, to replace the preset configuration information in the target 5 program configuration file with the target configuration information.
[0101] In one possible implementation, the processing unit 401 is further configured to call the configuration management server through the configuration management plugin, and determine through the configuration management server whether the target keyword is the keyword corresponding to the target configuration information.
[0102] In one possible implementation, the processing unit 401 is further configured to modify the target configuration information pre-set in the configuration management plugin through the configuration management server, and determine the modified target configuration.
[0103] The transmission unit 402 is also used to obtain modified target configuration information from the configuration management server through the configuration management plugin; the processing unit 401 is also used to trigger the restart of the JAVA program.
[0104] In the case of implementing the functions of the integrated modules described above in hardware, this application provides another possible structural schematic diagram (Figure 5) of the electronic device involved in the above embodiments. For example... Figure 9 As shown, an electronic device 60 is used to improve the efficiency of determining configuration information corresponding to a configuration file, for example, for performing... Figure 2The diagram illustrates a method for determining configuration information. The electronic device 60 includes a processor 601, a memory 602, and a bus 603. The processor 601 and the memory 602 are connected via the bus 603.
[0105] Processor 601 is the control center of the communication device. It can be a single processor or a collective term for more than one processing element. For example, processor 601 can be a general-purpose central processing unit (CPU) or other general-purpose processors. Among them, the general-purpose processor can be a microprocessor or any conventional processor.
[0106] As one embodiment, processor 601 may include one or more CPUs, for example Figure 9 CPU 0 and CPU 1 are shown in the diagram.
[0107] 5. The memory 602 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or it may be an electrically erasable programmable read-only memory (EEPROM), a disk storage medium or other magnetic storage device, or something capable of carrying or storing desired program code having an instruction or data structure and being able to...
[0108] Any other medium accessible by a computer, but not limited to this.
[0109] In one possible implementation, the memory 602 can exist independently of the processor 601. The memory 602 can be connected to the processor 601 via a bus 603 and is used to store instructions or program code. When the processor 601 calls and executes the instructions or program code stored in the memory 602, it can implement the configuration information determination method provided in this application embodiment.
[0110] In another possible implementation, the memory 602 can also be integrated with the processor 601.
[0111] Bus 603 can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0112] It should be pointed out that, Figure 9 The structure shown does not constitute a limitation on the electronic device 60. Except... Figure 9 In addition to the components shown, the electronic device 60 may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0113] As an example, combined Figure 8 The functions implemented by the processing unit 401 and the transmission unit 402 in the electronic device are the same as those of the processing unit 401 and the transmission unit 402 in the electronic device. Figure 9 The processor 601 in it has the same function.
[0114] Optional, such as Figure 9 As shown, the electronic device 60 provided in this application embodiment may further include a communication interface 604.
[0115] Communication interface 604 is used to connect with other devices via a communication network. This communication network can be Ethernet, a wireless access network, a wireless local area network (WLAN), etc. Communication interface 604 may include a receiving unit for receiving data and a transmitting unit for transmitting data.
[0116] In one design, the communication interface in the electronic device provided in this application embodiment can also be integrated into the processor.
[0117] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional units is used as an example. In practical applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the device can be divided into different functional units to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0118] This application also provides a computer-readable storage medium storing instructions. When a computer executes these instructions, the computer performs each step of the method flow shown in the above-described method embodiments.
[0119] Embodiments of this application provide a computer program product containing instructions that, when executed on a computer, cause the computer to perform a configuration information determination method as described in the above method embodiments.
[0120] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), registers, hard disks, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing, or any other form of computer-readable storage medium in the art.
[0121] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside within an application-specific integrated circuit (ASIC).
[0122] In the embodiments of this application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0123] Since the electronic devices, computer-readable storage media, and computer program products in the embodiments of this application can be applied to the above methods, the technical effects they can achieve can also be referred to the above method embodiments. The embodiments of this application will not be repeated here.
[0124] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the scope of protection of this application.
Claims
1. A method for determining configuration information, characterized in that, The method includes: The JAVA program is launched, and the premain entry point of the JAVA agent is called through Bootstrap. The configuration management plugin is loaded through the JAVA agent. The premain entry point is implemented through Sky Walking Agent. The Bootstrap method calls the Java main method to load the target program configuration file and read preset configuration information from the target program configuration file. The configuration management plugin is called through the JAVA main method, and when the configuration management plugin determines to replace the preset configuration information in the target program configuration file with the target configuration information, the target configuration information is returned to the JAVA main method. The target configuration information is the configuration information preset in the configuration management plugin. The JAVA main method replaces the preset configuration information in the target program configuration file with the target configuration information.
2. The method according to claim 1, characterized in that, The method further includes: When the configuration management plugin determines that the preset configuration information in the target program configuration file should not be replaced with the target configuration information, the preset configuration information is returned to the JAVA main method. Keep the preset configuration information in the target program configuration file unchanged.
3. The method according to claim 1 or 2, characterized in that, The target program configuration file includes target keywords; Before returning the target configuration information to the JAVA main method when the configuration management plugin determines to replace the preset configuration information in the target program configuration file with the target configuration information, the method further includes: The configuration management plugin determines whether the target keyword is the keyword corresponding to the target configuration information; different target configuration information corresponds to different keywords. When it is determined that the target keyword is the keyword corresponding to the target configuration information, it is determined that the preset configuration information in the target program configuration file will be replaced with the target configuration information.
4. The method according to claim 3, characterized in that, The step of determining whether the target keyword is a keyword corresponding to the target configuration information through the configuration management plugin includes: The configuration management plugin calls the configuration management server, and the configuration management server determines whether the target keyword is the keyword corresponding to the target configuration information.
5. The method according to claim 4, characterized in that, The method further includes: The target configuration information is modified by modifying the pre-set target configuration information in the configuration management plugin through the configuration management server, and the modified target configuration information is determined. The configuration management plugin retrieves the modified target configuration information from the configuration management server and triggers a restart of the JAVA program.
6. A configuration information determining device, characterized in that, The configuration information determination device includes: a processing unit and a transmission unit; The processing unit is used to start a JAVA program, call the premain entry point of the JAVA agent through Bootstrap, and load the configuration management plugin through the JAVA agent. The premain entry point is implemented through Sky Walking Agent. The processing unit is also configured to call the JAVA main method through the Bootstrap, so as to load the target program configuration file through the JAVA main method and read preset configuration information from the target program configuration file; The processing unit is also used to call the configuration management plugin through the JAVA main method; The transmission unit is used to return the target configuration information to the JAVA main method when the configuration management plugin determines that the preset configuration information in the target program configuration file should be replaced with the target configuration information, wherein the target configuration information is the configuration information preset in the configuration management plugin; The processing unit is further configured to replace the preset configuration information in the target program configuration file with the target configuration information through the JAVA main method.
7. The configuration information determining device according to claim 6, characterized in that, The transmission unit is further configured to return the preset configuration information to the JAVA main method when the configuration management plugin determines that the preset configuration information in the target program configuration file should not be replaced with the target configuration information; The processing unit is also configured to keep the preset configuration information in the target program configuration file unchanged.
8. The configuration information determining device according to claim 6 or 7, characterized in that, The target program configuration file includes target keywords; The processing unit is further configured to determine, through the configuration management plugin, whether the target keyword is a keyword corresponding to the target configuration information, wherein different target configuration information corresponds to different keywords; The processing unit is further configured to, when determining that the target keyword is the keyword corresponding to the target configuration information, determine to replace the preset configuration information in the target program configuration file with the target configuration information.
9. The configuration information determining device according to claim 8, characterized in that, The processing unit is further configured to call the configuration management server through the configuration management plugin, and determine through the configuration management server whether the target keyword is the keyword corresponding to the target configuration information.
10. The configuration information determining device according to claim 9, characterized in that, The processing unit is further configured to modify the target configuration information pre-set in the configuration management plugin through the configuration management server, and determine the modified target configuration information; The transmission unit is also used to obtain the modified target configuration information from the configuration management server through the configuration management plugin; The processing unit is also used to trigger the restart of the JAVA program.
11. An electronic device, characterized in that, include: A processor and a memory; wherein the memory is used to store one or more programs, the one or more programs including computer execution instructions, wherein when the electronic device is running, the processor executes the computer execution instructions stored in the memory to cause the electronic device to perform a configuration information determination method according to any one of claims 1-5.
12. A computer-readable storage medium for storing one or more programs, characterized in that, The one or more programs include instructions that, when executed by a computer, cause the computer to perform a configuration information determination method as described in any one of claims 1-5.
Citation Information
Patent Citations
Configuration information replacement method and device, machine readable storage medium and processor
CN110968333A
Program configuration management method and device, storage medium and electronic equipment
CN112379948A