CN114385759B - Configuration file synchronization method and device, computer equipment and storage medium - Google Patents

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

Info

Publication number
CN114385759B
CN114385759B CN202210037252.6A CN202210037252A CN114385759B CN 114385759 B CN114385759 B CN 114385759B CN 202210037252 A CN202210037252 A CN 202210037252A CN 114385759 B CN114385759 B CN 114385759B
Authority
CN
China
Prior art keywords
configuration file
request
configuration
modification
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.)
Active
Application number
CN202210037252.6A
Other languages
Chinese (zh)
Other versions
CN114385759A (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 Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202210037252.6A priority Critical patent/CN114385759B/en
Publication of CN114385759A publication Critical patent/CN114385759A/en
Application granted granted Critical
Publication of CN114385759B publication Critical patent/CN114385759B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles

Abstract

The application relates to the technical field of data processing and discloses a method, a device, computer equipment and a storage medium for synchronizing configuration files, wherein the method comprises the steps of obtaining a configuration file modification request, modifying a configuration file corresponding to the configuration file modification request, and storing the obtained modified configuration file in a remote GitLab warehouse; the configuration file is pulled regularly and stored in a local Git warehouse; taking the changed configuration file as a configuration file to be synchronized and corresponding mark information; and encapsulating the mark information, generating a query request, acquiring an IP address list through the query request, and synchronizing the configuration file into the IP address list. The application also relates to a blockchain technology, and the configuration file to be synchronized is stored in the blockchain. The configuration file synchronization accuracy of the large-scale application cluster is improved by acquiring and synchronizing the configuration file at fixed time.

Description

Configuration file synchronization method and device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a method and apparatus for synchronizing configuration files, a computer device, and a storage medium.
Background
Configuration file management of a large-scale application cluster is an important task of operation and maintenance, and includes multiple requirements, including how to uniformly manage configuration files, how to automatically modify configuration files by a docking flow platform or a CICD platform, how to enable the modified configuration files to be quickly and accurately synchronized to each server in the corresponding application cluster, and how to dock to Kubernetes. Wherein the synchronization of configuration files for large-scale application clusters is a more important task.
The existing configuration file synchronization method is managed by using a mode of Puppet+GitLab, git is responsible for recording file versions, and Puppet is responsible for synchronizing configuration to a server. The C/S architecture of Puppet makes the client also need to install Puppet Agent, and SSL certificate, puppet configuration file, etc. need to be managed, so that management is complex, and the situation that configuration files cannot be synchronized normally easily occurs, so that configuration files among clusters are inconsistent, and further, the synchronization accuracy of the configuration files is low. There is a need for a method for improving the accuracy of profile synchronization for large-scale application clusters.
Disclosure of Invention
An embodiment of the application aims to provide a configuration file synchronization method, a configuration file synchronization device, computer equipment and a storage medium, so as to improve the accuracy of configuration file synchronization of a large-scale application cluster.
In order to solve the above technical problems, an embodiment of the present application provides a method for synchronizing configuration files, including:
acquiring a configuration file modification request, modifying a configuration file corresponding to the configuration file modification request based on the configuration file modification request to obtain a modified configuration file, and storing the modified configuration file in a remote GitLab warehouse, wherein the modified configuration file comprises a modification identifier;
pulling a configuration file from the remote GitLab warehouse at regular time through a timing task, and storing the configuration file in a local Git warehouse;
in the local Git warehouse, if the configuration file is judged to be changed, the changed configuration file is used as a configuration file to be synchronized, and mark information corresponding to the configuration file to be synchronized is obtained, wherein the mark information comprises a module to which the file belongs, an environment to which the file belongs and an application to which the file belongs;
the flag information is packaged, a query request is generated, and the configuration management database is queried through the query request, so that an IP address list returned by the configuration management database is obtained;
And synchronizing the configuration file into the IP address list through a preset backup tool.
In order to solve the above technical problems, an embodiment of the present application provides a synchronization device for a configuration file, including:
the configuration file storage module is used for acquiring a configuration file modification request, modifying a configuration file corresponding to the configuration file modification request based on the configuration file modification request to obtain a modified configuration file, and storing the modified configuration file in a remote GitLab warehouse, wherein the modified configuration file comprises a modification identifier;
the configuration file pulling module is used for pulling the configuration file from the remote GitLab warehouse at regular time through a timing task and storing the configuration file in the local Git warehouse;
the mark information acquisition module is used for taking the changed configuration file as a configuration file to be synchronized and acquiring mark information corresponding to the configuration file to be synchronized if the configuration file is judged to be changed in the local Git warehouse, wherein the mark information comprises a module to which the file belongs, an environment to which the file belongs and an application to which the file belongs;
The address list acquisition module is used for packaging the mark information, generating a query request, and querying a configuration management database through the query request to acquire an IP address list returned by the configuration management database;
and the configuration file synchronization module is used for synchronizing the configuration file into the IP address list through a preset backup tool.
In order to solve the technical problems, the invention adopts a technical scheme that: a computer device is provided comprising one or more processors; and the memory is used for storing one or more programs, so that the one or more processors can realize the method for synchronizing the configuration files.
In order to solve the technical problems, the invention adopts a technical scheme that: a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the method of synchronizing profiles of any one of the above.
The embodiment of the invention provides a method and a device for synchronizing configuration files, computer equipment and a storage medium. The method comprises the following steps: acquiring a configuration file modification request, modifying a configuration file corresponding to the configuration file modification request based on the configuration file modification request to obtain a modified configuration file, and storing the modified configuration file in a remote GitLab warehouse, wherein the modified configuration file comprises a modification identifier; pulling a configuration file from a remote GitLab warehouse at regular time through a timing task, and storing the configuration file in a local Git warehouse; in a local Git warehouse, if the configuration file is judged to be changed, the changed configuration file is used as a configuration file to be synchronized, and mark information corresponding to the configuration file to be synchronized is obtained, wherein the mark information comprises a module to which the file belongs, an environment to which the file belongs and an application to which the file belongs; the flag information is packaged, a query request is generated, and the configuration management database is queried through the query request, so that an IP address list returned by the configuration management database is obtained; and synchronizing the configuration file into the IP address list through a preset backup tool. The embodiment of the invention acquires the configuration files at fixed time and judges which configuration files need to be updated, realizes that the changed configuration files are used as the configuration files to be synchronized, acquires the corresponding IP address list by analyzing the mark information of the configuration files to be synchronized, and synchronizes the configuration files to be synchronized to the corresponding IP address list, thereby being beneficial to improving the configuration file synchronization accuracy of the large-scale application cluster.
Drawings
For a clearer description of the solution in the present application, a brief description will be given below of the drawings that are needed in the description of the embodiments of the present application, it being obvious that the drawings in the following description are some embodiments of the present application, and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is a flowchart of an implementation of a sub-process in a method for synchronizing configuration files according to an embodiment of the present application;
FIG. 2 is a flowchart of still another implementation of a sub-process in the method for synchronizing configuration files provided in an embodiment of the present application;
FIG. 3 is a flowchart of still another implementation of a sub-process in the method for synchronizing configuration files provided in an embodiment of the present application;
FIG. 4 is a flowchart of still another implementation of a sub-process in the method for synchronizing configuration files provided in an embodiment of the present application;
FIG. 5 is a flowchart of still another implementation of a sub-process in the method for synchronizing configuration files provided in an embodiment of the present application;
FIG. 6 is a flowchart of still another implementation of a sub-process in the method for synchronizing configuration files provided in an embodiment of the present application;
FIG. 7 is a flowchart of still another implementation of a sub-process in the method for synchronizing configuration files provided in an embodiment of the present application;
FIG. 8 is a schematic diagram of a synchronization device for configuration files according to an embodiment of the present application;
fig. 9 is a schematic diagram of a computer device provided in an embodiment of the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the applications herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description and claims of the present application and in the description of the figures above are intended to cover non-exclusive inclusions. The terms first, second and the like in the description and in the claims or in the above-described figures, are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In order to better understand the technical solutions of the present application, the following description will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings.
The present invention will be described in detail with reference to the drawings and embodiments.
It should be noted that, the method for synchronizing the configuration files provided in the embodiments of the present application is generally executed by a server, and accordingly, the device for synchronizing the configuration files is generally configured in the server.
Referring to fig. 1, fig. 1 illustrates an embodiment of a method for synchronizing configuration files.
It should be noted that, if there are substantially the same results, the method of the present invention is not limited to the flow sequence shown in fig. 1, and the method includes the following steps:
s1: acquiring a configuration file modification request, modifying a configuration file corresponding to the configuration file modification request based on the configuration file modification request to obtain a modified configuration file, and storing the modified configuration file in a remote GitLab warehouse.
Specifically, when a developer needs to modify a configuration file, the developer sends a configuration file modification request to a server, wherein the configuration file modification request comprises the configuration file needing modification and a modification requirement; after the server acquires the configuration file modification request, modifying the configuration file corresponding to the configuration file modification request to obtain a modified configuration file; the configuration file after modification is stored in the local Git of the client at this time, and is stored in a remote GitLab warehouse for the subsequent convenience of synchronization of the configuration file after modification.
Referring to fig. 2, fig. 2 shows a specific embodiment of step S1, which is described in detail as follows:
s11: and acquiring a modification profile request, and analyzing the modification profile request to acquire a profile and a modification requirement corresponding to the modification profile request.
S12: and modifying the configuration file corresponding to the configuration file modification request based on the modification requirement to obtain a modified configuration file.
S13: and executing a preset push command, and transmitting the modified configuration file from the client local Git warehouse to the remote GitLab warehouse.
Specifically, after a developer's request for modifying a configuration file is obtained, the embodiment of the application parses the modification configuration file to obtain a configuration file to be modified and a modification requirement, modifies the configuration file to be modified based on the modification requirement, thereby obtaining a modified configuration file, synchronizes the modified configuration file to a client local Git warehouse in a way of changing the Git warehouse, executes a preset Push command (Git Push), and transmits the modified configuration file from the client local Git warehouse to a remote GitLab warehouse. And each modified profile includes a change identifier, based on which, in a subsequent step, it can be identified which profiles belong to the modified profile in order to synchronize the modified profile.
The GitLab is an open source project for a warehouse management system, uses Git as a code management tool and is a Web service built on the basis. In this embodiment, the modified configuration file is stored by the remote gilab repository, so that the modified configuration file is conveniently synchronized to the corresponding service cluster in the following.
In this embodiment, the configuration file request is obtained and parsed to obtain the configuration file and the modification requirement corresponding to the modification configuration file request, then the configuration file corresponding to the modification configuration file request is modified based on the modification requirement to obtain a modified configuration file, then a preset push command is executed, and the modified configuration file is transmitted from the client local Git warehouse to the remote GitLab warehouse, so that the modified configuration file is transmitted from the client local Git warehouse to the remote GitLab warehouse, and the corresponding configuration file is conveniently pulled by a timing task, thereby being beneficial to improving the accuracy of synchronization of the configuration file.
Referring to fig. 3, fig. 3 shows a specific embodiment before step S1, which is described in detail as follows:
S1A: and acquiring a new configuration file request, and analyzing the new configuration file request to acquire a file path corresponding to the new configuration file request.
S1B: based on the file path, acquiring a configuration file corresponding to the newly added file request as the newly added configuration file, wherein the newly added configuration file comprises a change identifier.
S1C: and executing a preset push command, and transmitting the newly added configuration file from the client local Git warehouse to the remote GitLab warehouse.
Specifically, the embodiment of the application not only synchronizes the modified configuration file, but also acquires the newly added configuration file for synchronization. Therefore, after the new configuration file request is obtained, the new configuration file request is analyzed to obtain a file path corresponding to the new configuration file request, the corresponding new configuration file is extracted from the client local Git warehouse through the file path, a preset Push command (Git Push) is executed, and the modified configuration file is transmitted from the client local Git warehouse to the remote GitLab warehouse. And each newly added configuration file comprises a change identifier, and in the subsequent step, based on the change identifier, it can be identified which configuration files belong to the modified configuration file or the newly added configuration file, so as to synchronize the configuration files. Furthermore, the embodiment of the application provides a static HTTP service, and a developer can download the configuration file, modify the configuration file, and generate a configuration file modification request and a configuration file addition request.
In this embodiment, the new configuration file request is obtained and parsed to obtain a file path corresponding to the new configuration file request, and then, based on the file path, a configuration file corresponding to the new configuration file request is obtained as a new configuration file, and then, a preset push command is executed to transmit the new configuration file from the client local Git warehouse to the remote GitLab warehouse, so that transmission of the new configuration file is realized, and the corresponding configuration file is conveniently pulled through a timing task, thereby being beneficial to improving the accuracy of synchronization of the configuration file.
S2: by means of the timing task, the configuration file is pulled from the remote GitLab warehouse at fixed time, and the configuration file is stored in the local Git warehouse.
Specifically, by setting a timing task, executing the Git Pull command at fixed time, pulling a configuration file from a remote GitLab warehouse, and storing the pulled configuration file in a local Git warehouse. The setting time of the timing task is set according to the actual situation, and is not limited herein. In one embodiment, the set time is 10 seconds.
Referring to fig. 4, fig. 4 shows a specific embodiment after step S2, which is described in detail as follows:
S2A: and polling the remote application at regular time, and judging whether the remote application has an application capacity expansion condition or not to obtain a judging result.
S2B: and if the judgment result is that the remote application has the application capacity expansion condition, acquiring the request parameters of the client.
S2C: based on the client request parameters, acquiring configuration files corresponding to the client request parameters as configuration files to be synchronized.
Specifically, if the remote application has capacity expansion or inconsistent special files, the synchronous task is not triggered by depending on the timing task, an application program service interface (HTTP API) can be exposed to the outside, and the synchronous task is executed according to the request parameters of the client. In the embodiment of the application, the remote application is polled regularly to judge whether the remote application has an application capacity expansion condition, and if the remote application is judged to have the application capacity expansion condition, the client request parameters are acquired through an application program service interface (HTTP API), and then the configuration files corresponding to the client request parameters are synchronized based on the client request parameters. The time for polling the remote application periodically is set according to the actual situation, and is not limited herein. In one embodiment, the remote application is polled once by 24 hours.
S3: and in the local Git warehouse, if the configuration file is judged to be changed, taking the changed configuration file as the configuration file to be synchronized, and acquiring the mark information corresponding to the configuration file to be synchronized.
The mark information comprises a module to which the file belongs, an environment to which the file belongs and an application to which the file belongs.
Referring to fig. 5, fig. 5 shows a specific embodiment of step S3, which is described in detail as follows:
s31: in the local Git warehouse, judging whether the configuration file comprises a change identifier or not in a traversing mode.
S32: if the configuration file comprises a change identifier, the configuration file is judged to be changed, and the changed configuration file is obtained and is used as the configuration file to be synchronized.
S33: and splitting the path corresponding to the configuration file to be synchronized to obtain the mark information of the configuration file.
Specifically, since the steps above have implemented the regular pull of the configuration files, but these configuration files include the configuration files that have not been modified or changed, the configuration files that have been modified and the newly added configuration files, the configuration files that have not been modified or changed have been configured in synchronization with the corresponding server clusters before. The embodiment of the application mainly synchronizes the modified configuration files with the newly added configuration files, so that in a local Git warehouse, firstly judging which configuration files are changed, wherein the judging basis is whether the configuration files comprise change identifications, and obtaining the configuration files with the change identifications by traversing all the configuration files in the local Git warehouse, and taking the configuration files as the configuration files to be synchronized; and then obtaining the marking information of the file to be synchronized, wherein the marking information comprises a module to which the file belongs, an environment to which the file belongs and an application to which the file belongs, and the marking information is used for obtaining a corresponding server IP address, namely the address information to which the configuration file to be synchronized needs to be synchronized.
In this embodiment, in the local Git repository, whether the configuration files include the change identifier is determined by traversing, if the configuration files include the change identifier, the configuration files are determined to be changed, the changed configuration files are obtained and are used as the configuration files to be synchronized, and finally, the path corresponding to the configuration files to be synchronized is segmented to obtain the mark information of the configuration files, so that the pulled configuration files are identified, the configuration files are determined to need to be synchronized, and the configuration files to be synchronized are determined, thereby being beneficial to improving the accuracy of synchronization of the configuration files.
Referring to fig. 6, fig. 6 shows a specific embodiment of step S33, which is described in detail as follows:
s331: and acquiring an absolute path corresponding to the configuration file to be synchronized as a target absolute path.
S332: and identifying the separator in the target absolute path through a preset segmentation command.
S333: and cutting the target absolute path based on the separator to obtain the mark information of the configuration file.
Specifically, each configuration file to be synchronized has a corresponding absolute path, so that the absolute path of each configuration file to be synchronized is obtained and is taken as a target absolute path; and then, identifying a separator in the target absolute path by executing a preset segmentation command, and segmenting the target absolute path based on the separator, so as to obtain the mark information such as a module to which the file belongs, an environment to which the file belongs, an application to which the file belongs and the like. In one embodiment, the absolute path is C\Programmfiles (x 86) \Common files\Microsoft shared\DevServer\10.0, the separator is identified as "\", and the absolute path is segmented according to the separator, thereby obtaining the mark information.
In this embodiment, by acquiring the absolute path corresponding to the configuration file to be synchronized as the target absolute path, then identifying the separator in the target absolute path through the preset segmentation command, and finally segmenting the target absolute path based on the separator to obtain the flag information of the configuration file, the segmentation of the path corresponding to the configuration file to be synchronized is realized, the subsequent acquisition of the IP address corresponding to each configuration file to be synchronized is facilitated, and thus the accuracy of the synchronization of the configuration files is facilitated.
S4: and packaging the mark information, generating a query request, and querying the configuration management database through the query request to acquire an IP address list returned by the configuration management database.
Referring to fig. 7, fig. 7 shows a specific embodiment of step S4, which is described in detail as follows:
s41: and packaging the mark information to generate a query request.
S42: and sending the query request to a configuration management database for query to obtain the IP address of each configuration file to be synchronized.
S43: and combining the IP addresses of each configuration file to be synchronized to obtain an IP address list.
Specifically, because a plurality of configuration files possibly exist to be synchronized, the marking information is packaged to generate a query request, and then the query request is sent to a configuration management database to be queried, so that the IP address of each configuration file to be synchronized is obtained; and combining the IP addresses of each configuration file to be synchronized to obtain an IP address list. In this embodiment, a query request is generated through the flag information, and after the IP address of each configuration file to be synchronized is obtained based on the query request, in the following, the corresponding configuration file to be synchronized may be synchronized to the address according to each IP address, thereby being beneficial to improving accuracy of configuration file synchronization.
Where the configuration management database refers to Configuration Management Database (CMDB) which contains all relevant information of components of the information system used by IT services of an organization and the relationships between these components. The components of the information system mentioned above are also referred to as configuration items (configuration items, CI), one configuration item can be any conceivable IT component, including software, hardware, files and personnel, and combinations thereof. In the embodiment of the application, the configuration management database stores the IP addresses corresponding to the remote applications, and the IP addresses of the corresponding remote applications can be obtained through the query request.
S5: and synchronizing the configuration file into the IP address list through a preset backup tool.
Specifically, the above steps have obtained the list of the server IP addresses to be synchronized, and the IP addresses are used as the target terminals, and the configuration files are synchronized into the list of the IP addresses through a preset backup tool. The preset backup tool can be an Rsync, which is a data mirror backup tool in a linux system, and the RemoteSync can be used for remote synchronization, support local replication or be synchronized with other SSH and Rsync hosts.
Since existing profile synchronization methods are managed using a pattern of puppet+gitlab, git is responsible for recording the file version and Puppet is responsible for synchronizing the configuration to the server. The C/S architecture of Puppet makes the client also need to install Puppet Agent, and SSL certificate, puppet configuration file, etc. need to be managed, so that management is complex, and the situation that configuration files cannot be synchronized normally easily occurs, so that configuration files among clusters are inconsistent, and further, the synchronization accuracy of the configuration files is low. In the embodiment of the application, the configuration files are synchronized based on the GitLab, and SSL certificates are not required to be managed, so that the normal synchronization of the configuration files can be ensured, and the configuration files among clusters are kept consistent.
The Puppet is a centralized configuration management system of a Linux, unix, windows platform, and can manage configuration files, users, cron tasks, software packages, system services and the like by using an own Puppet description language. SSL (Secure Socket Layer) certificate is a type of digital certificate, similar to an electronic copy of a driver's license, passport, and business license, because it is deployed on a server, also known as an SSL server certificate. The C/S architecture, i.e., client-Server architecture, also known as Server-Client architecture, typically takes a two-tier architecture, with the Server responsible for data management and the Client responsible for completing the task of interaction with the user.
In this embodiment, a configuration file modification request is obtained, and a configuration file corresponding to the configuration file modification request is modified based on the configuration file modification request to obtain a modified configuration file, and the modified configuration file is stored in a remote GitLab repository, where the modified configuration file includes a modification identifier; pulling a configuration file from a remote GitLab warehouse at regular time through a timing task, and storing the configuration file in a local Git warehouse; in a local Git warehouse, if the configuration file is judged to be changed, the changed configuration file is used as a configuration file to be synchronized, and mark information corresponding to the configuration file to be synchronized is obtained, wherein the mark information comprises a module to which the file belongs, an environment to which the file belongs and an application to which the file belongs; the flag information is packaged, a query request is generated, and the configuration management database is queried through the query request, so that an IP address list returned by the configuration management database is obtained; and synchronizing the configuration file into the IP address list through a preset backup tool. The embodiment of the invention acquires the configuration files at fixed time and judges which configuration files need to be updated, realizes that the changed configuration files are used as the configuration files to be synchronized, acquires the corresponding IP address list by analyzing the mark information of the configuration files to be synchronized, and synchronizes the configuration files to be synchronized to the corresponding IP address list, thereby being beneficial to improving the configuration file synchronization accuracy of the large-scale application cluster.
It should be emphasized that, to further ensure the privacy and security of the configuration files to be synchronized, the configuration files to be synchronized may also be stored in a node of a blockchain.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored in a computer-readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. The storage medium may be a nonvolatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a random access Memory (Random Access Memory, RAM).
Referring to fig. 8, as an implementation of the method shown in fig. 1, the present application provides an embodiment of a device for synchronizing a configuration file, where an embodiment of the device corresponds to the embodiment of the method shown in fig. 1, and the device may be specifically applied to various electronic devices.
As shown in fig. 8, the synchronization device for a configuration file of this embodiment includes: a configuration file storage module 61, a configuration file pulling module 62, a flag information acquisition module 63, an address list acquisition module 64 and a configuration file synchronization module 65, wherein:
The configuration file storage module 61 is configured to obtain a configuration file modification request, modify a configuration file corresponding to the configuration file modification request based on the configuration file modification request, obtain a modified configuration file, and store the modified configuration file in a remote GitLab repository, where the modified configuration file includes a modification identifier;
a profile pulling module 62, configured to pull the profile from the remote GitLab repository at regular time by a timing task, and store the profile in the local Git repository;
a flag information obtaining module 63, configured to, in the local Git repository, take the changed configuration file as a configuration file to be synchronized if it is determined that the configuration file has been changed, and obtain flag information corresponding to the configuration file to be synchronized, where the flag information includes a module to which the file belongs, an environment to which the file belongs, and an application to which the file belongs;
the address list obtaining module 64 is configured to encapsulate the flag information, generate a query request, and query the configuration management database through the query request to obtain an IP address list returned by the configuration management database;
the configuration file synchronization module 65 is configured to synchronize the configuration file to the IP address list through a preset backup tool.
Further, the profile storage module 61 includes:
the modification configuration file request acquisition unit is used for acquiring a modification configuration file request and analyzing the modification configuration file request to acquire a configuration file and a modification requirement corresponding to the modification configuration file request;
the configuration file modification unit is used for modifying the configuration file corresponding to the configuration file modification request based on the modification requirement to obtain a modified configuration file;
and the pushing command execution unit is used for executing a preset pushing command and transmitting the modified configuration file from the client local Git warehouse to the remote GitLab warehouse.
Further, the configuration file storage module 61 further includes:
the new configuration file request acquisition module is used for acquiring a new configuration file request and analyzing the new configuration file request to acquire a file path corresponding to the new configuration file request;
the new configuration file acquisition module is used for acquiring a configuration file corresponding to the new file request based on the file path as a new configuration file, wherein the new configuration file comprises a change identifier;
and the newly added configuration file transmission module is used for executing a preset pushing command and transmitting the newly added configuration file from the client local Git warehouse to the remote GitLab warehouse.
Further, the profile pulling module 62 further includes:
the capacity expansion condition judging module is used for polling the remote application at regular time and judging whether the remote application has an application capacity expansion condition or not so as to obtain a judging result;
the client request parameter acquisition module is used for acquiring the client request parameters if the judgment result shows that the remote application has the application capacity expansion condition;
the client request parameter processing module is used for acquiring a configuration file corresponding to the client request parameter based on the client request parameter as a configuration file to be synchronized.
Further, the flag information acquisition module 63 includes:
the change identification judging unit is used for judging whether the configuration file comprises a change identification or not in a local Git warehouse in a traversing mode;
the to-be-synchronized configuration file determining unit is used for judging that the configuration file is changed if the configuration file comprises a change identifier, and acquiring the changed configuration file as the to-be-synchronized configuration file;
the path segmentation unit is used for obtaining the mark information of the configuration file by segmenting the path corresponding to the configuration file to be synchronized.
Further, the path splitting unit includes:
the target absolute path acquisition subunit is used for acquiring an absolute path corresponding to the configuration file to be synchronized as a target absolute path;
A separator identification subunit, configured to identify a separator in the target absolute path through a preset segmentation command;
and the target absolute path segmentation subunit is used for segmenting the target absolute path based on the separator to obtain the mark information of the configuration file.
Further, the address list obtaining module 64 includes:
the query request generation unit is used for packaging the mark information and generating a query request;
the query request query unit is used for sending a query request to the configuration management database for query to obtain the IP address of each configuration file to be synchronized;
and the address combination unit is used for combining the IP addresses of each configuration file to be synchronized to obtain an IP address list.
It should be emphasized that, to further ensure the privacy and security of the configuration files to be synchronized, the configuration files to be synchronized may also be stored in a node of a blockchain.
In order to solve the technical problems, the embodiment of the application also provides computer equipment. Referring specifically to fig. 9, fig. 9 is a basic structural block diagram of a computer device according to the present embodiment.
The computer device 7 comprises a memory 71, a processor 72, a network interface 73 communicatively connected to each other via a system bus. It is noted that only a computer device 7 having three components memory 71, a processor 72, a network interface 73 is shown in the figures, but it should be understood that not all of the illustrated components are required to be implemented and that more or fewer components may be implemented instead. It will be appreciated by those skilled in the art that the computer device herein is a device capable of automatically performing numerical calculations and/or information processing in accordance with predetermined or stored instructions, the hardware of which includes, but is not limited to, microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASICs), programmable gate arrays (fields-Programmable Gate Array, FPGAs), digital processors (Digital Signal Processor, DSPs), embedded devices, etc.
The computer device may be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The computer device can perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad or voice control equipment and the like.
The memory 71 includes at least one type of readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory, etc.), random Access Memory (RAM), static Random Access Memory (SRAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), programmable Read Only Memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 71 may be an internal storage unit of the computer device 7, such as a hard disk or a memory of the computer device 7. In other embodiments, the memory 71 may also be an external storage device of the computer device 7, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the computer device 7. Of course, the memory 71 may also comprise both an internal memory unit of the computer device 7 and an external memory device. In the present embodiment, the memory 71 is typically used to store an operating system installed on the computer device 7 and various types of application software, such as program codes of a synchronization method of configuration files, and the like. In addition, the memory 71 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 72 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 72 is typically used to control the overall operation of the computer device 7. In this embodiment, the processor 72 is configured to execute the program code stored in the memory 71 or process data, for example, the program code for executing the above-described synchronization method of the configuration file, so as to implement various embodiments of the synchronization method of the configuration file.
The network interface 73 may comprise a wireless network interface or a wired network interface, which network interface 73 is typically used to establish a communication connection between the computer device 7 and other electronic devices.
The present application also provides another embodiment, namely, a computer readable storage medium, where a computer program is stored, where the computer program is executable by at least one processor, so that the at least one processor performs the steps of a method for synchronizing configuration files as described above.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method of the embodiments of the present application.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
It is apparent that the embodiments described above are only some embodiments of the present application, but not all embodiments, the preferred embodiments of the present application are given in the drawings, but not limiting the patent scope of the present application. This application may be embodied in many different forms, but rather, embodiments are provided in order to provide a more thorough understanding of the present disclosure. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that modifications may be made to the embodiments described in the foregoing, or equivalents may be substituted for elements thereof. All equivalent structures made by the specification and the drawings of the application are directly or indirectly applied to other related technical fields, and are also within the protection scope of the application.

Claims (7)

1. A method for synchronizing configuration files, comprising:
acquiring a configuration file modification request, modifying a configuration file corresponding to the configuration file modification request based on the configuration file modification request to obtain a modified configuration file, and storing the modified configuration file in a remote GitLab warehouse, wherein the modified configuration file comprises a modification identifier;
pulling a configuration file from the remote GitLab warehouse at regular time through a timing task, and storing the configuration file in a local Git warehouse;
polling a remote application at regular time, judging whether the remote application has an application capacity expansion condition, and obtaining a judging result;
if the judging result is that the remote application has the application capacity expansion condition, acquiring a client request parameter;
based on the client request parameters, acquiring configuration files corresponding to the client request parameters as configuration files to be synchronized;
in the local Git warehouse, if the configuration file is judged to be changed, the changed configuration file is used as the configuration file to be synchronized, and mark information corresponding to the configuration file to be synchronized is obtained, wherein the mark information comprises a module to which the file belongs, an environment to which the file belongs and an application to which the file belongs;
The flag information is packaged, a query request is generated, and the configuration management database is queried through the query request, so that an IP address list returned by the configuration management database is obtained;
synchronizing the configuration file to the IP address list through a preset backup tool;
if it is determined that the configuration file has been changed, the local Git repository uses the changed configuration file as a configuration file to be synchronized, and obtains flag information corresponding to the configuration file to be synchronized, including:
judging whether the configuration file comprises a change identifier or not in the local Git warehouse in a traversing way;
if the configuration file comprises the change identification, judging that the configuration file is changed, and acquiring the changed configuration file as the configuration file to be synchronized;
acquiring an absolute path corresponding to the configuration file to be synchronized as a target absolute path;
identifying a separator in the target absolute path through a preset segmentation command;
and cutting the target absolute path based on the separator to obtain the mark information of the configuration file.
2. The method for synchronizing configuration files according to claim 1, wherein the obtaining a modification configuration file request, modifying a configuration file corresponding to the modification configuration file request based on the modification configuration file request, obtaining a modified configuration file, and storing the modified configuration file in a remote GitLab repository, includes:
acquiring the modification profile request, and analyzing the modification profile request to acquire a profile and modification requirements corresponding to the modification profile request;
modifying the configuration file corresponding to the modification configuration file request based on the modification requirement to obtain the modified configuration file;
and executing a preset push command, and transmitting the modified configuration file from a client local Git warehouse to the remote GitLab warehouse.
3. The method for synchronizing configuration files according to claim 1, wherein the obtaining a modification configuration file request, modifying a configuration file corresponding to the modification configuration file request based on the modification configuration file request, obtaining a modified configuration file, and before storing the modified configuration file in a remote GitLab repository, the method further comprises:
Acquiring a new configuration file request, and analyzing the new configuration file request to acquire a file path corresponding to the new configuration file request;
based on the file path, acquiring a configuration file corresponding to the newly added configuration file request as a newly added configuration file, wherein the newly added configuration file comprises a change identifier;
and executing a preset push command, and transmitting the newly added configuration file from a client local Git warehouse to the remote GitLab warehouse.
4. A method for synchronizing configuration files according to any one of claims 1 to 3, wherein said encapsulating the flag information, generating a query request, and querying a configuration management database through the query request to obtain a list of IP addresses returned by the configuration management database includes:
encapsulating the mark information to generate the query request;
the query request is sent to the configuration management database for query, and the IP address of each configuration file to be synchronized is obtained;
and combining the IP addresses of each configuration file to be synchronized to obtain the IP address list.
5. A synchronization device for a configuration file, comprising:
The configuration file storage module is used for acquiring a configuration file modification request, modifying a configuration file corresponding to the configuration file modification request based on the configuration file modification request to obtain a modified configuration file, and storing the modified configuration file in a remote GitLab warehouse, wherein the modified configuration file comprises a modification identifier;
the configuration file pulling module is used for pulling the configuration file from the remote GitLab warehouse at regular time through a timing task and storing the configuration file in the local Git warehouse;
the capacity expansion condition judging module is used for polling the remote application at regular time and judging whether the remote application has an application capacity expansion condition or not so as to obtain a judging result;
the client request parameter acquisition module is used for acquiring client request parameters if the judging result shows that the remote application has the application capacity expansion condition;
the client request parameter processing module is used for acquiring a configuration file corresponding to the client request parameter based on the client request parameter as a configuration file to be synchronized;
the mark information acquisition module is used for taking the changed configuration file as the configuration file to be synchronized and acquiring mark information corresponding to the configuration file to be synchronized if the configuration file is judged to be changed in the local Git warehouse, wherein the mark information comprises a module to which the file belongs, an environment to which the file belongs and an application to which the file belongs;
The address list acquisition module is used for packaging the mark information, generating a query request, and querying the configuration management database through the query request to acquire an IP address list returned by the configuration management database;
the configuration file synchronization module is used for synchronizing the configuration file into the IP address list through a preset backup tool;
wherein, the sign information acquisition module includes:
the modification mark judging unit is used for judging whether the configuration file comprises a modification mark or not in the local Git warehouse in a traversing mode;
the to-be-synchronized configuration file determining unit is used for determining that the configuration file is changed if the configuration file comprises the change identifier, and acquiring the changed configuration file as the to-be-synchronized configuration file;
a target absolute path obtaining subunit, configured to obtain an absolute path corresponding to the configuration file to be synchronized as a target absolute path;
a separator identification subunit, configured to identify, through a preset segmentation command, a separator in the target absolute path;
and the target absolute path segmentation subunit is used for segmenting the target absolute path based on the separator to obtain the mark information of the configuration file.
6. A computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the method of synchronizing profiles according to any one of claims 1 to 4 when the computer program is executed.
7. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements a method of synchronizing configuration files according to any of claims 1 to 4.
CN202210037252.6A 2022-01-13 2022-01-13 Configuration file synchronization method and device, computer equipment and storage medium Active CN114385759B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210037252.6A CN114385759B (en) 2022-01-13 2022-01-13 Configuration file synchronization method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210037252.6A CN114385759B (en) 2022-01-13 2022-01-13 Configuration file synchronization method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114385759A CN114385759A (en) 2022-04-22
CN114385759B true CN114385759B (en) 2024-04-16

Family

ID=81201150

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210037252.6A Active CN114385759B (en) 2022-01-13 2022-01-13 Configuration file synchronization method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114385759B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115499487B (en) * 2022-09-14 2024-04-02 平安壹钱包电子商务有限公司 Updating method and device of server configuration file, storage medium and equipment
CN116192878B (en) * 2023-04-27 2023-07-18 北京微吼时代科技有限公司 Git-based configuration synchronization method and system
CN116401319B (en) * 2023-06-09 2023-09-12 建信金融科技有限责任公司 Data synchronization method and device, electronic equipment and computer readable storage medium
CN116680012B (en) * 2023-08-01 2023-10-24 浙江春风动力股份有限公司 Industrial software configuration management system and method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111666081A (en) * 2020-04-30 2020-09-15 平安科技(深圳)有限公司 Project version release method, device, equipment and medium based on Git
WO2020233373A1 (en) * 2019-05-21 2020-11-26 深圳壹账通智能科技有限公司 Application configuration file management method and device
CN112379948A (en) * 2020-12-02 2021-02-19 腾讯科技(深圳)有限公司 Program configuration management method and device, storage medium and electronic equipment
CN112732265A (en) * 2019-10-29 2021-04-30 腾讯科技(深圳)有限公司 Data processing method and related device
CN113312072A (en) * 2021-06-11 2021-08-27 北京百度网讯科技有限公司 Configuration file updating method and device, electronic equipment and medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020233373A1 (en) * 2019-05-21 2020-11-26 深圳壹账通智能科技有限公司 Application configuration file management method and device
CN112732265A (en) * 2019-10-29 2021-04-30 腾讯科技(深圳)有限公司 Data processing method and related device
CN111666081A (en) * 2020-04-30 2020-09-15 平安科技(深圳)有限公司 Project version release method, device, equipment and medium based on Git
CN112379948A (en) * 2020-12-02 2021-02-19 腾讯科技(深圳)有限公司 Program configuration management method and device, storage medium and electronic equipment
CN113312072A (en) * 2021-06-11 2021-08-27 北京百度网讯科技有限公司 Configuration file updating method and device, electronic equipment and medium

