CN116775163B - Configuration file acquisition method and device, electronic equipment and storage medium - Google Patents

Configuration file acquisition method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116775163B
CN116775163B CN202311057819.7A CN202311057819A CN116775163B CN 116775163 B CN116775163 B CN 116775163B CN 202311057819 A CN202311057819 A CN 202311057819A CN 116775163 B CN116775163 B CN 116775163B
Authority
CN
China
Prior art keywords
middleware
target
configuration
application
template
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311057819.7A
Other languages
Chinese (zh)
Other versions
CN116775163A (en
Inventor
袁小利
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial Fulian Hangzhou Data Technology Co ltd
Shenzhen Fulian Fugui Precision Industry Co Ltd
Original Assignee
Industrial Fulian Hangzhou Data Technology Co ltd
Shenzhen Fulian Fugui Precision Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial Fulian Hangzhou Data Technology Co ltd, Shenzhen Fulian Fugui Precision Industry Co Ltd filed Critical Industrial Fulian Hangzhou Data Technology Co ltd
Priority to CN202311057819.7A priority Critical patent/CN116775163B/en
Publication of CN116775163A publication Critical patent/CN116775163A/en
Application granted granted Critical
Publication of CN116775163B publication Critical patent/CN116775163B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Stored Programmes (AREA)

Abstract

The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for acquiring a configuration file, an electronic device, and a storage medium. The configuration file acquisition method comprises the following steps: acquiring a configuration file template corresponding to the target application, wherein the configuration file template comprises configuration parameter fields required by the target application in the running process; acquiring middleware configuration information of a target middleware instance and application information of a target application, wherein the target middleware instance is a middleware instance for providing service for the target application; and determining the value of a configuration parameter field in the configuration file template based on the middleware configuration information and the application information, and generating a configuration file of the target application. The method and the device can lighten the workload of deployment personnel during application configuration, improve the accuracy of application configuration and simplify the subsequent maintenance operation on the configuration file.

Description

Configuration file acquisition method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for acquiring a configuration file, an electronic device, and a storage medium.
Background
An Application (Application) relies on a number of configuration parameters during its initialization or running, which are described in the configuration files of the Application. The configuration parameters of an application may change as the operating environment changes, which is a key factor in the proper operation of the application and in providing the correct data.
When an application is configured, an application deployment personnel can manually create or import a configuration file and then configure or modify configuration parameters of the application according to the actual running environment of the application.
However, the above manner increases the workload of the deployment personnel, and the manual configuration is easy to make mistakes, which may cause that the configuration file cannot be correctly read by the electronic device, so that the application is in error operation, and on the other hand, the configuration file may be diversified due to the difference of the configuration ideas of the deployment personnel, so that the maintenance difficulty and cost of the configuration file are increased.
Disclosure of Invention
In view of the above, the present application proposes a method, an apparatus, an electronic device, and a storage medium for obtaining a configuration file, which can reduce workload of deployment personnel during application configuration, improve accuracy of application configuration, and reduce maintenance difficulty and cost of the configuration file.
The embodiment of the application provides a configuration file acquisition method, which comprises the following steps: acquiring a configuration file template corresponding to the target application, wherein the configuration file template comprises configuration parameter fields required by the target application in the running process; acquiring middleware configuration information of a target middleware instance and application information of a target application, wherein the target middleware instance is a middleware instance for providing service for the target application; and determining the value of a configuration parameter field in the configuration file template based on the middleware configuration information and the application information, and generating a configuration file of the target application.
By adopting the technical scheme, the configuration file is automatically generated, the time and the workload of configuration modification by deployment personnel can be saved, the risk that the application cannot normally run due to manual operation of the configuration file is reduced, the accuracy of application configuration is improved, and further the application deployment efficiency is improved.
In some embodiments, the configuration file template includes an application template of the target application, and a target middleware template corresponding to a target middleware type to which the target middleware instance belongs, the configuration parameter field in the application template includes an application configuration field, and the configuration parameter field in the target middleware template includes a target middleware configuration field; the determining the value of the configuration parameter field in the configuration file template based on the middleware configuration information and the application information, and generating the configuration file of the target application, includes: determining a value of a target middleware configuration field in the target middleware template based on the middleware configuration information to obtain a first configuration key value pair corresponding to the target middleware instance; determining the value of an application configuration field in the application template based on the application information to obtain a second configuration key value pair corresponding to the target application; and generating a configuration file based on the first configuration key value pair and the second configuration key value pair.
Because the same type of target middleware can be shared by a plurality of applications, the configuration file template of the target application is divided into the target middleware template and the application template through the technical scheme, and the condition that when a plurality of applications use the same type of middleware instance, different formats or fields are used for defining middleware configuration parameters can be avoided, so that multiplexing of the middleware templates is realized.
In some embodiments, obtaining middleware configuration information for a target middleware instance includes: determining middleware configuration information of each candidate middleware instance with an association relation with the target middleware template; and determining the middleware configuration information of the target middleware instance in the middleware configuration information of each candidate middleware instance.
In some embodiments, determining middleware configuration information for each candidate middleware instance having an association with the target middleware template includes: providing a user interface, wherein the user interface is used for setting the association relation between each pre-stored middleware template and each currently deployed middleware instance; and determining middleware configuration information of each candidate middleware instance with an association relation with the target middleware template based on the setting operation of the target middleware template received by the user interface.
In some embodiments, before the obtaining the profile template corresponding to the target application, the method further includes: acquiring configuration parameter fields of various application programs; acquiring a configuration file format; generating each type of configuration file templates matched with the configuration file formats based on the configuration parameter fields of each type of application programs; the obtaining the configuration file template corresponding to the target application comprises the following steps: and determining a profile template corresponding to the target application in the profile templates of the various types.
In some embodiments, after the determining the value of the configuration parameter field in the configuration file template based on the middleware configuration information and the application information, generating a configuration file of the target application further includes: and if the configuration file needs to be changed, re-entering the step of acquiring the configuration file template corresponding to the target application.
In some embodiments, the target application runs in a target container, a namespace of the target container is a target namespace, and after the determining, based on the middleware configuration information and the application information, a value of the configuration parameter field in the configuration file template, generating a configuration file of the target application further includes: storing the configuration file in the target namespace; and mounting the configuration file stored in the target naming space to the target container.
The embodiment of the application also provides a configuration file acquisition device, which comprises:
the template acquisition module is used for acquiring a configuration file template corresponding to the target application, wherein the configuration file template comprises configuration parameter fields required by the target application in the running process;
the information acquisition module is used for acquiring middleware configuration information of a target middleware instance and application information of the target application, wherein the target middleware instance is a middleware instance for providing service for the target application;
and the configuration generation module is used for determining the value of the configuration parameter field in the configuration file template based on the middleware configuration information and the application information and generating the configuration file of the target application.
The embodiment of the application also provides electronic equipment, which comprises a processor and a memory, wherein the memory is used for storing instructions, and the processor is used for calling the instructions in the memory so that the electronic equipment executes the configuration file acquisition method.
The embodiment of the application also provides a computer readable storage medium, which stores computer instructions that, when executed on an electronic device, cause the electronic device to execute the configuration file acquisition method.
Drawings
FIG. 1 is a flowchart illustrating steps of a method for acquiring a configuration file according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating steps of a method for profile acquisition according to another embodiment of the present application;
fig. 3 is a schematic structural diagram of a configuration file acquisition device according to another embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to another embodiment of the present application.
Detailed Description
In order that the above-recited objects, features and advantages of the present application will be more clearly understood, a more particular description of the application will be rendered by reference to the appended drawings and appended detailed description. In addition, embodiments of the present application and features of the embodiments may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application, and the described embodiments are merely some, rather than all, of the embodiments of the present application.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the description of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
It is further intended that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The term "at least one" in this application means one or more, and "a plurality" means two or more. "and/or", describes an association relationship of an association object, and the representation may have three relationships, for example, a and/or B may represent: a alone, a and B together, and B alone, wherein a, B may be singular or plural. The terms "first," "second," "third," "fourth" and the like in the description and in the claims and drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
In the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as examples, illustrations, or descriptions. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
Namespaces (namespaces): the method is to abstract and integrate a group of resources and objects, different namespaces can be created in the same cluster, and data in the different namespaces are isolated from each other, so that the data can share services of the same cluster and can not interfere with each other.
ConfigMap: is an application programming interface (Application Programming Interface, API) object that stores non-encrypted data into key-value pairs that can be used as an environment variable, command line parameter, or configuration file in a storage volume. The ConfigMap can decouple the environment variable configuration information and the container mirror image, so that the modification of the application configuration is facilitated.
An Application (Application) relies on a number of configuration parameters during its initialization or running, which are described in the configuration files of the Application. The configuration parameters of an application may change as the operating environment changes, which is a key factor in the proper operation of the application and in providing the correct data.
When an application is configured, an application deployment personnel can manually create or import a configuration file and then configure or modify configuration parameters of the application according to the actual running environment of the application.
For example, an application deployment personnel can create a namespace of an application in a cluster, deploy middleware examples required by the running of the application, create or import a configuration file (such as a ConfigMap) under the namespace, then manually modify configuration parameters in the configuration file, and if a container corresponding to the application cannot normally run, modify the configuration parameters in the configuration file again until the application can easily run normally.
However, the above manner may increase workload of deployment personnel, and manual configuration is prone to error, which may cause that a configuration file cannot be correctly read by the electronic device, so that an application operates in error, and on the other hand, the configuration file is diversified due to the configuration thought of the deployment personnel, so that the configuration file is difficult to maintain.
In view of the foregoing, an embodiment of the present application provides a method for acquiring a configuration file, including: acquiring a configuration file template corresponding to the target application, wherein the configuration file template comprises configuration parameter fields required by the target application in the running process; acquiring middleware configuration information of a target middleware instance and application information of a target application, wherein the target middleware instance is a middleware instance for providing service for the target application; and determining the value of a configuration parameter field in the configuration file template based on the middleware configuration information and the application information, and generating a configuration file of the target application.
According to the method and the device for automatically generating the configuration file, the configuration time and workload of deployment personnel for modifying the configuration can be saved, the risk that the application cannot normally run due to manual operation of the configuration file is reduced, the accuracy of application configuration is improved, the application deployment efficiency is further improved, in addition, the standardization and unification of the configuration file format and the configuration parameter fields can be realized through the configuration file template, and the maintenance of the follow-up configuration file is facilitated.
The configuration file acquisition method can be applied to one or more electronic devices. The electronic device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and its hardware includes, but is not limited to, a processor, a micro-program controller (Microprogrammed Control Unit, MCU), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a programmable gate array (Field-Programmable Gate Array, FPGA), a digital processor (Digital Signal Processor, DSP), an embedded device, and the like. The electronic device may be a portable electronic device (e.g., a cell phone, tablet computer), a personal computer, a server, etc.
FIG. 1 is a flowchart illustrating steps of an embodiment of a profile acquisition method of the present application. The order of the steps in the flow diagrams may be changed, and some steps may be omitted, according to different needs.
Referring to fig. 1, the profile acquisition method may include the following steps.
Step 101, a configuration file template corresponding to a target application is obtained.
The target application is an application to which the configuration file is to be mounted. The application type of the target application is not limited in this application.
A configuration file is a computer file that can configure parameters and initial settings for some computer programs. The profile template includes configuration parameter fields (keys) that are required by the target application during runtime.
The configuration parameter field may include an application program identification (AppID) of the target application, a version number of the target application, a connection string of the target application to the database, a user name and password of a middleware instance used by the target application, and the like.
In the actual application process, the configuration parameter field may be set according to the function of the target application and the running environment of the target application, and the specific configuration parameter field is not limited in this embodiment. For example, a developer or an operator may extract key configuration parameter fields that change as the target application changes with the running environment as configuration parameter fields in a configuration file.
The data format of each value (value) corresponding to each configuration parameter field point can also be defined in the configuration file template. The data format may include data types such as integer, floating point, etc., and regular expressions, etc., but is not limited thereto. The data format requirements of the configuration file can be met by defining the data format, and the unification and standardization of the numerical values in the configuration file are facilitated.
In some embodiments, the configuration file templates include application templates of the target application, and target middleware templates corresponding to target middleware types to which the target middleware instance belongs. Step 101 may include: the electronic equipment provides a user interface, a user can select an application template and a target middleware template of the target application on the user interface, and the electronic equipment responds to user operation to establish a mapping relation between the application template and the target middleware template so as to facilitate the subsequent setting of configuration parameter fields of the target application.
The target middleware instance is used for providing services for the target application in the running process of the target application. The middleware type may include MySql, redis, kafka, etc., but is not limited thereto, and may be set based on programs and functions of the target application in the actual application process.
The configuration parameter fields in the target middleware template include a target middleware configuration field, that is, a configuration parameter field required for the target middleware to normally operate in the operating environment, for example, if the target middleware is MySql, the target middleware configuration field may include a user name (user) and a port number (port) connected to MySql, and the like.
The configuration parameter fields in the application template include application configuration fields that can be set as some configuration parameter fields in the configuration file other than the target middleware configuration field, and the application configuration fields can also be set according to the user requirements. For example, an application program identification (AppID), a version number of the target application may be used as the application configuration field.
In some embodiments, the electronic device may obtain configuration parameter fields of various types of applications, generate various types of configuration file templates based on the configuration parameter fields of the various types of applications, e.g., generate a middleware template based on the target middleware configuration field, generate application templates of various types of applications based on the application configuration fields of the various types of applications, and then determine a configuration file template corresponding to the target application in the various types of configuration file templates.
After each category of profile templates is generated, the name of the profile template may also be set to identify the profile template, where the name of the profile template may be set to a specific type of profile template, for example, an application template may be set to an application name, and a middleware template may be set to a middleware name.
The configuration files can have different formats, such as YAML format, ini format, toml format, JSON format and the like, and the configuration files in different formats are different in indentation, so that format problems are easily caused, and the configuration files cannot be read.
Thus, in some embodiments, generating the class profile template based on the configuration parameter fields of the class of applications may include: the configuration file format is obtained, and then each type of configuration file template matched with the configuration file format is generated based on the configuration parameter fields of each type of application program.
According to the method, the key-value format is formed by extracting the key configuration parameter fields, then the configuration parameter fields can be added into the corresponding configuration file templates according to the meanings of the configuration parameter fields, the configuration file templates with fixed formats of all types are generated, the situation that the configuration files cannot be read due to the format problems such as retraction is avoided, and the deployment efficiency is further improved.
In some embodiments, the target application may be deployed in a containerized form, i.e., the target application runs in a target container, the namespace of which is the target namespace. If the target namespaces do not exist in the cluster, the target namespaces can be generated based on the application names of the target applications so as to realize the deployment of the target applications. If a target namespace already exists in the cluster, the target application can be deployed directly to the target namespace and the subsequently generated configuration file can be stored in the target namespace. The configuration file, the network service and the load balancing required by the target application all occupy the resources of the target naming space.
Step 102, obtaining middleware configuration information of the target middleware instance and application information of the target application.
The target middleware instance is a middleware instance that provides services to the target application.
The middleware configuration information for the target middleware instance includes a value of a target middleware configuration field.
The application information includes a value of an application configuration field.
In some embodiments, obtaining the middleware configuration information for the target middleware instance in step 102 includes: and determining the middleware configuration information of each candidate middleware instance with an association relation with the target middleware template, and then determining the middleware configuration information of the target middleware instance in the middleware configuration information of each candidate middleware instance.
And the middleware types corresponding to the candidate middleware examples are the same as the middleware types corresponding to the target middleware templates.
In some embodiments, determining middleware configuration information for each candidate middleware instance having an association with the target middleware template may include: the electronic equipment acquires a middleware type corresponding to the target middleware template and the middleware type of each currently deployed middleware instance; comparing the middleware types of the currently deployed middleware examples with the middleware types of the currently deployed middleware examples, determining candidate middleware examples with association relation with the target middleware template, and obtaining the middleware configuration information of the candidate middleware examples.
In other embodiments, determining middleware configuration information for each candidate middleware instance having an association with a target middleware template includes: providing a first user interface, wherein the first user interface is used for setting the association relation between each pre-stored middleware template and each currently deployed middleware instance; and determining middleware configuration information of each candidate middleware instance with an association relation with the target middleware template based on the setting operation of the target middleware template received by the first user interface.
For example, each pre-stored middleware template includes a MySql middleware template and a Redis middleware template, and the middleware examples included in the cluster may include MySql1, mySql2, mySql3, mySql4, redis1, redis2, redis3, and each candidate middleware template having an association relationship with the MySql middleware template is MySql1, mySql2, mySql3, mySql4; the candidate middleware templates with the association relation with the Redis middleware template are Redis1, redis2 and Redis3.
In some embodiments, determining the middleware configuration information of the target middleware instance in the middleware configuration information of each candidate middleware instance may include: providing a second user interface, wherein the second user interface is used for displaying the identification of each candidate middleware instance, a user can select the middleware instance based on the identification displayed by the second user interface, and the electronic equipment can determine the middleware instance selected by the user based on the selection operation for the middleware instance received by the second user interface; and taking the middleware instance selected by the user as a target middleware instance, thereby obtaining the middleware configuration information of the target middleware instance.
And step 103, determining values of configuration parameter fields in a configuration file template based on the middleware configuration information and the application information, and generating a configuration file of the target application.
In some embodiments, step 103 may comprise:
determining a value of a target middleware configuration field in a target middleware template based on the middleware configuration information to obtain a first configuration key value pair corresponding to the target middleware instance, for example, filling the value of the target middleware configuration field into the target middleware template;
determining a value of an application configuration field in the application template based on the application information, and obtaining a second configuration key value pair corresponding to the target application, for example, filling the value of the application configuration field into the application template;
then, a configuration file is generated based on the first configuration key value pair and the second configuration key value pair.
For example, an object forming a configuration file configmap may be automatically assembled for an application template filled with values of application configuration fields, and a middleware template filled with values of target middleware configuration fields, invoking k8s (Kubernetes) api to automatically generate the configmap.
In some embodiments, as shown with reference to fig. 2, following step 103, the following steps may be further included:
step 104, storing the configuration file in the target namespace.
For example, configmap is stored under the target namespace.
Step 105, mounting the configuration file stored in the target namespace to the target container.
In some embodiments, the configuration files stored in the target namespaces may be changed according to the actual operating environment requirements of the application.
If the electronic device determines that the configuration file needs to be changed, the electronic device reenters step 101. For example, steps 101 to 104 are re-executed, and then the container is restarted, or 101 to 103 are executed to generate a new configuration file, update the new configuration file to the target namespace, and restart the container.
For example, if it is determined that the target middleware instance needs to be added, subtracted, or changed according to the actual running environment requirement of the application, it may be determined that the configuration file is to be changed, but the manner of determining whether the configuration file needs to be changed is not limited thereto.
According to the embodiment of the application, the standardized configuration file template can be generated based on the configuration parameter field which changes along with the change of the running environment, the corresponding configuration file is generated based on the middleware configuration information and the application filling configuration file template, the automation of configuration file generation and the standardization and unification of the configuration file are realized, the time and the workload of configuration modification by deployment personnel can be reduced, the running error of the application caused by the configuration file format error can be avoided, the risk that the application cannot run normally caused by the manual modification of the configuration file is reduced, and the maintenance of the configuration file is facilitated.
Based on the same ideas of the profile acquisition method in the above embodiment, the present application also provides a profile acquisition device that can be used to perform the above profile acquisition method. For ease of illustration, only those portions of the configuration file acquisition device embodiments are shown in the schematic structural diagrams relating to the embodiments of the present application, and those skilled in the art will appreciate that the illustrated structures are not limiting of the device and may include more or fewer components than illustrated, or may combine certain components, or a different arrangement of components.
As shown in fig. 3, the profile acquisition device includes a template acquisition module 301, an information acquisition module 302, and a profile generation module 303. In some embodiments, the modules described above may be programmable software instructions stored in memory and executable by a processor call. It will be appreciated that in other embodiments, the modules may be program instructions or firmware (firmware) that are resident in the processor.
The template obtaining module 301 is configured to obtain a configuration file template corresponding to a target application, where the configuration file template includes configuration parameter fields required by the target application in a running process;
the information obtaining module 302 is configured to obtain middleware configuration information of a target middleware instance, and application information of the target application, where the target middleware instance is a middleware instance that provides a service for the target application;
and the configuration generating module 303 is configured to determine a value of the configuration parameter field in the configuration file template based on the middleware configuration information and the application information, and generate a configuration file of the target application.
Fig. 4 is a schematic diagram of an embodiment of an electronic device of the present application.
The electronic device 100 comprises a memory 20, a processor 30 and a computer program 40 stored in the memory 20 and executable on the processor 30. The steps in the above-described configuration file acquisition method embodiment, such as steps 101 to 103 shown in fig. 1, or steps 101 to 105 shown in fig. 1, are implemented when the processor 30 executes the computer program 40.
By way of example, the computer program 40 may likewise be partitioned into one or more modules/units that are stored in the memory 20 and executed by the processor 30. The one or more modules/units may be a series of computer program instruction segments capable of performing particular functions for describing the execution of the computer program 40 in the electronic device 100. For example, it may be divided into a template acquisition module 301, an information acquisition module 302, and a configuration generation module 303 shown in fig. 3.
It will be appreciated by those skilled in the art that the schematic diagram is merely an example of the electronic device 100 and is not meant to be limiting of the electronic device 100, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the electronic device 100 may also include input-output devices, network access devices, buses, etc.
The processor 30 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. The general purpose processor may be a microprocessor, a single-chip microcomputer or the processor 30 may be any conventional processor or the like.
The memory 20 may be used to store computer programs 40 and/or modules/units, and the processor 30 implements various functions of the electronic device 100 by running or executing the computer programs and/or modules/units stored in the memory 20, as well as invoking data stored in the memory 20. The memory 20 may mainly include a storage program area that may store an operating system, application programs required for at least one function (such as a sound playing function, an image playing function, etc.), and a storage data area; the storage data area may store data (such as audio data) created according to the use of the electronic device 100, and the like. In addition, the memory 20 may include high-speed random access memory, and may also include nonvolatile memory, such as a hard disk, memory, plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash Card (Flash Card), at least one disk storage device, flash memory device, or other nonvolatile solid state storage device.
The modules/units integrated with the electronic device 100 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as a stand alone product. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each method embodiment described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
In several embodiments provided in the present application, it should be understood that the disclosed electronic device and method may be implemented in other manners. For example, the above-described embodiments of the electronic device are merely illustrative, and for example, the division of the units is merely a logical function division, and there may be other manners of division when actually implemented.
In addition, each functional unit in each embodiment of the present application may be integrated in the same processing unit, or each unit may exist alone physically, or two or more units may be integrated in the same unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. Accordingly, the embodiments are to be considered in all respects as illustrative and not restrictive. Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. Multiple units or electronic devices recited in the electronic device claims may also be implemented in software or hardware by means of one and the same unit or electronic device. The terms first, second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above embodiments are merely for illustrating the technical solutions of the present application and not for limiting, and although the present application has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions can be made to the technical solutions of the present application without departing from the spirit and scope of the technical solutions of the present application.

Claims (9)

1. A profile acquisition method, comprising:
acquiring a configuration file template corresponding to a target application, wherein the configuration file template comprises configuration parameter fields required by the target application in the running process;
acquiring middleware configuration information of a target middleware instance and application information of the target application, wherein the target middleware instance is the middleware instance for providing service for the target application;
determining the value of the configuration parameter field in the configuration file template based on the middleware configuration information and the application information, and generating a configuration file of the target application;
the obtaining the configuration file template corresponding to the target application comprises the following steps:
establishing a mapping relation between an application template of the target application and a target middleware template to obtain the configuration file template;
the configuration file template comprises an application template of the target application and a target middleware template corresponding to the target middleware type of the target middleware instance, the configuration parameter field in the application template comprises an application configuration field, and the configuration parameter field in the target middleware template comprises a target middleware configuration field;
the determining the value of the configuration parameter field in the configuration file template based on the middleware configuration information and the application information, and generating the configuration file of the target application, includes:
determining a value of a target middleware configuration field in the target middleware template based on the middleware configuration information to obtain a first configuration key value pair corresponding to the target middleware instance;
determining the value of an application configuration field in the application template based on the application information to obtain a second configuration key value pair corresponding to the target application;
and generating a configuration file based on the first configuration key value pair and the second configuration key value pair.
2. The profile acquisition method as claimed in claim 1, wherein the acquiring the middleware configuration information of the target middleware instance includes:
determining middleware configuration information of each candidate middleware instance with an association relation with the target middleware template;
and determining the middleware configuration information of the target middleware instance in the middleware configuration information of each candidate middleware instance.
3. The profile acquisition method according to claim 2, wherein determining middleware configuration information of each candidate middleware instance having an association relationship with the target middleware template includes:
providing a user interface, wherein the user interface is used for setting the association relation between each pre-stored middleware template and each currently deployed middleware instance;
and determining middleware configuration information of each candidate middleware instance with an association relation with the target middleware template based on the setting operation of the target middleware template received by the user interface.
4. The profile acquisition method as claimed in claim 1, further comprising, prior to the acquiring the profile template corresponding to the target application:
acquiring configuration parameter fields of various application programs;
acquiring a configuration file format;
generating each type of configuration file templates matched with the configuration file formats based on the configuration parameter fields of each type of application programs;
the obtaining the configuration file template corresponding to the target application comprises the following steps:
and determining a profile template corresponding to the target application in the profile templates of the various types.
5. The profile acquisition method of claim 1, further comprising, after the determining the value of the configuration parameter field in the profile template based on the middleware configuration information and the application information, generating a profile of the target application:
and if the configuration file needs to be changed, re-entering the step of acquiring the configuration file template corresponding to the target application.
6. The profile acquisition method according to any one of claims 1 to 5, wherein the target application runs in a target container, a namespace of the target container is a target namespace, and after the determining the values of the configuration parameter fields in the profile template based on the middleware configuration information and the application information, generating a profile of the target application further comprises:
storing the configuration file in the target namespace;
and mounting the configuration file stored in the target naming space to the target container.
7. A profile acquisition apparatus, comprising:
the template acquisition module is used for acquiring a configuration file template corresponding to the target application, wherein the configuration file template comprises configuration parameter fields required by the target application in the running process;
the information acquisition module is used for acquiring middleware configuration information of a target middleware instance and application information of the target application, wherein the target middleware instance is a middleware instance for providing service for the target application;
the configuration generation module is used for determining the value of the configuration parameter field in the configuration file template based on the middleware configuration information and the application information and generating a configuration file of the target application;
the obtaining the configuration file template corresponding to the target application comprises the following steps:
establishing a mapping relation between an application template of the target application and a target middleware template to obtain the configuration file template;
the configuration file template comprises an application template of the target application and a target middleware template corresponding to the target middleware type of the target middleware instance, the configuration parameter field in the application template comprises an application configuration field, and the configuration parameter field in the target middleware template comprises a target middleware configuration field;
the determining the value of the configuration parameter field in the configuration file template based on the middleware configuration information and the application information, and generating the configuration file of the target application, includes:
determining a value of a target middleware configuration field in the target middleware template based on the middleware configuration information to obtain a first configuration key value pair corresponding to the target middleware instance;
determining the value of an application configuration field in the application template based on the application information to obtain a second configuration key value pair corresponding to the target application;
and generating a configuration file based on the first configuration key value pair and the second configuration key value pair.
8. An electronic device comprising a processor and a memory, wherein the memory is configured to store instructions, the processor configured to invoke the instructions in the memory, to cause the electronic device to perform the profile acquisition method of any one of claims 1-6.
9. A computer readable storage medium storing computer instructions which, when run on an electronic device, cause the electronic device to perform the profile acquisition method of any one of claims 1 to 6.
CN202311057819.7A 2023-08-22 2023-08-22 Configuration file acquisition method and device, electronic equipment and storage medium Active CN116775163B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311057819.7A CN116775163B (en) 2023-08-22 2023-08-22 Configuration file acquisition method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311057819.7A CN116775163B (en) 2023-08-22 2023-08-22 Configuration file acquisition method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116775163A CN116775163A (en) 2023-09-19
CN116775163B true CN116775163B (en) 2024-02-02

Family

ID=87991647

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311057819.7A Active CN116775163B (en) 2023-08-22 2023-08-22 Configuration file acquisition method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116775163B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107506182A (en) * 2017-07-27 2017-12-22 努比亚技术有限公司 Software layout method, software merit rating device and computer-readable recording medium
US9983891B1 (en) * 2017-03-21 2018-05-29 Veritas Technologies Llc Systems and methods for distributing configuration templates with application containers
CN110795140A (en) * 2019-09-26 2020-02-14 连连银通电子支付有限公司 Configuration file generation method and device
CN112000365A (en) * 2020-08-24 2020-11-27 百度时代网络技术(北京)有限公司 Service grid configuration method, device, equipment and medium based on micro-service architecture
CN112379946A (en) * 2020-11-27 2021-02-19 平安普惠企业管理有限公司 Template configuration method and device based on YAML and computer equipment
CN112799690A (en) * 2021-02-01 2021-05-14 联想(北京)有限公司 Information processing method, device, equipment and storage medium
CN113721973A (en) * 2021-09-07 2021-11-30 北京锐安科技有限公司 Configuration file generation method, device, equipment and medium
CN114090127A (en) * 2021-11-24 2022-02-25 中国建设银行股份有限公司 Electronic device, loading method and medium of configuration file of electronic device
CN115964054A (en) * 2022-12-26 2023-04-14 中国工商银行股份有限公司 Application service deployment method and device
CN116028331A (en) * 2021-10-26 2023-04-28 腾讯科技(深圳)有限公司 Configuration file generation method and framework construction method for middleware test

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11016784B2 (en) * 2019-03-08 2021-05-25 Palantir Technologies Inc. Systems and methods for automated deployment and adaptation of configuration files at computing devices

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9983891B1 (en) * 2017-03-21 2018-05-29 Veritas Technologies Llc Systems and methods for distributing configuration templates with application containers
CN107506182A (en) * 2017-07-27 2017-12-22 努比亚技术有限公司 Software layout method, software merit rating device and computer-readable recording medium
CN110795140A (en) * 2019-09-26 2020-02-14 连连银通电子支付有限公司 Configuration file generation method and device
CN112000365A (en) * 2020-08-24 2020-11-27 百度时代网络技术(北京)有限公司 Service grid configuration method, device, equipment and medium based on micro-service architecture
CN112379946A (en) * 2020-11-27 2021-02-19 平安普惠企业管理有限公司 Template configuration method and device based on YAML and computer equipment
CN112799690A (en) * 2021-02-01 2021-05-14 联想(北京)有限公司 Information processing method, device, equipment and storage medium
CN113721973A (en) * 2021-09-07 2021-11-30 北京锐安科技有限公司 Configuration file generation method, device, equipment and medium
CN116028331A (en) * 2021-10-26 2023-04-28 腾讯科技(深圳)有限公司 Configuration file generation method and framework construction method for middleware test
CN114090127A (en) * 2021-11-24 2022-02-25 中国建设银行股份有限公司 Electronic device, loading method and medium of configuration file of electronic device
CN115964054A (en) * 2022-12-26 2023-04-14 中国工商银行股份有限公司 Application service deployment method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于文件校核比对的智能变电站配置文件管控***研究与实现;陆承宇 等;电工技术(第07期);第64-66页 *

Also Published As

Publication number Publication date
CN116775163A (en) 2023-09-19

Similar Documents

Publication Publication Date Title
CN108304201B (en) Object updating method, device and equipment
CN105404525B (en) Manage the method and device of the basic input output system configuration in computer system
US8560819B2 (en) Software execution using multiple initialization modes
US9558016B2 (en) Platform system, method for changing support hardware configuration of universal extensible firmware interface basic input output system and computer program product
CN107797826B (en) Rule configuration method based on rule engine, terminal and equipment
US10996997B2 (en) API-based service command invocation
US10908948B2 (en) Multiple application instances in operating systems that utilize a single process for application execution
CN110119623A (en) A kind of credible main board implementation method for realizing that firmware is actively measured using TPCM
CN109684008A (en) Card rendering method, device, terminal and computer readable storage medium
CN113626102A (en) Data processing method and device, electronic equipment and storage medium
US20220171608A1 (en) Intelligent provisioning management
CN110427213B (en) Method, device, equipment and storage medium for realizing intelligent configuration software
CN111475175B (en) Method, device and medium for installing and guiding operation system based on ARM server
CN111158987A (en) Health check method and device of micro-service architecture
CN116775163B (en) Configuration file acquisition method and device, electronic equipment and storage medium
CN112068895B (en) Code configuration method, device, video playing equipment and storage medium
CN110119625A (en) A kind of trusted computing method
CN109408124A (en) Store equipment and preparation method thereof, operating system double mode bootstrap technique and device
CN115358331A (en) Device type identification method and device, computer readable storage medium and terminal
US20200344305A1 (en) Commissioning a virtualised network function
CN112130900B (en) User information management method, system, equipment and medium for BMC
CN113608752A (en) Method, system and device for installing intelligent network card system and readable storage medium
CN114356516A (en) Resource scheduling method, related device, equipment and storage medium
CN110119624A (en) A kind of security measure method
CN110471708A (en) The method and device that configuration item based on Reusable Module obtains

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant