CN111142927A - Configuration file merging and splitting processing method and device - Google Patents

Configuration file merging and splitting processing method and device Download PDF

Info

Publication number
CN111142927A
CN111142927A CN201911227563.3A CN201911227563A CN111142927A CN 111142927 A CN111142927 A CN 111142927A CN 201911227563 A CN201911227563 A CN 201911227563A CN 111142927 A CN111142927 A CN 111142927A
Authority
CN
China
Prior art keywords
host
role
configuration
roles
configuration file
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.)
Granted
Application number
CN201911227563.3A
Other languages
Chinese (zh)
Other versions
CN111142927B (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.)
Zhongying Youchuang Information Technology Co Ltd
Original Assignee
Zhongying Youchuang Information Technology 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 Zhongying Youchuang Information Technology Co Ltd filed Critical Zhongying Youchuang Information Technology Co Ltd
Priority to CN201911227563.3A priority Critical patent/CN111142927B/en
Publication of CN111142927A publication Critical patent/CN111142927A/en
Application granted granted Critical
Publication of CN111142927B publication Critical patent/CN111142927B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The invention discloses a merging and splitting processing method and a device of configuration files, wherein the method comprises the following steps: marking the configuration items corresponding to the host roles in the software system in advance according to the host role identifiers of the host roles, and merging the configuration items contained in the configuration files corresponding to the host roles in the software system to generate the configuration files corresponding to the hosts when the configuration files need to be written into a production environment; when meeting configuration files need to be collected from a production environment, according to the role list of the host, splitting the configuration items contained in the configuration files of the host to generate the configuration files corresponding to the roles of the host. The invention can combine the configuration files of a plurality of host roles in real time according to the host role division of the production environment or split the respective configuration items of different host roles in real time according to the host role division of the production environment under the condition that different host roles in the software system are deployed in the same host.

Description

Configuration file merging and splitting processing method and device
Technical Field
The invention relates to the field of computer software, in particular to a method and a device for merging and splitting configuration files.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
As is well known, configuration data for software systems is maintained mostly in the form of configuration files. For a certain software system, a plurality of component modules (for example, an acquisition module, a statistics module, a reporting module, or a billing module) are often provided, and configuration items included in configuration files corresponding to the component modules are usually greatly different. In the development stage of the software system, the component modules are respectively deployed on different hosts (the host where each component module is deployed corresponds to one host role), so that even if configuration files corresponding to the host roles have the same file name, the configuration files do not interfere with each other; after the software system is put into a production environment, a plurality of host roles of the software system may be deployed on the same host, and if configuration files corresponding to the host roles have the same file name, a conflict may occur between the host roles.
At present, in the prior art, when configuration files corresponding to different host roles in a software system are deployed on the same host, a manual merging mode is adopted to merge the configuration files corresponding to the different host roles on the same host, which can cause the technical problem of inconsistency before and after the configuration files are merged.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a merging processing method of configuration files, which is used for solving the technical problem that in the prior art, when different host roles in a software system are deployed on the same host, the configuration files corresponding to the different host roles on the same host are merged in a manual merging mode, and the mode can cause the inconsistency of the configuration files of the host roles before and after merging, and comprises the following steps: acquiring configuration files corresponding to each host role in the software system, wherein the configuration files corresponding to each host role comprise: one or more configuration items marked with each host role identifier; and issuing the configuration files corresponding to the roles of the hosts to the hosts according to the role lists of the hosts, wherein the role lists of the hosts comprise: one or more host roles that the software system deploys on the host; merging the configuration items contained in the configuration files corresponding to the roles of all the hosts issued to the hosts to generate the configuration files corresponding to the hosts, wherein the configuration files corresponding to the hosts comprise: one or more configuration items for each host role identification are noted.
The embodiment of the invention provides a method for splitting and processing configuration files, which is used for solving the technical problem that in the prior art, when different host roles in a software system are deployed on the same host, the configuration files corresponding to the different host roles on the same host are merged in a manual merging mode, and the mode can cause the inconsistency of the configuration files of the host roles before and after merging, and comprises the following steps: acquiring a configuration file and a role list of a host, wherein the role list comprises: one or more host roles deployed by the software system on the host, wherein the configuration file corresponding to the host comprises: one or more configuration items marked with the role identifiers of the hosts; according to the role list of the host, splitting the configuration items contained in the configuration file of the host to generate the configuration files corresponding to the roles of the host, wherein the configuration file corresponding to each role of the host comprises: one or more configuration items for each host role identification are noted.
An embodiment of the present invention further provides a merging processing apparatus for configuration files, so as to solve a technical problem in the prior art that when different host roles in a software system are deployed on the same host, configuration files corresponding to different host roles on the same host are merged in a manual merging manner, which may cause inconsistency between the configuration files of the host roles before and after merging, and the apparatus includes: a first configuration file obtaining module, configured to obtain configuration files corresponding to roles of each host in a software system, where the configuration file corresponding to each role of the host includes: one or more configuration items marked with each host role identifier; the configuration file issuing module is used for issuing the configuration files corresponding to the roles of the hosts to the hosts according to the role lists of the hosts, wherein the role lists of the hosts comprise: one or more host roles that the software system deploys on the host; the configuration file merging processing module is used for merging the configuration items contained in the configuration files corresponding to the roles of the hosts issued to the hosts to generate the configuration files corresponding to the hosts, wherein the configuration files corresponding to the hosts comprise: one or more configuration items for each host role identification are noted.
An embodiment of the present invention further provides a device for splitting a configuration file, so as to solve a technical problem in the prior art that when different host roles in a software system are deployed on the same host, configuration files corresponding to different host roles on the same host are merged in a manual merging manner, which may cause inconsistency between the configuration files of the host roles before and after merging, and the device includes: a second configuration file obtaining module, configured to obtain a configuration file and a role list of the host, where the role list includes: one or more host roles deployed by the software system on the host, wherein the configuration file corresponding to the host comprises: one or more configuration items marked with the role identifiers of the hosts; a configuration file splitting processing module, configured to split a configuration item included in a configuration file of a host according to a role list of the host, and generate a configuration file corresponding to each role of the host, where the configuration file corresponding to each role of the host includes: one or more configuration items for each host role identification are noted.
The embodiment of the invention also provides computer equipment, which is used for solving the technical problem that in the prior art, when different host roles in a software system are deployed on the same host, configuration files corresponding to the different host roles on the same host are merged in a manual merging mode, so that the configuration files of the host roles are inconsistent before and after being merged.
An embodiment of the present invention further provides a computer-readable storage medium, which is used to solve the technical problem in the prior art that when different host roles in a software system are deployed on the same host, configuration files corresponding to different host roles on the same host are merged in a manual merging manner, which may cause inconsistency between the configuration files of the host roles before and after merging.
In the embodiment of the invention, by pre-identifying the host role according to the host role of each host role in the software system, labeling the configuration items corresponding to the host roles, so that the configuration file corresponding to each host role comprises one or more configuration items labeled with the identifier of each host role, when the configuration file needs to be written into the production environment, after the configuration file corresponding to each host role in the software system is obtained, according to one or more host roles deployed on the host by the software system, the configuration file corresponding to each host role is issued to the host, and merging the configuration items contained in the configuration files corresponding to the roles of the hosts issued to the hosts to generate the configuration files corresponding to the hosts, enabling the configuration file corresponding to the host to contain one or more configuration items marked with the role identifiers of the hosts; when meeting configuration files need to be collected from a production environment, after the configuration files and the role lists of the hosts are obtained, the configuration items contained in the configuration files of the hosts are split according to the role lists of the hosts, and the configuration files corresponding to the roles of the hosts are generated, so that the configuration files corresponding to the roles of the hosts contain one or more configuration items marked with the role identifiers of the hosts.
By the embodiment of the invention, different host role identifiers are allocated to different host roles contained in the software system, and the allocated host role identifiers are adopted to label the configuration items contained in the configuration files corresponding to the different host roles, so that the configuration files of a plurality of host roles can be combined in real time according to the host role division of the production environment or the respective configuration items of the different host roles can be split in real time according to the host role division of the production environment under the condition that the different host roles in the software system are deployed in the same host.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
fig. 1 is a flowchart of a merging processing method for configuration files according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a merge or split configuration file according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a merging processing device for configuration files according to an embodiment of the present invention;
FIG. 4 is a flowchart of a method for splitting a configuration file according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a device for splitting a configuration file according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
In the description of the present specification, the terms "comprising," "including," "having," "containing," and the like are used in an open-ended fashion, i.e., to mean including, but not limited to. Reference to the description of the terms "one embodiment," "a particular embodiment," "some embodiments," "for example," etc., means that a particular feature, structure, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. The sequence of steps involved in the embodiments is for illustrative purposes to illustrate the implementation of the present application, and the sequence of steps is not limited and can be adjusted as needed.
An embodiment of the present invention provides a method for merging configuration files, and fig. 1 is a flowchart of a method for merging configuration files provided in an embodiment of the present invention, as shown in fig. 1,
s101, obtaining configuration files corresponding to each host role in the software system, wherein the configuration files corresponding to each host role comprise: one or more configuration items for each host role identification are noted.
It should be noted that the software system in the embodiment of the present invention may be any software system including multiple host roles. For a software system including a host role, configuration items actually managed in configuration files of the same name and same location of hosts with different roles usually have great differences, for example, a configuration file named as "xxx. If multiple roles share a host, the configuration file on the host needs to contain a collection of configuration items corresponding to each host role. During the development and management of a project or a product, only one set of configuration is usually maintained for each role respectively, and during actual deployment or upgrade, incremental writing is performed on a host according to the role of the host respectively. If a plurality of roles share one host, in order to prevent configuration file conflict, a plurality of configuration files are often combined into one file, and the plurality of configuration files are manually combined, so that the combined configuration file is easily inconsistent with the configuration files of the roles of the hosts, and the software version management and the deployment and upgrade become extremely complex, troublesome and easy to make mistakes.
For example, each module (acquisition module, statistical module, report module, and charging module) included in a certain software system manages configuration information of a role of each host by a configuration file named "config.xml" under a "worker 123" user of a Linux host, and if each module of the software system is deployed under "worker 123" users of different Linux hosts, although the configuration files of the modules have the same name, no conflict occurs between the modules, and if each module of the software system is deployed under "worker 123" users of the same Linux host, a conflict occurs between the modules.
It should be noted that, before obtaining the configuration file corresponding to each host role in the software system, the configuration file merging processing method provided in the embodiment of the present invention may further generate the configuration file corresponding to each host role in the software system through the following steps: acquiring configuration information, wherein the configuration information comprises: the host role identification of each host role and one or more configuration items corresponding to each host role; marking the configuration items corresponding to the host roles according to the host role identifiers of the host roles; and generating a configuration file corresponding to each host role according to the configuration items marked with the host role identifiers.
In order to distinguish configuration items included in configuration files corresponding to respective host roles, in the embodiment of the present invention, for each configuration item in a configuration file, a role identifier is assigned according to an applicable host role, optionally, the role identifier may be encoded in a binary bit manner, so that different binary bits represent different roles, if a certain configuration item is applicable to a certain type of host role, the binary bit of the item is set to 1, otherwise, the binary bit is set to 0.
Therefore, in an optional implementation manner, the method for merging configuration files provided in the embodiment of the present invention may further include the following steps: defining binary bit sequence corresponding to each host role; and generating the host role identifier of each host role according to the binary bit sequence corresponding to each host role, wherein the host role identifier of each host role is a binary number.
Optionally, after the host role identifier of each host role is generated according to the binary bit sequence corresponding to each host role, the host role identifier of the host can also be generated according to the host role identifier of each host role deployed on the host, where the host role identifier of the host is a decimal number, and the binary bits corresponding to non-zero codes in the binary number corresponding to the decimal number represent each host role deployed on the host.
Because the roles of the hosts included in a software system are definite, and the way the software system is deployed for each role of the host is indefinite, therefore, according to the project or the product (the project or the product refers to the environment or the mode of the actual deployment of the software system, wherein the project refers to the direct deployment based on the functions of the whole software system, and the product refers to the deployment customized for the partial functions of the software system according to the user requirements), the embodiment of the invention respectively configures the binary bit sequence corresponding to each host role, for example, the first bit from the right of the binary is defined as the oracle host, the second bit is defined as the collector, the third bit is defined as the application server, the fourth bit is defined as the report server … …, if the role identifier of a certain host is 6 (corresponding to 110 binary codes), the host is indicated to have two roles of the collector and the application server. The role identifier of a certain host is a host with 9 (corresponding to 1001 binary code), which indicates that the host has two roles of an oracle database and a report server.
It should be noted that, because some configuration items in a software system are related to a host role and some configuration items are unrelated to a role, when labeling each configuration item, the embodiment of the present invention may divide the configuration item into two types, one type is a configuration item related to a host role, and a binary code is used to label a corresponding role; the other is a configuration item (for example, a configuration item such as a connection string of a database) which is not related to the role of the host, that is, a configuration item which needs to be configured on the host in all roles by default, and for the configuration item which is not related to the role of the host, the configuration item can be identified by using a method without any identification, or a special identification can be assigned for identification. By screening the configuration items, the labeling efficiency of the configuration items can be improved.
S102, according to the role list of the host, issuing the configuration files corresponding to the roles of the hosts to the host, wherein the role list of the host comprises: a software system has one or more host roles deployed on a host.
It should be noted that, because the role list of the host includes one or more host roles that the software system deploys on the host, the configuration file corresponding to the host role included in the role list of the host can be issued to the host according to the role list of the host.
S103, merging the configuration items contained in the configuration files corresponding to the roles of the hosts issued to the hosts to generate the configuration files corresponding to the hosts, wherein the configuration files corresponding to the hosts comprise: one or more configuration items for each host role identification are noted.
Because the configuration items contained in the configuration files corresponding to each host role are marked with the host role identifiers, the configuration items contained in the configuration files corresponding to the host roles issued to the host can be directly merged to generate the configuration files corresponding to the host.
The merging processing method of the configuration files provided by the embodiment of the invention can be applied to a configuration issuing scene, namely, the configuration files are issued to the server hosts of the production environment from the development environment or the verification environment, and in the scene, if one host of the production environment simultaneously corresponds to a plurality of roles, the corresponding configuration files are simultaneously issued to the host of the production environment from the development environment or the verification environment according to the role list corresponding to the host, the contents of the configuration files are merged, and the configuration items irrelevant to the roles in the configuration files are rearranged. When the duplicate is eliminated, if the corresponding values of the configuration items are also the same, the duplicate configuration is deleted. Otherwise, the duplicate removal rule needs to be specified, and if the last configuration result is specified and reserved; or keeping the first configuration result; or setting a weight to the configured value, for example, for a certain repeatedly configured configuration item, if any one of the roles configures the configuration item as A, the configuration item is set as A after the rearrangement regardless of the configuration of other roles.
Fig. 2 is a schematic diagram of a merge or split configuration file provided in an embodiment of the present invention, as shown in fig. 2, a host role a, a host role B, and a host role C all use configuration files config.xml with the same name, and a plurality of configuration items are respectively inside the configuration files, where the configuration file of the host role a sequentially includes three configuration items a1, a2, and A3; the configuration file of the host role B sequentially comprises three configuration items B1, B2 and B3; the configuration file of the host role C sequentially comprises two configuration items C1 and C2. In the case of issuing the configuration files of the respective host roles of the development environment or the verification environment to the production environment hosts, the configuration items contained in the respective configuration files of the host role a, the host role B, and the host role C are merged to generate a configuration file config.xml containing 8 configuration items (i.e., a1, a2, A3, B1, B2, B3, C1, and C2).
It should be noted that there may be several configurations added during the iteration of the project or product, for example, the file of the host role a is added with configuration a4, and there are 9 configuration items a1, a2, A3, B1, B2, B3, C1, C2, and a4 in the configuration file on the environment.
Based on the same inventive concept, the embodiment of the present invention further provides a merging processing apparatus for configuration files, as described in the following embodiments. Because the principle of solving the problem of the embodiment of the device is similar to the merging processing method of the configuration file, the implementation of the embodiment of the device can refer to the implementation of the method, and repeated parts are not described again.
Fig. 3 is a schematic diagram of a merging processing apparatus for configuration files provided in an embodiment of the present invention, as shown in fig. 3, the apparatus may include: a first configuration file obtaining module 31, a configuration file issuing module 32 and a configuration file merging processing module 33.
The first configuration file obtaining module 31 is configured to obtain configuration files corresponding to roles of hosts in a software system, where the configuration file corresponding to each role of the host includes: one or more configuration items marked with each host role identifier; the configuration file issuing module 32 is configured to issue the configuration file corresponding to each host role to the host according to the role list of the host, where the role list of the host includes: one or more host roles that the software system deploys on the host; a configuration file merging processing module 33, configured to merge the configuration items included in the configuration files corresponding to the roles of the hosts issued to the host, and generate a configuration file corresponding to the host, where the configuration file corresponding to the host includes: one or more configuration items for each host role identification are noted.
In an optional embodiment, the merging processing apparatus for configuration files provided in the embodiment of the present invention may further include: the first configuration file generating module 34 is configured to obtain configuration information, where the configuration information includes: the host role identification of each host role and one or more configuration items corresponding to each host role; marking the configuration items corresponding to the host roles according to the host role identifiers of the host roles; and generating a configuration file corresponding to each host role according to the configuration items marked with the host role identifiers.
Optionally, the first configuration file generating module 34 is further configured to define a binary bit sequence corresponding to each host role; and generating the host role identifier of each host role according to the binary bit sequence corresponding to each host role, wherein the host role identifier of each host role is a binary number.
Further, the first configuration file generating module 34 is further configured to generate a host role identifier of the host according to the host role identifier of each host role deployed on the host, where the host role identifier of the host is a decimal number, and a binary bit corresponding to a non-zero code in a binary number corresponding to the decimal number represents each host role deployed on the host.
Based on the same inventive concept, an embodiment of the present invention provides a method for splitting a configuration file, and fig. 4 is a flowchart of the method for splitting a configuration file provided in the embodiment of the present invention, as shown in fig. 4, the method may include the following steps:
s401, obtaining a configuration file and a role list of a host, wherein the role list comprises: one or more host roles deployed by the software system on the host, wherein the configuration file corresponding to the host comprises: one or more configuration items marked with the role identifiers of the hosts;
s402, according to the role list of the host, splitting the configuration items contained in the configuration files of the host to generate configuration files corresponding to the roles of the host, wherein the configuration files corresponding to each role of the host comprise: one or more configuration items for each host role identification are noted.
As shown in fig. 2, in the case of collecting the configuration file on the production environment host back to the configuration of the development environment or the verification environment, the configuration file config.xml containing 8 configuration items (i.e., a1, a2, A3, B1, B2, B3, C1, C2) may be split into the configuration file config.xml of the host role a (containing configuration items a1, a2, A3), the configuration file config.xml of the host role B (containing configuration items B1, B2, B3), and the configuration file config.xml of the host role C (containing configuration items C1, C2) according to the host role identification of each configuration item.
In some scenarios (e.g., version recovery, configuration collection, etc.), configuration files may be distinguished from the field according to host roles, split into field configuration items of the host roles, and compared with a development or test environment, where 9 configuration files, which are sequentially a1, a2, A3, B1, B2, B3, C1, C2, and a4, need to be re-split into a1, a2, A3, and a4, a1, B2, and B3, and C1 and C2, in the production environment.
In an optional embodiment, the method for splitting a configuration file according to an embodiment of the present invention may further include the following steps: acquiring configuration information, wherein the configuration information comprises: the host role identification of each host role and one or more configuration items corresponding to each host role; marking the configuration items corresponding to the host roles according to the host role identifiers of the host roles; and generating a configuration file of the host according to the configuration items marked with the role identifiers of the hosts.
Further, before labeling the configuration items corresponding to each host role according to the host role identifier of each host role, the method for splitting the configuration file provided by the embodiment of the present invention may further include the following steps: defining binary bit sequence corresponding to each host role; and generating the host role identifier of each host role according to the binary bit sequence corresponding to each host role, wherein the host role identifier of each host role is a binary number.
Optionally, after generating the host role identifier of each host role according to the binary bit sequence corresponding to each host role, the method for splitting the configuration file provided in the embodiment of the present invention may further include the following steps: and generating the host role identification of the host according to the host role identification of each host role deployed on the host, wherein the host role identification of the host is a decimal number, and binary bits corresponding to non-zero codes in binary numbers corresponding to the decimal number represent each host role deployed on the host.
The method for splitting the configuration file provided by the embodiment of the invention can be applied to a configuration collection scene, namely, the configuration file is collected back to a development environment or a verification environment from each server host in a production environment, and in the scene, if one host in the production environment simultaneously corresponds to a plurality of roles, a role list corresponding to the host is split into the configuration files of the roles of each host according to the role list corresponding to the host. For example, a host with role identification 12 (binary code 1100), the configuration file collected from the host should be split into two files with role identification 8 (binary code 1000) and role identification 4 (binary code 100), and the two configuration items corresponding to the roles of the two hosts are stored respectively.
Based on the same inventive concept, an embodiment of the present invention further provides a device for splitting a configuration file, as described in the following embodiments. Because the principle of the device embodiment for solving the problem is similar to the method for splitting the configuration file, the method can be used for implementing the device embodiment, and repeated details are not repeated.
Fig. 5 is a schematic diagram of a device for splitting a configuration file according to an embodiment of the present invention, as shown in fig. 5, the device may include: a second configuration file obtaining module 51 and a configuration file splitting processing module 52.
The second configuration file obtaining module 51 is configured to obtain a configuration file and a role list of a host, where the role list includes: one or more host roles deployed by the software system on the host, wherein the configuration file corresponding to the host comprises: one or more configuration items marked with the role identifiers of the hosts; a configuration file splitting module 52, configured to split the configuration items included in the configuration file of the host according to the role list of the host, and generate configuration files corresponding to roles of the hosts, where the configuration file corresponding to each role of the host includes: one or more configuration items for each host role identification are noted.
In an optional embodiment, the apparatus for splitting a configuration file according to an embodiment of the present invention may further include: a second configuration file generating module 53, configured to obtain configuration information, where the configuration information includes: the host role identification of each host role and one or more configuration items corresponding to each host role; marking the configuration items corresponding to the host roles according to the host role identifiers of the host roles; and generating a configuration file of the host according to the configuration items marked with the role identifiers of the hosts.
Optionally, the second configuration file generating module 53 is further configured to define a binary bit sequence corresponding to each host role; and generating the host role identifier of each host role according to the binary bit sequence corresponding to each host role, wherein the host role identifier of each host role is a binary number.
Further, the second configuration file generating module 53 is further configured to generate a host role identifier of the host according to the host role identifier of each host role deployed on the host, where the host role identifier of the host is a decimal number, and a binary bit corresponding to a non-zero code in a binary number corresponding to the decimal number represents each host role deployed on the host.
The embodiment of the invention also provides computer equipment, which is used for solving the technical problem that in the prior art, when different host roles in a software system are deployed on the same host, configuration files corresponding to the different host roles on the same host are merged in a manual merging mode, so that the configuration files of the host roles are inconsistent before and after being merged.
An embodiment of the present invention further provides a computer-readable storage medium, which is used to solve the technical problem in the prior art that when different host roles in a software system are deployed on the same host, configuration files corresponding to different host roles on the same host are merged in a manual merging manner, which may cause inconsistency between the configuration files of the host roles before and after merging.
In summary, embodiments of the present invention provide a method and an apparatus for merging configuration files, a method and an apparatus for splitting configuration files, a computer device, and a computer-readable storage medium, which can support configuration files with the same name to automatically combine related configuration items according to differences of actual scenes of a host. The configuration items corresponding to the host roles are labeled in advance according to the host role identifiers of the host roles in the software system, so that the configuration file corresponding to each host role comprises one or more configuration items labeled with each host role identifier, when the configuration file needs to be written into a production environment, the configuration file corresponding to each host role in the software system can be issued to the host according to one or more host roles deployed on the host by the software system after the configuration file corresponding to each host role in the software system is acquired, the configuration files corresponding to the host roles are merged and processed, and the configuration file corresponding to the host is generated, so that the configuration file corresponding to the host comprises the one or more configuration items labeled with each host role identifier; when meeting configuration files need to be collected from a production environment, after the configuration files and the role lists of the hosts are obtained, the configuration items contained in the configuration files of the hosts are split according to the role lists of the hosts, and the configuration files corresponding to the roles of the hosts are generated, so that the configuration files corresponding to the roles of the hosts contain one or more configuration items marked with the role identifiers of the hosts.
By the embodiment of the invention, under the condition that different host roles in the software system are deployed in the same host, the configuration files of a plurality of host roles can be combined in real time according to the host role division of the production environment, or the respective configuration items of different host roles can be split in real time according to the host role division of the production environment.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (12)

1. A merging processing method for configuration files is characterized by comprising the following steps:
acquiring configuration files corresponding to each host role in the software system, wherein the configuration files corresponding to each host role comprise: one or more configuration items marked with each host role identifier;
according to the role list of the host, issuing the configuration files corresponding to the roles of the hosts to the host, wherein the role list of the host comprises: one or more host roles deployed by the software system on a host;
merging the configuration items contained in the configuration files corresponding to the roles of the hosts issued to the hosts to generate the configuration files corresponding to the hosts, wherein the configuration files corresponding to the hosts comprise: one or more configuration items for each host role identification are noted.
2. The method of claim 1, wherein prior to obtaining the configuration file corresponding to each host role in the software system, the method further comprises:
acquiring configuration information, wherein the configuration information comprises: the host role identification of each host role and one or more configuration items corresponding to each host role;
marking the configuration items corresponding to the host roles according to the host role identifiers of the host roles;
and generating a configuration file corresponding to each host role according to the configuration items marked with the host role identifiers.
3. The method according to claim 1 or 2, wherein before labeling the configuration items corresponding to each host role according to the host role identifier of each host role, the method further comprises:
defining binary bit sequence corresponding to each host role;
and generating the host role identifier of each host role according to the binary bit sequence corresponding to each host role, wherein the host role identifier of each host role is a binary number.
4. The method of claim 3, wherein after generating the master role identification for each master role according to the binary bit order corresponding to each master role, the method further comprises:
the method comprises the steps of generating a host role identifier of a host according to the host role identifiers of all host roles deployed on the host, wherein the host role identifier of the host is a decimal number, and binary digits corresponding to non-zero codes in binary digits corresponding to the decimal number represent all the host roles deployed on the host.
5. A method for splitting a configuration file is characterized by comprising the following steps:
acquiring a configuration file and a role list of a host, wherein the role list comprises: one or more host roles deployed by a software system on a host, wherein a configuration file corresponding to the host comprises: one or more configuration items marked with the role identifiers of the hosts;
according to the role list of the host, splitting the configuration items contained in the configuration file of the host to generate the configuration files corresponding to the roles of the host, wherein the configuration file corresponding to each role of the host comprises: one or more configuration items for each host role identification are noted.
6. The method of claim 5, wherein prior to obtaining the host's configuration file and role list, the method further comprises:
acquiring configuration information, wherein the configuration information comprises: the host role identification of each host role and one or more configuration items corresponding to each host role;
marking the configuration items corresponding to the host roles according to the host role identifiers of the host roles;
and generating the configuration file of the host according to the configuration items marked with the role identifiers of the hosts.
7. The method according to claim 5 or 6, wherein before labeling the configuration items corresponding to each host role according to the host role identifier of each host role, the method further comprises:
defining binary bit sequence corresponding to each host role;
and generating the host role identifier of each host role according to the binary bit sequence corresponding to each host role, wherein the host role identifier of each host role is a binary number.
8. The method of claim 7, wherein after generating the master role identification for each master role according to the binary bit order corresponding to each master role, the method further comprises:
the method comprises the steps of generating a host role identifier of a host according to the host role identifiers of all host roles deployed on the host, wherein the host role identifier of the host is a decimal number, and binary digits corresponding to non-zero codes in binary digits corresponding to the decimal number represent all the host roles deployed on the host.
9. A merging processing apparatus for configuration files, comprising:
a first configuration file obtaining module, configured to obtain configuration files corresponding to roles of each host in a software system, where the configuration file corresponding to each role of the host includes: one or more configuration items marked with each host role identifier;
the configuration file issuing module is used for issuing the configuration files corresponding to the roles of the hosts to the hosts according to the role lists of the hosts, wherein the role lists of the hosts comprise: one or more host roles deployed by the software system on a host;
a configuration file merging processing module, configured to merge configuration items included in configuration files corresponding to roles of each host issued to the host, and generate a configuration file corresponding to the host, where the configuration file corresponding to the host includes: one or more configuration items for each host role identification are noted.
10. A device for splitting a configuration file is characterized by comprising:
a second configuration file obtaining module, configured to obtain a configuration file and a role list of a host, where the role list includes: one or more host roles deployed by a software system on a host, wherein a configuration file corresponding to the host comprises: one or more configuration items marked with the role identifiers of the hosts;
a configuration file splitting module, configured to split a configuration item included in the configuration file of the host according to the role list of the host, and generate a configuration file corresponding to each role of the host, where the configuration file corresponding to each role of the host includes: one or more configuration items for each host role identification are noted.
11. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method for merging the configuration files according to any one of claims 1 to 4 or the method for splitting the configuration files according to any one of claims 5 to 8 when executing the computer program.
12. A computer-readable storage medium storing a computer program for executing the method for merging the configuration files according to any one of claims 1 to 4 or the method for splitting the configuration files according to any one of claims 5 to 8.
CN201911227563.3A 2019-12-04 2019-12-04 Configuration file merging and splitting processing method and device Active CN111142927B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911227563.3A CN111142927B (en) 2019-12-04 2019-12-04 Configuration file merging and splitting processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911227563.3A CN111142927B (en) 2019-12-04 2019-12-04 Configuration file merging and splitting processing method and device