Also Published As

Publication number Publication date
CN114385759A (en) 2022-04-22

Similar Documents

Publication Publication Date Title
CN114385759B (en) Configuration file synchronization method and device, computer equipment and storage medium
US10127057B2 (en) Method and apparatus for dynamically implementing application function
CN110569311B (en) Data synchronization method and device for database and computer storage medium
CN107220142B (en) Method and device for executing data recovery operation
CN108874558B (en) Message subscription method of distributed transaction, electronic device and readable storage medium
WO2021072861A1 (en) Application service processing method and apparatus, and terminal and storage medium
CN111694592A (en) Management method and system for project version release
US9548891B2 (en) Configuration of network devices
CN110737719B (en) Data synchronization method, device, equipment and computer readable storage medium
CN111597388B (en) Sample collection method, device, equipment and medium based on distributed system
CN111225064A (en) Ceph cluster deployment method, system, device and computer-readable storage medium
CN112486629A (en) Micro-service state detection method and device, electronic equipment and storage medium
CN111654522B (en) File synchronization method, file synchronization server and storage medium
CN105704296B (en) Application environment cloning method and device
CN113434254B (en) Client deployment method, client deployment apparatus, computer device, and storage medium
CN112860662B (en) Automatic production data blood relationship establishment method, device, computer equipment and storage medium
CN112269588A (en) Algorithm upgrading method, device, terminal and computer readable storage medium
CN107908629B (en) Information query method, terminal and equipment
CN115455020A (en) Incremental data synchronization method and device, computer equipment and storage medium
CN114143308A (en) File uploading information processing method and device, computer equipment and storage medium
CN112231408B (en) Data integration method and device, electronic equipment and storage medium
CN114968822A (en) Interface testing method and device, computer equipment and storage medium
CN113286014A (en) Dynamic configuration method and device of basic domain name and related equipment
CN112559131A (en) Method, device and equipment for updating container mirror image and computer readable storage medium
CN108595924B (en) Business authority management method and device, computer equipment and storage 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