CN112579205A - Configuration file checking method and device, computer equipment and storage medium - Google Patents

Configuration file checking method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112579205A
CN112579205A CN202011548543.9A CN202011548543A CN112579205A CN 112579205 A CN112579205 A CN 112579205A CN 202011548543 A CN202011548543 A CN 202011548543A CN 112579205 A CN112579205 A CN 112579205A
Authority
CN
China
Prior art keywords
folder
json
configuration information
user side
configuration
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
CN202011548543.9A
Other languages
Chinese (zh)
Other versions
CN112579205B (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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011548543.9A priority Critical patent/CN112579205B/en
Publication of CN112579205A publication Critical patent/CN112579205A/en
Application granted granted Critical
Publication of CN112579205B publication Critical patent/CN112579205B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Abstract

The invention discloses a configuration file checking method, a device, computer equipment and a storage medium, and relates to pedestal operation and maintenance.A server is used as a checking intermediate platform of a configuration file uploaded by a user side, after an application ID and an environment ID of the configuration file are obtained, a corresponding target sub JSON folder is obtained, configuration information is stored in the target sub JSON folder, target sub-standard configuration information corresponding to the target sub JSON folder is obtained, the configuration information is compared with the target sub-standard configuration information to obtain an information comparison difference result, if the information comparison difference result is an empty value, the configuration information is sent to an Apollo configuration center server, the same cluster user side corresponding to the user side is obtained according to a blue-green cluster ID, and the configuration information is sent to the same cluster user side. The method realizes that the contents of the configuration information are verified and then uploaded to the Apollo configuration center server, and ensures that the configuration files distributed by the Apollo configuration center server are all correct files.

Description

Configuration file checking method and device, computer equipment and storage medium
Technical Field
The invention relates to the field of process optimization of pedestal operation and maintenance, in particular to a configuration file checking method, a configuration file checking device, computer equipment and a storage medium.
Background
Currently, an Apollo (Apollo) configuration center is a popular open source configuration management center at present, can centrally manage and apply configurations of different environments and different clusters, can push the configurations to an application end in real time after configuration modification, and has the characteristics of standard authority, process management and the like.
In the process of using the Apollo, the related configuration is added to the background page of the Apollo and then stored in the Apollo configuration center, and by this way, regardless of whether the uploaded configuration file is wrong, the configuration file can be stored in the configuration center and pushed to the application end, so that the configuration process is prone to error due to lack of a data verification process, and the data accuracy of the system is reduced.
Disclosure of Invention
The embodiment of the invention provides a configuration file checking method, a configuration file checking device, computer equipment and a storage medium, and aims to solve the problems that in the prior art, a user adds a relevant configuration in an Apollo background page manually and then stores the configuration in an Apollo configuration center, and the configuration process is easy to make mistakes due to lack of a data checking process, so that the data accuracy of a system is reduced.
In a first aspect, an embodiment of the present invention provides a method for checking a configuration file, where the method includes:
receiving configuration information corresponding to compiled codes uploaded by a user side;
acquiring a current application ID, a current environment ID and a current blue-green cluster ID in the configuration information;
judging whether an application ID corresponding to a local JSON folder is the same as the current application ID or not;
if the application ID corresponding to the local JSON folder is the same as the current application ID, acquiring a target JSON folder corresponding to the corresponding application ID;
judging whether the environment ID of the sub JSON folder is the same as the current environment ID in the target JSON folder or not;
if the environment ID of the sub JSON folder in the target JSON folder is the same as the current environment ID, acquiring the corresponding target sub JSON folder, and storing the configuration information in the target sub JSON folder;
acquiring target sub-standard configuration information corresponding to the target sub-JSON folder, and comparing the configuration information with the target sub-standard configuration information to obtain an information comparison difference result;
if the information comparison difference result is a null value, the configuration information is sent to an Apollo configuration center server; and
and acquiring the same cluster user side corresponding to the user side according to the blue-green cluster ID, and sending the configuration information to the same cluster user side.
In a second aspect, an embodiment of the present invention provides a configuration file verification apparatus, which includes:
the configuration information receiving unit is used for receiving configuration information corresponding to the compiled codes uploaded by the user side;
the configuration information analysis unit is used for acquiring a current application ID, a current environment ID and a current blue-green cluster ID in the configuration information;
the first ID judging unit is used for judging whether an application ID corresponding to a local JSON folder is the same as the current application ID;
the first folder positioning unit is used for acquiring a target JSON folder corresponding to a corresponding application ID if the application ID corresponding to the local JSON folder is the same as the current application ID;
a second ID judging unit, configured to judge whether an environment ID of a child JSON folder in the target JSON folder is the same as the current environment ID;
a second folder locating unit, configured to, if the environment ID of a child JSON folder in the target JSON folder is the same as the current environment ID, obtain a corresponding target child JSON folder, and store the configuration information in the target child JSON folder;
a difference result obtaining unit, configured to obtain target sub-standard configuration information corresponding to the target sub-JSON folder, and compare the configuration information with the target sub-standard configuration information to obtain an information comparison difference result;
the configuration information uploading unit is used for sending the configuration information to an Apollo configuration center server if the information comparison difference result is a null value; and
and the configuration information synchronization unit is used for acquiring the same cluster user side corresponding to the user side according to the blue-green cluster ID and sending the configuration information to the same cluster user side.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the configuration file verification method according to the first aspect when executing the computer program.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, causes the processor to execute the profile verification method according to the first aspect.
The embodiment of the invention provides a configuration file checking method, a device, computer equipment and a storage medium, wherein a server is used as a checking intermediate platform of a configuration file uploaded by a user side, after an application ID and an environment ID of the configuration file are obtained, a corresponding target sub JSON folder is obtained, configuration information is stored in the target sub JSON folder, target sub-standard configuration information corresponding to the target sub JSON folder is obtained, the configuration information is compared with the target sub-standard configuration information to obtain an information comparison difference result, if the information comparison difference result is a null value, the configuration information is sent to an Apollo configuration center server, the same cluster user side corresponding to the user side is obtained according to a blue-green cluster ID, and the configuration information is sent to the same cluster user side. The method realizes that the contents of the configuration information are verified and then uploaded to the Apollo configuration center server, and ensures that the configuration files distributed by the Apollo configuration center server are all correct files.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a configuration file verification method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a configuration file verification method according to an embodiment of the present invention;
FIG. 3 is a schematic block diagram of a configuration file checking apparatus according to an embodiment of the present invention;
FIG. 4 is a schematic block diagram of a computer device provided by an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view of an application scenario of a configuration file verification method according to an embodiment of the present invention; fig. 2 is a schematic flowchart of a configuration file verification method according to an embodiment of the present invention, where the configuration file verification method is applied to a server and is executed by application software installed in the server.
As shown in fig. 2, the method includes steps S101 to S109.
S101, receiving configuration information corresponding to the compiled codes uploaded by the user side.
In this embodiment, for a clearer understanding of the technical solution, the following describes the related terminal in detail. The technical scheme is described in the perspective of a server.
The configuration file is named according to a preset rule and is stored to a designated folder, and then the configuration file can be automatically uploaded to a server through the Apollo client.
The second is a server, which can also be understood as a configuration file common verification platform, and is used for receiving configuration files of various different environments (such as testing, development, pre-production and production links in the software development process, each environment corresponds to one type) uploaded by a user side. And then, verifying the configuration files, and if the configuration files pass the verification, uploading the configuration files to an Apollo configuration center server by the server. And if the configuration file does not pass the verification, timely prompting the corresponding user terminal to adjust the configuration file.
And the Apollo configuration center server is used for receiving the configuration file uploaded by the server and storing the configuration file into a corresponding storage area according to the application ID and the environment ID in the configuration file. The Apollo configuration center server also provides an API (application programming interface) for modifying the configuration file, and after a user logs in a user interaction page correspondingly provided by the server, the user can modify the uploaded configuration file on line.
When the application program developer completes configuration of the configuration file (which can be understood as configuration information) on the user terminal, names the configuration file according to a preset rule and stores the configuration file into a designated folder, the configuration file is automatically uploaded to a server. And after receiving the configuration information uploaded by the user side, the server can perform subsequent verification processing.
S102, acquiring the current application ID, the current environment ID and the current blue-green cluster ID in the configuration information.
In this embodiment, after receiving the configuration information, the server first obtains various ID information in the configuration information, specifically obtains a current application ID, a current environment ID, and a current cyan cluster ID in the configuration information. The current application ID is obtained to acquire a configuration file of which application program is uploaded by a user side; acquiring a current environment ID (identity) in order to acquire a configuration file corresponding to which link the user uploads; the current blue-green cluster ID is obtained to obtain which blue-green cluster the user terminal corresponds to, so that the user terminal and which user terminal form the current blue-green cluster can be obtained.
The Blue-Green Deployment, namely the English name Blue Green Deployment, is a Deployment mode which can ensure that the system is online under the condition of providing service uninterruptedly. The model for the blue-green deployment contains two clusters, just as the left and right brains of a dolphin. Under normal circumstances without going online, the code versions of cluster a and cluster B are consistent and provide services to the outside at the same time. When the system is upgraded, a cluster (such as cluster A) is firstly removed from the load list, new version deployment is carried out, and the cluster B still continues to provide services. And after the cluster A is upgraded, the load balance is redirected to the cluster A, then the cluster B is removed from the load list, a new version is deployed, and the cluster A provides service again. Finally, when the cluster B is upgraded, the cluster B is restored to the load list. At this time, the versions of both clusters have been upgraded and there is little interruption to the external services.
S103, judging whether the application ID corresponding to the local JSON folder is the same as the current application ID.
In this embodiment, since the server stores configuration files of a plurality of different applications and configuration files of all historical versions of each application, in order to store the configuration files of each application separately, a total JSON folder may be created with an application ID of each application, and then a plurality of sub JSON folders may be created in the total JSON folder corresponding to the application ID to store configuration files of the same application under different environment IDs. Therefore, once a user uploads the configuration file of an application program, it is first determined whether an application ID corresponding to a JSON folder in a plurality of JSON folders in the local area of the server is the same as the current application ID.
And S104, if the application ID corresponding to the local JSON folder is the same as the current application ID, acquiring a target JSON folder corresponding to the corresponding application ID.
In this embodiment, if there is a local JSON folder in the server that corresponds to an application ID that is the same as the current application ID, it indicates that the existing client has uploaded a configuration file of a certain environment for the application program, and at this time, the server locally obtains a target JSON folder corresponding to the corresponding application ID, so that in step S101, the target storage area of the configuration file uploaded by the client is in the target JSON folder.
In an embodiment, step S103 is followed by:
and if the application ID corresponding to the local JSON folder does not exist is the same as the current application ID, taking the current application ID as the folder name to correspondingly create a newly-built JSON folder.
In this embodiment, if there is no application ID corresponding to the local JSON folder in the server that is the same as the current application ID, it indicates that no previous client uploads a configuration file of a certain environment for the application program, and at this time, the current application ID is used as the folder name to correspond to a new JSON folder, so that in step S101, the target storage area of the configuration file uploaded by the client is in the new JSON folder.
And S105, judging whether the environment ID of the sub JSON folder in the target JSON folder is the same as the current environment ID.
In this embodiment, the step S103 is a first verification for the configuration file storage area, and at this time, a link corresponding to the configuration file needs to be verified for the second time, that is, it is known to which link the configuration file corresponding to the application uploaded by the user side is applied (the environment of the application program includes links of testing, development, pre-production, and production in the software development process). In order to store the configuration files of the environments separately, a plurality of sub JSON folders can be created in the total JSON folder corresponding to the application ID to store the configuration files of the same application under different environment IDs, wherein each sub JSON folder corresponds to one environment ID. Therefore, once a user side uploads a configuration file of an application program, after a target JSON folder is positioned, whether the environment ID of a sub JSON folder in the target JSON folder is the same as the current environment ID needs to be judged.
And S106, if the environment ID of the sub JSON folder in the target JSON folder is the same as the current environment ID, acquiring the corresponding target sub JSON folder, and storing the configuration information in the target sub JSON folder.
In this embodiment, when the environment ID of the child JSON folder in the target JSON folder is the same as the current environment ID, indicating that the configuration ID corresponding to the environment ID is stored in the target JSON folder before, the configuration information may be stored in the target child JSON folder.
In an embodiment, step S105 is followed by:
and if the environment ID of the sub JSON folder does not exist in the target JSON folder and is the same as the current environment ID, the environment ID is taken as the folder name to correspond to the newly-built sub JSON folder.
In this embodiment, if the environment ID of the child JSON folder does not exist in the server, which is the same as the current environment ID, it indicates that no client has uploaded the configuration file of the environment for the application program before, and at this time, the environment ID is used as the folder name to correspond to the new child JSON folder in the target JSON folder, so that the target storage area of the configuration file uploaded by the client in step S101 is in the new child JSON folder.
S107, acquiring target sub-standard configuration information corresponding to the target sub-JSON folder, and comparing the configuration information with the target sub-standard configuration information to obtain an information comparison difference result.
In this embodiment, in order to avoid the existence of wrong content (for example, writing one quotation mark less or writing one space more) in the configuration file uploaded in the user side, at this time, target sub-standard configuration information corresponding to the target sub-JSON folder may be called locally by the server, and then the configuration information is compared with the target sub-standard configuration information to obtain an information comparison difference result. When the configuration information is compared with the target sub-standard configuration information, the specific process is as follows:
acquiring a first XML text corresponding to the configuration information;
acquiring a second XML text corresponding to the target sub-standard configuration information;
and comparing the first XML text with the second XML text to obtain difference data serving as an information comparison difference result.
In this embodiment, in order to facilitate data comparison, the configuration information may be converted from another format, such as JSON format, to an XML format, and then data comparison in the XML format is performed, so that the difference content between the two can be obtained quickly, and thus the information comparison difference result is obtained.
And S108, if the information comparison difference result is a null value, sending the configuration information to an Apollo configuration center server.
In this embodiment, if the information comparison difference result is a null value, it indicates that there is no error content in the configuration file uploaded by the user side, and therefore the information comparison difference result is a null value. At this time, the configuration information passing the verification can be sent to a folder corresponding to the Apollo configuration center server for storage.
More specifically, the folder form for storing the configuration files of each application under various environments in the server is completely copied in the Apollo configuration center server, that is, the target child JSON folder stored in the configuration information also exists in the Apollo configuration center server. Through the method, the configuration files are centrally verified through the server and then uploaded to the Apollo configuration center server, the server plays a role of a transfer station, and the Apollo configuration center server does not need to be changed too much.
S109, acquiring the same cluster user side corresponding to the user side according to the blue-green cluster ID, and sending the configuration information to the same cluster user side.
In this embodiment, after the configuration information is verified in the server, the same cluster user side that is in the blue-green deployment relationship with the user side also needs to update the configuration file in time, at this time, the server can send an offline request to the user side, and after the user side is switched to the offline state and the same cluster user side is switched to the online state, the server sends the configuration information to the same cluster user side, so that the blue-green deployment is realized. Thus, the configuration files in the user side and the user side of the same cluster are synchronously updated.
In an embodiment, step S109 is followed by:
and acquiring a user side list corresponding to the target sub JSON folder, analyzing and acquiring each user side in the user side list, and sending the configuration information to each user side in the user side list.
In this embodiment, each sub JSON folder corresponds to a configuration file of an environment, and configuration files uploaded by clients in the same environment are generally in the same sub JSON folder. Therefore, each sub JSON folder can store a user side list of all related user sides in the sub JSON folder, and once the configuration files in the sub JSON folder are verified successfully, the currently stored configuration files can be automatically pushed to each user side in the user side list. By the method, as long as one of the clients in the same environment uploads the configuration file, other clients can obtain the pushed configuration file in time so as to realize updating.
In an embodiment, step S107 is followed by:
and if the information comparison difference result is a non-null value, sending the information comparison difference result and the target sub-standard configuration information to the user side.
In this embodiment, if the information comparison difference result is not a null value, it indicates that there is an error content in the configuration file uploaded by the user end, and at this time, the user end needs to be prompted to adjust the configuration file to upload a correct configuration file.
The method realizes that the contents of the configuration information are verified and then uploaded to the Apollo configuration center server, and ensures that the configuration files distributed by the Apollo configuration center server are all correct files.
The embodiment of the invention also provides a configuration file checking device, which is used for executing any embodiment of the configuration file checking method. Specifically, referring to fig. 3, fig. 3 is a schematic block diagram of a configuration file checking apparatus according to an embodiment of the present invention. The profile verification apparatus 100 may be configured in a server.
As shown in fig. 3, the profile verification apparatus 100 includes: the configuration information processing device comprises a configuration information receiving unit 101, a configuration information analyzing unit 102, a first ID judging unit 103, a first folder positioning unit 104, a second ID judging unit 105, a second folder positioning unit 106, a difference result acquiring unit 107, a configuration information uploading unit 108 and a configuration information synchronizing unit 109.
The configuration information receiving unit 101 is configured to receive configuration information corresponding to the compiled code uploaded by the user side.
In this embodiment, after the application developer completes configuration of the configuration file (which may be understood as configuration information) on the user side, names the configuration file according to a preset rule, and stores the configuration file into a designated folder, the configuration file is automatically uploaded to the server. And after receiving the configuration information uploaded by the user side, the server can perform subsequent verification processing.
A configuration information analyzing unit 102, configured to obtain a current application ID, a current environment ID, and a current blue-green cluster ID in the configuration information.
In this embodiment, after receiving the configuration information, the server first obtains various ID information in the configuration information, specifically obtains a current application ID, a current environment ID, and a current cyan cluster ID in the configuration information. The current application ID is obtained to acquire a configuration file of which application program is uploaded by a user side; acquiring a current environment ID (identity) in order to acquire a configuration file corresponding to which link the user uploads; the current blue-green cluster ID is obtained to obtain which blue-green cluster the user terminal corresponds to, so that the user terminal and which user terminal form the current blue-green cluster can be obtained.
The Blue-Green Deployment, namely the English name Blue Green Deployment, is a Deployment mode which can ensure that the system is online under the condition of providing service uninterruptedly. The model for the blue-green deployment contains two clusters, just as the left and right brains of a dolphin. Under normal circumstances without going online, the code versions of cluster a and cluster B are consistent and provide services to the outside at the same time. When the system is upgraded, a cluster (such as cluster A) is firstly removed from the load list, new version deployment is carried out, and the cluster B still continues to provide services. And after the cluster A is upgraded, the load balance is redirected to the cluster A, then the cluster B is removed from the load list, a new version is deployed, and the cluster A provides service again. Finally, when the cluster B is upgraded, the cluster B is restored to the load list. At this time, the versions of both clusters have been upgraded and there is little interruption to the external services.
A first ID determining unit 103, configured to determine whether an application ID corresponding to the local JSON folder is the same as the current application ID.
In this embodiment, since the server stores configuration files of a plurality of different applications and configuration files of all historical versions of each application, in order to store the configuration files of each application separately, a total JSON folder may be created with an application ID of each application, and then a plurality of sub JSON folders may be created in the total JSON folder corresponding to the application ID to store configuration files of the same application under different environment IDs. Therefore, once a user uploads the configuration file of an application program, it is first determined whether an application ID corresponding to a JSON folder in a plurality of JSON folders in the local area of the server is the same as the current application ID.
And a first folder locating unit 104, configured to, if an application ID corresponding to a local JSON folder is the same as the current application ID, obtain a target JSON folder corresponding to the corresponding application ID.
In this embodiment, if there is a local JSON folder in the server that corresponds to an application ID that is the same as the current application ID, it indicates that the existing client has uploaded a configuration file of a certain environment for the application program, and at this time, the server locally obtains a target JSON folder corresponding to the corresponding application ID, so that in step S101, the target storage area of the configuration file uploaded by the client is in the target JSON folder.
In an embodiment, the configuration file verifying apparatus 100 further includes:
and the first file new creating unit is used for creating the JSON folder by taking the current application ID as the folder name if the application ID corresponding to the local JSON folder is not the same as the current application ID.
In this embodiment, if there is no application ID corresponding to the local JSON folder in the server that is the same as the current application ID, it indicates that no client has uploaded a configuration file of a certain environment for the application program before, and at this time, the current application ID is used as the folder name to correspond to a new JSON folder, so that the target storage area of the configuration file uploaded by the client in the configuration information receiving unit 101 is in the new JSON folder.
A second ID determining unit 105, configured to determine whether the environment ID of the child JSON folder in the target JSON folder is the same as the current environment ID.
In this embodiment, the first ID determining unit 103 performs a first verification on the configuration file storage area, and at this time, a link corresponding to the configuration file needs to be verified for a second time, that is, it is known to which link the configuration file corresponds to the application uploaded by the user side (the environment of the application program includes the links of testing, development, pre-production, and production in the software development process). In order to store the configuration files of the environments separately, a plurality of sub JSON folders can be created in the total JSON folder corresponding to the application ID to store the configuration files of the same application under different environment IDs, wherein each sub JSON folder corresponds to one environment ID. Therefore, once a user side uploads a configuration file of an application program, after a target JSON folder is positioned, whether the environment ID of a sub JSON folder in the target JSON folder is the same as the current environment ID needs to be judged.
And a second folder locating unit 106, configured to, if the environment ID of the child JSON folder in the target JSON folder is the same as the current environment ID, obtain the corresponding target child JSON folder, and store the configuration information in the target child JSON folder.
In this embodiment, when the environment ID of the child JSON folder in the target JSON folder is the same as the current environment ID, indicating that the configuration ID corresponding to the environment ID is stored in the target JSON folder before, the configuration information may be stored in the target child JSON folder.
In an embodiment, the configuration file verifying apparatus 100 further includes:
and the second file creating unit is used for creating a new sub JSON folder by taking the environment ID as the folder name if the environment ID of the sub JSON folder does not exist in the target JSON folder is the same as the current environment ID.
In this embodiment, if the environment ID of the child JSON folder does not exist in the server, which is the same as the current environment ID, it indicates that no client has uploaded the configuration file of the environment for the application program before, and at this time, the environment ID is used as the folder name to correspond to the new child JSON folder in the target JSON folder, so that the target storage area of the configuration file uploaded by the client in step S101 is in the new child JSON folder.
A difference result obtaining unit 107, configured to obtain target sub-standard configuration information corresponding to the target sub-JSON folder, and compare the configuration information with the target sub-standard configuration information to obtain an information comparison difference result.
In this embodiment, in order to avoid the existence of wrong content (for example, writing one quotation mark less or writing one space more) in the configuration file uploaded in the user side, at this time, target sub-standard configuration information corresponding to the target sub-JSON folder may be called locally by the server, and then the configuration information is compared with the target sub-standard configuration information to obtain an information comparison difference result. The matching difference result obtaining unit 107 specifically includes:
the first XML acquisition unit is used for acquiring a first XML text corresponding to the configuration information;
the second XML acquisition unit is used for acquiring a second XML text corresponding to the target sub-standard configuration information;
and the XML comparison unit is used for comparing the first XML text with the second XML text to obtain difference data serving as an information comparison difference result.
In this embodiment, in order to facilitate data comparison, the configuration information may be converted from another format, such as JSON format, to an XML format, and then data comparison in the XML format is performed, so that the difference content between the two can be obtained quickly, and thus the information comparison difference result is obtained.
And the configuration information uploading unit 108 is configured to send the configuration information to an Apollo configuration center server if the information comparison difference result is a null value.
In this embodiment, if the information comparison difference result is a null value, it indicates that there is no error content in the configuration file uploaded by the user side, and therefore the information comparison difference result is a null value. At this time, the configuration information passing the verification can be sent to a folder corresponding to the Apollo configuration center server for storage.
More specifically, the folder form for storing the configuration files of each application under various environments in the server is completely copied in the Apollo configuration center server, that is, the target child JSON folder stored in the configuration information also exists in the Apollo configuration center server. Through the method, the configuration files are centrally verified through the server and then uploaded to the Apollo configuration center server, the server plays a role of a transfer station, and the Apollo configuration center server does not need to be changed too much.
And the configuration information synchronization unit 109 is configured to acquire the same cluster user side corresponding to the user side according to the cyan cluster ID, and send the configuration information to the same cluster user side.
In this embodiment, after the configuration information is verified in the server, the same cluster user side that is in the blue-green deployment relationship with the user side also needs to update the configuration file in time, at this time, the server can send an offline request to the user side, and after the user side is switched to the offline state and the same cluster user side is switched to the online state, the server sends the configuration information to the same cluster user side, so that the blue-green deployment is realized. Thus, the configuration files in the user side and the user side of the same cluster are synchronously updated.
In an embodiment, the configuration file verifying apparatus 100 further includes:
and the configuration information Fenda unit is used for acquiring a user side list corresponding to the target sub JSON folder, analyzing and acquiring each user side in the user side list, and sending the configuration information to each user side in the user side list.
In this embodiment, each sub JSON folder corresponds to a configuration file of an environment, and configuration files uploaded by clients in the same environment are generally in the same sub JSON folder. Therefore, each sub JSON folder can store a user side list of all related user sides in the sub JSON folder, and once the configuration files in the sub JSON folder are verified successfully, the currently stored configuration files can be automatically pushed to each user side in the user side list. By the method, as long as one of the clients in the same environment uploads the configuration file, other clients can obtain the pushed configuration file in time so as to realize updating.
In an embodiment, the configuration file verifying apparatus 100 further includes:
and the standard configuration information sending unit is used for sending the information comparison difference result and the target sub-standard configuration information to the user side if the information comparison difference result is a non-null value.
In this embodiment, if the information comparison difference result is not a null value, it indicates that there is an error content in the configuration file uploaded by the user end, and at this time, the user end needs to be prompted to adjust the configuration file to upload a correct configuration file.
The device realizes the uploading of the configuration information to the Apollo configuration center server after the content of the configuration information is verified, and ensures that the configuration files distributed by the Apollo configuration center server are all correct files.
The above-described profile verification means may be implemented in the form of a computer program which may be run on a computer device as shown in fig. 4.
Referring to fig. 4, fig. 4 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device 500 is a server, and the server may be an independent server or a server cluster composed of a plurality of servers.
Referring to fig. 4, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, causes the processor 502 to perform a profile verification method.
The processor 502 is used to provide computing and control capabilities that support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be enabled to execute the configuration file checking method.
The network interface 505 is used for network communication, such as providing transmission of data information. Those skilled in the art will appreciate that the configuration shown in fig. 4 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing device 500 to which aspects of the present invention may be applied, and that a particular computing device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The processor 502 is configured to run a computer program 5032 stored in the memory to implement the configuration file verification method disclosed in the embodiment of the present invention.
Those skilled in the art will appreciate that the embodiment of a computer device illustrated in fig. 4 does not constitute a limitation on the specific construction of the computer device, and that in other embodiments a computer device may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. For example, in some embodiments, the computer device may only include a memory and a processor, and in such embodiments, the structures and functions of the memory and the processor are consistent with those of the embodiment shown in fig. 4, and are not described herein again.
It should be understood that, in the embodiment of the present invention, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In another embodiment of the invention, a computer-readable storage medium is provided. The computer readable storage medium may be a non-volatile computer readable storage medium. The computer readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the configuration file verification method disclosed by the embodiments of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided by the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only a logical division, and there may be other divisions when the actual implementation is performed, or units having the same function may be grouped into one unit, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electric, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A configuration file verification method is characterized by comprising the following steps:
receiving configuration information corresponding to compiled codes uploaded by a user side;
acquiring a current application ID, a current environment ID and a current blue-green cluster ID in the configuration information;
judging whether an application ID corresponding to a local JSON folder is the same as the current application ID or not;
if the application ID corresponding to the local JSON folder is the same as the current application ID, acquiring a target JSON folder corresponding to the corresponding application ID;
judging whether the environment ID of the sub JSON folder is the same as the current environment ID in the target JSON folder or not;
if the environment ID of the sub JSON folder in the target JSON folder is the same as the current environment ID, acquiring the corresponding target sub JSON folder, and storing the configuration information in the target sub JSON folder;
acquiring target sub-standard configuration information corresponding to the target sub-JSON folder, and comparing the configuration information with the target sub-standard configuration information to obtain an information comparison difference result;
if the information comparison difference result is a null value, the configuration information is sent to an Apollo configuration center server; and
and acquiring the same cluster user side corresponding to the user side according to the blue-green cluster ID, and sending the configuration information to the same cluster user side.
2. The method according to claim 1, wherein after determining whether the application ID corresponding to the local JSON folder is the same as the current application ID, the method further comprises:
and if the application ID corresponding to the local JSON folder does not exist is the same as the current application ID, taking the current application ID as the folder name to correspondingly create a newly-built JSON folder.
3. The method for checking a configuration file according to claim 1, wherein after determining whether the environment ID of the child JSON folder in the target JSON folder is the same as the current environment ID, the method further comprises:
and if the environment ID of the sub JSON folder does not exist in the target JSON folder and is the same as the current environment ID, the environment ID is taken as the folder name to correspond to the newly-built sub JSON folder.
4. The method for checking configuration files according to claim 1, wherein the comparing the configuration information with the target sub-standard configuration information to obtain an information comparison difference result includes:
acquiring a first XML text corresponding to the configuration information;
acquiring a second XML text corresponding to the target sub-standard configuration information;
and comparing the first XML text with the second XML text to obtain difference data serving as an information comparison difference result.
5. The method for checking a configuration file according to claim 1, further comprising:
and if the information comparison difference result is a non-null value, sending the information comparison difference result and the target sub-standard configuration information to the user side.
6. The method according to claim 1, wherein after the acquiring the same cluster user side corresponding to the user side according to the cyan cluster ID and sending the configuration information to the same cluster user side, the method further comprises:
and acquiring a user side list corresponding to the target sub JSON folder, analyzing and acquiring each user side in the user side list, and sending the configuration information to each user side in the user side list.
7. A profile verification apparatus, comprising:
the configuration information receiving unit is used for receiving configuration information corresponding to the compiled codes uploaded by the user side;
the configuration information analysis unit is used for acquiring a current application ID, a current environment ID and a current blue-green cluster ID in the configuration information;
the first ID judging unit is used for judging whether an application ID corresponding to a local JSON folder is the same as the current application ID;
the first folder positioning unit is used for acquiring a target JSON folder corresponding to a corresponding application ID if the application ID corresponding to the local JSON folder is the same as the current application ID;
a second ID judging unit, configured to judge whether an environment ID of a child JSON folder in the target JSON folder is the same as the current environment ID;
a second folder locating unit, configured to, if the environment ID of a child JSON folder in the target JSON folder is the same as the current environment ID, obtain a corresponding target child JSON folder, and store the configuration information in the target child JSON folder;
a difference result obtaining unit, configured to obtain target sub-standard configuration information corresponding to the target sub-JSON folder, and compare the configuration information with the target sub-standard configuration information to obtain an information comparison difference result;
the configuration information uploading unit is used for sending the configuration information to an Apollo configuration center server if the information comparison difference result is a null value; and
and the configuration information synchronization unit is used for acquiring the same cluster user side corresponding to the user side according to the blue-green cluster ID and sending the configuration information to the same cluster user side.
8. The profile verification apparatus according to claim 7, wherein the difference result obtaining unit includes:
the first XML acquisition unit is used for acquiring a first XML text corresponding to the configuration information;
the second XML acquisition unit is used for acquiring a second XML text corresponding to the target sub-standard configuration information;
and the XML comparison unit is used for comparing the first XML text with the second XML text to obtain difference data serving as an information comparison difference result.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the profile verification method according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to execute the profile verification method according to any one of claims 1 to 6.
CN202011548543.9A 2020-12-24 2020-12-24 Configuration file checking method and device, computer equipment and storage medium Active CN112579205B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011548543.9A CN112579205B (en) 2020-12-24 2020-12-24 Configuration file checking method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011548543.9A CN112579205B (en) 2020-12-24 2020-12-24 Configuration file checking method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112579205A true CN112579205A (en) 2021-03-30
CN112579205B CN112579205B (en) 2023-02-14

Family

ID=75139584

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011548543.9A Active CN112579205B (en) 2020-12-24 2020-12-24 Configuration file checking method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112579205B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113268249A (en) * 2021-06-09 2021-08-17 深圳市分秒网络科技有限公司 Android APK file analysis and automatic configuration method
CN114237754A (en) * 2021-12-20 2022-03-25 中国平安财产保险股份有限公司 Data loading method and device, electronic equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6598057B1 (en) * 1999-12-22 2003-07-22 Cisco Technology, Inc. Method and apparatus for generating configuration files using policy descriptions
US20030204578A1 (en) * 2002-04-26 2003-10-30 Michael Yip Method and apparatus for restoring the configuration of a network device
US20170118382A1 (en) * 2015-10-21 2017-04-27 Konica Minolta, Inc. Profile creation apparatus, non-transitory computer-readable storage medium storing profile creation program and color matching metod
CN109240755A (en) * 2018-06-28 2019-01-18 平安科技(深圳)有限公司 A kind of configuration file comparison method and configuration file Compare System
CN109254869A (en) * 2018-08-30 2019-01-22 郑州云海信息技术有限公司 Memory rigging position method of calibration and device, storage medium and electronic equipment
US20190265982A1 (en) * 2018-02-28 2019-08-29 Forcepoint Llc System and method for managing system configuration data models
CN110263305A (en) * 2019-05-22 2019-09-20 中国平安财产保险股份有限公司 Configuration file control methods, device, equipment and storage medium
CN110334248A (en) * 2019-06-26 2019-10-15 京东数字科技控股有限公司 A kind of system configuration information treating method and apparatus
CN110825420A (en) * 2019-11-26 2020-02-21 中国银行股份有限公司 Configuration parameter updating method, device, equipment and storage medium for distributed cluster
CN111309593A (en) * 2020-01-16 2020-06-19 中国平安财产保险股份有限公司 JSON interface verification method, device and equipment and computer readable storage medium
CN111782528A (en) * 2020-06-30 2020-10-16 中国平安人寿保险股份有限公司 Configuration information comparison method and device, computer equipment and storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6598057B1 (en) * 1999-12-22 2003-07-22 Cisco Technology, Inc. Method and apparatus for generating configuration files using policy descriptions
US20030204578A1 (en) * 2002-04-26 2003-10-30 Michael Yip Method and apparatus for restoring the configuration of a network device
US20170118382A1 (en) * 2015-10-21 2017-04-27 Konica Minolta, Inc. Profile creation apparatus, non-transitory computer-readable storage medium storing profile creation program and color matching metod
US20190265982A1 (en) * 2018-02-28 2019-08-29 Forcepoint Llc System and method for managing system configuration data models
CN109240755A (en) * 2018-06-28 2019-01-18 平安科技(深圳)有限公司 A kind of configuration file comparison method and configuration file Compare System
CN109254869A (en) * 2018-08-30 2019-01-22 郑州云海信息技术有限公司 Memory rigging position method of calibration and device, storage medium and electronic equipment
CN110263305A (en) * 2019-05-22 2019-09-20 中国平安财产保险股份有限公司 Configuration file control methods, device, equipment and storage medium
CN110334248A (en) * 2019-06-26 2019-10-15 京东数字科技控股有限公司 A kind of system configuration information treating method and apparatus
CN110825420A (en) * 2019-11-26 2020-02-21 中国银行股份有限公司 Configuration parameter updating method, device, equipment and storage medium for distributed cluster
CN111309593A (en) * 2020-01-16 2020-06-19 中国平安财产保险股份有限公司 JSON interface verification method, device and equipment and computer readable storage medium
CN111782528A (en) * 2020-06-30 2020-10-16 中国平安人寿保险股份有限公司 Configuration information comparison method and device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李磊等: "智能变电站配置文件管控策略研究及应用", 《华北电力技术》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113268249A (en) * 2021-06-09 2021-08-17 深圳市分秒网络科技有限公司 Android APK file analysis and automatic configuration method
CN114237754A (en) * 2021-12-20 2022-03-25 中国平安财产保险股份有限公司 Data loading method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112579205B (en) 2023-02-14

Similar Documents

Publication Publication Date Title
CN112579205B (en) Configuration file checking method and device, computer equipment and storage medium
US9703798B2 (en) System and method for file sharing and updating
US9021462B2 (en) Systems and methods for provisioning equipment
CN105718268A (en) Method and device for verifying OTA multi-pack upgrading
CN102541941A (en) Version management control method for multiple parties to co-operate file
CN107193607B (en) Method and apparatus for updating code file, storage medium, processor, and terminal
US20210258210A1 (en) Data driven user interface for configuring device settings
CN109857423B (en) Program version updating method and device, server and readable storage medium
US20180246904A1 (en) Distributed code repository with limited synchronization locking
CN105808373A (en) Incremental backup method and device of data, and NAS (Network Attached Storage) equipment
CN110535776B (en) Gateway current limiting method, device, gateway, system and storage medium
US20220326940A1 (en) Service Upgrade Method, Apparatus, and System
CN105704241A (en) Client terminal program updating method and system and a service platform
CN111338869B (en) Configuration parameter management method, device, equipment and storage medium
CN108616391A (en) Method and system for upgrading equipment firmware at server side
CN115617780A (en) Data import method, device, equipment and storage medium
CN110007946B (en) Method, device, equipment and medium for updating algorithm model
CN111158716B (en) Version upgrade calling method and device, computer system and readable storage medium
EP3346642A1 (en) Method and device for managing network element model
CN110958293A (en) File transmission method, system, server and storage medium based on cloud server
EP2711836B1 (en) Data distribution system
CN114327578A (en) Private deployment system upgrading method and device, computer equipment and storage medium
CN111475479B (en) Project file management method and device
CN111209332B (en) Database synchronization method based on homemade serialization algorithm
CN114385570A (en) Data synchronization method and device, electronic equipment and readable medium

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