Publications (2)

Publication Number Publication Date
CN111142927A true CN111142927A (en) 2020-05-12
CN111142927B CN111142927B (en) 2024-04-23

Family

ID=70517604

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911227563.3A Active CN111142927B (en) 2019-12-04 2019-12-04 Configuration file merging and splitting processing method and device

Country Status (1)

Country Link
CN (1) CN111142927B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112486497A (en) * 2020-11-26 2021-03-12 北京自如信息科技有限公司 Compiling configuration file generation method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090320019A1 (en) * 2008-06-24 2009-12-24 International Business Machines Corporation Multi-scenerio software deployment
US20130047136A1 (en) * 2011-08-15 2013-02-21 International Business Machines Corporation Automatic Selection of Lowest Configuration Feature Level by Functionality Exploited
CN109117199A (en) * 2017-06-26 2019-01-01 北京京东尚科信息技术有限公司 The configuring management method and device of distributed program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090320019A1 (en) * 2008-06-24 2009-12-24 International Business Machines Corporation Multi-scenerio software deployment
US20130047136A1 (en) * 2011-08-15 2013-02-21 International Business Machines Corporation Automatic Selection of Lowest Configuration Feature Level by Functionality Exploited
CN109117199A (en) * 2017-06-26 2019-01-01 北京京东尚科信息技术有限公司 The configuring management method and device of distributed program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李天立;: "AVIDM产品XML配置文件读取研究及应用" *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112486497A (en) * 2020-11-26 2021-03-12 北京自如信息科技有限公司 Compiling configuration file generation method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111142927B (en) 2024-04-23

Similar Documents

Publication Publication Date Title
CN112764753B (en) Project deployment method and device, electronic equipment and storage medium
US11481440B2 (en) System and method for processing metadata to determine an object sequence
ITTO980720A1 (en) PROCEDURE FOR INSTALLING AND VERIFYING THE SOFTWARE FOR A CUSTOM MADE COMPUTER SYSTEM.
CN104331285A (en) Automatic code generation method and system
CN105683940A (en) Processing a data flow graph of a hybrid flow
US11003635B2 (en) Database scheme for storing generic data
CN103473076A (en) Issuing method and issuing system for code version
CN103914300A (en) Software development business realizing method and electronic equipment
CN106557307B (en) Service data processing method and system
CN110389766A (en) HBase container cluster dispositions method, system, equipment and computer readable storage medium
CN107977223A (en) One kind configuration compliance check method and device
CN107798120B (en) Data conversion method and device
CN113794581B (en) Distributed CP unified deployment method, network equipment and storage medium
CN111142927A (en) Configuration file merging and splitting processing method and device
CN112202909B (en) Online upgrading method and system for computer storage system
CN110991983B (en) Task processing method, device, medium and equipment
US10635636B1 (en) Hyper-V virtual machine synthetic full backup where user and recovery snapshots coexist
CN111984595A (en) File processing method and device and storage medium
JP2006268661A (en) Data import method and data import device
CN103207858A (en) Device and method for recommending Web service combination
CN112035169B (en) Jump processing method and device, computer equipment and computer readable storage medium
CN111078258B (en) Version upgrading method and device
CN111309370B (en) Version number directed graph ordering auditing method and system for multi-project multi-system environment
CN110515611B (en) Document number generation method
CN111400269B (en) IPFS file processing method, node, medium and equipment

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