Configuration file management method and device, equipment and medium
By managing configuration files in the cloud service and utilizing the collaborative work of the first server and node daemons, the problem of service configuration files being unable to adapt to cluster changes is solved and the stability and consistency of service operation are achieved.
Patent Information
- Application Number
- CN202410674777.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-27
AI Technical Summary
In cloud services, the service configuration file management method cannot adapt to regional or cluster size adjustments, resulting in reduced service operation stability.
By storing the configuration file storage request on the first server when receiving it, managing the configuration file based on the stored information and metadata information (including cluster identification, component identification, and version identification), and starting the node daemon process for update and synchronization. , ensure the consistency and adaptability of configuration files across clusters.
It realizes the automatic management and update of service configuration files, improves the file management effect, avoids service operation errors caused by cluster differences, and ensures the stability of the service.
Smart Images

Figure CN118550604A
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a configuration file management method, device, equipment and medium. Background Art
[0002] In cloud services, in order to meet user service needs, services are frequently updated. At this time, service configuration files need to be managed to ensure the normal operation of the service through configuration files. Currently, there are usually two ways to manage configuration files: one is to classify and store service configuration files according to service names and file versions; the other is to use automated operation and maintenance tools to synchronize service configuration files between physical nodes.
[0003] When implementing the technical solution based on the above method, the inventor found the following problems:
[0004] Regardless of whether you manage service configuration files by service name, file version, or using automated operation and maintenance tools, when the service region or cluster size is adjusted, the service configuration files may not be compatible with the adjusted region or cluster due to differences between regions or clusters, resulting in reduced service operation stability. Summary of the invention
[0005] The present invention provides a configuration file management method, device, equipment and medium to improve the file management effect and achieve the technical effect of ensuring the stability of service operation.
[0006] In a first aspect, an embodiment of the present invention provides a configuration file management method, the method comprising:
[0007] When receiving a configuration file storage request, storing the acquired configuration file in the first server, and feeding back the stored information based on the first server;
[0008] Receiving the stored information, and storing the stored information and metadata information of the configuration file in a database for management;
[0009] The metadata information includes at least one of an identifier of a cluster to which the configuration file belongs, an identifier of a component to which the configuration file belongs, and an identifier of a configuration file version.
[0010] Furthermore, the method is applied in a distributed system, and the distributed system includes at least one physical node, and the physical node corresponds to a node daemon process.
[0011] Furthermore, the method further comprises:
[0012] Upon receiving a file processing request for updating a configuration file, starting a node daemon process corresponding to each physical node; and,
[0013] Determining metadata information carried by the file processing request;
[0014] The metadata information is processed based on the node daemon process to update a configuration file.
[0015] Furthermore, the method further comprises:
[0016] Based on the node daemon process, query whether the corresponding physical node includes a target configuration file corresponding to the metadata information;
[0017] If the target configuration file does not exist, obtaining the target configuration file from the first server based on the stored information in the metadata information;
[0018] The configuration file of the physical node is updated based on the acquired target configuration file.
[0019] Furthermore, the method further comprises:
[0020] Determine the first verification information of the acquired target configuration file, and obtain the second verification information of the pre-stored target configuration file;
[0021] When the first verification information and the second verification information are the same, the configuration file of the physical node is updated according to the target configuration file.
[0022] Furthermore, the method further comprises:
[0023] Based on the node daemon process corresponding to each physical node, the heartbeat and file information of the used configuration file are reported regularly;
[0024] The service status of the physical node is determined based on the received heartbeat, and the version information of the configuration file used by the physical node is determined based on the file information.
[0025] Furthermore, the method further comprises:
[0026] If the heartbeat reported by the node daemon is not received within the preset time, the faulty physical node is determined and the fault tolerance mechanism is triggered;
[0027] Based on the fault-tolerant mechanism, the node daemon process corresponding to the failed physical node is associated with the new physical node, so that the node daemon process processes the business corresponding to the new physical node.
[0028] In a second aspect, an embodiment of the present invention further provides a configuration file management device, the device comprising:
[0029] A storage module, configured to store the acquired configuration file in the first server upon receiving a configuration file storage request, and to feed back the stored information based on the first server;
[0030] A management module, used for receiving the stored information, and storing the stored information and metadata information of the configuration file in a database for management;
[0031] The metadata information includes at least one of an identifier of a cluster to which the configuration file belongs, an identifier of a component to which the configuration file belongs, and an identifier of a configuration file version.
[0032] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0033] one or more processors;
[0034] a storage device for storing one or more programs,
[0035] When one or more programs are executed by one or more processors, the one or more processors implement a configuration file management method as described in any one of the embodiments of the present invention.
[0036] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute a configuration file management method as described in any one of the embodiments of the present invention.
[0037] The technical solution of the embodiment of the present invention is to store the acquired configuration file to the first server when receiving a configuration file storage request, and to feedback the stored information based on the first server; receive the stored information, and store the stored information and the metadata information of the configuration file in the database for management; the metadata information includes at least one of the cluster identifier, the component identifier, and the configuration file version identifier of the configuration file. The technical solution of the embodiment of the present invention solves the technical problem that the service configuration file is managed according to the service name, file version, or using an automated operation and maintenance tool in the prior art, resulting in poor service operation stability, and realizes that when receiving a configuration file storage request, the acquired configuration file is stored to the first server, so that the first server feedbacks the stored information, and the automatic upload of the file is realized. Furthermore, the stored information fed back by the first server and the metadata information such as the cluster identifier, the component identifier, and the configuration file version identifier of the configuration file are stored in the database for management, so as to realize the management of service configuration files of different clusters and different versions, improve the file management effect, and when the cluster changes later, the configuration file of the service can also adapt to the cluster, avoiding the problem of service operation errors caused by cluster differences, and achieving the technical effect of ensuring the stability of service operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required to describe the embodiments. Obviously, the drawings introduced are only drawings of a part of the embodiments to be described in the present invention, rather than all the drawings. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0039] Figure 1 A flowchart of a configuration file management method provided by an embodiment of the present invention;
[0040] Figure 2 A schematic diagram of a configuration file management method provided by an embodiment of the present invention;
[0041] Figure 3 A schematic diagram of a flow chart of a configuration file management method provided by an embodiment of the present invention;
[0042] Figure 4 A schematic diagram of a configuration file management method provided by an embodiment of the present invention;
[0043] Figure 5 A schematic diagram of a configuration file updating method provided by an embodiment of the present invention;
[0044] Figure 6 A schematic diagram of a flow chart of a configuration file management method provided by an embodiment of the present invention;
[0045] Figure 7 A schematic diagram of a configuration file management method provided by an embodiment of the present invention;
[0046] Figure 8 A schematic diagram of the structure of a configuration file management device provided by an embodiment of the present invention;
[0047] Fig. 9 The present invention is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0049] Before introducing the technical solution, the application scenario can be explained first. The technical solution provided by the embodiment of the present invention can be applied to a variety of application scenarios for managing configuration files. For example, in a cloud service scenario, each service under the cloud service may be assigned to physical nodes in different regions and clusters for operation. Due to the differences between different regions and clusters, the configuration files of the same service in different regions and clusters are also different. It is necessary to manage different versions of configuration files adapted to services in different regions and clusters, so as to accurately and effectively update the service through the managed configuration files and ensure that the service can run normally. Configuration file management can be implemented based on the technical solution provided in this embodiment.
[0050] Figure 1 The present invention provides a flow chart of a configuration file management method. The present invention is applicable to the case of managing configuration files. The method can be executed by a configuration file management device, which can be implemented in the form of software and / or hardware. Figure 1 As shown, the method specifically comprises the following steps:
[0051] S110. When a configuration file storage request is received, the acquired configuration file is stored in the first server, and stored information is fed back based on the first server.
[0052] Among them, the configuration file can be a file used to configure service parameters. For example, the configuration file contains parameters such as server configuration (such as IP, port, reverse proxy, etc.), database configuration (such as database connection parameters, data storage path, user permissions, etc.), and service operating environment. The service can be a cloud service. For example, the service can include but is not limited to storage services with data storage and management functions, network services that can provide data transmission and communication capabilities, data processing services with data analysis and processing functions, and resource services that can provide computing, memory, database, etc. It should be noted that the format and content of the configuration files of different services are different depending on the type, function, environment, deployment area, affiliated cluster, etc. of the service, and the format and content of the configuration files of the same service may also be different. The first server can be S3 (cloud storage service) or FTP Server (File Transfer Protocol Server).
[0053] In this embodiment, when a command line code for requesting configuration file storage is received, it can be considered that a configuration file storage request has been received; or, when an uploaded configuration file is received, it can be considered that a storage request for the configuration file has been received. Furthermore, the configuration file corresponding to the storage request can be stored in the first server. For example, the configuration file is obtained through the storage path of the configuration file in the command line code, and then the configuration file is uploaded to the first server. The first server can automatically classify and store the configuration files. For example, the first server generates a version number of the configuration file based on the name of the service to which the configuration file belongs, the upload time point and other information, and classifies and stores the configuration file through the version number. Furthermore, the first server feeds back the stored information so that the system can learn about the storage status through the stored information.
[0054] For example, see Figure 2 , you can use the configuration management tool (such as monitor-cli) to initiate a configuration file storage request and upload the configuration file to the first server (such as S3 or FTP Server). After the configuration file is successfully stored on the first server, a result containing the successful storage is returned.
[0055] S120: Receive stored information, and store the stored information and metadata information of the configuration file into a database for management.
[0056] It should be noted that the configuration file management method provided in the embodiment of the present invention can be implemented by a file management system, and the file management system can be integrated into an existing service. For example, in a cloud service, a file management system can be deployed in each cluster, and the configuration files of all services under the cluster can be managed by the file management system based on the cluster dimension. When managing the configuration file, it can be achieved by managing the metadata information of the configuration file. The metadata information includes at least one of the cluster identifier to which the configuration file belongs, the component identifier to which it belongs, and the configuration file version identifier. The component identifier can be used to identify the uniqueness of the service.
[0057] In this embodiment, when the stored information is received, the stored information can be parsed. If the stored information contains a result of successful storage, the stored information and metadata information of the configuration file can be stored in the database for management. It should be noted that in order to ensure that the required configuration file can be accurately obtained from the corresponding location in the first server later, the stored information can also include the file storage address of the configuration file in the first server. In this way, the metadata information and the file storage address of the configuration file can be stored correspondingly, which is convenient for obtaining the configuration file.
[0058] For example, see Figure 2After uploading the file storage address of the configuration file to the file management system, the file management system can also use the file storage address as the metadata information of the configuration file. The metadata information includes the cluster identifier to which the configuration file belongs, the component identifier to which it belongs, the configuration file version identifier, the description of the configuration file, the file storage address, etc.
[0059] The technical solution of the embodiment of the present invention is to store the acquired configuration file to the first server when receiving a configuration file storage request, and to feedback the stored information based on the first server; receive the stored information, and store the stored information and the metadata information of the configuration file in the database for management; the metadata information includes at least one of the cluster identifier, the component identifier, and the configuration file version identifier of the configuration file. The technical solution of the embodiment of the present invention solves the technical problem that the service configuration file is managed according to the service name, file version, or using an automated operation and maintenance tool in the prior art, resulting in poor stability of the service operation using the configuration file, and realizes that when receiving a configuration file storage request, the acquired configuration file is stored to the first server, so that the first server feedbacks the stored information, and the automatic upload of the file is realized. Furthermore, the stored information fed back by the first server and the metadata information such as the cluster identifier, the component identifier, and the configuration file version identifier of the configuration file are stored in the database for management, so as to realize the management of service configuration files of different clusters and different versions, improve the file management effect, and when the cluster changes later, the configuration file of the service can also adapt to the cluster, avoiding the problem of service operation errors caused by cluster differences, and achieving the technical effect of ensuring the stability of service operation.
[0060] Figure 3 A flowchart of a configuration file management method provided by an embodiment of the present invention, based on the above-mentioned embodiment, can also start the node daemon process corresponding to each physical node when receiving a file processing request for configuration file update; and determine the metadata information carried by the file processing request; and then, process the metadata information based on the node daemon process to update the configuration file, and its specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.
[0061] like Figure 3 As shown, the method specifically comprises the following steps:
[0062] S210. When receiving a file processing request for updating a configuration file, start a node daemon process corresponding to each physical node; and determine metadata information carried by the file processing request.
[0063] It should be noted that the configuration file management method provided in the embodiment of the present invention can be applied in a distributed system, and the distributed system includes at least one physical node, and the physical node corresponds to the node daemon process. For example, see Figure 4 . Among them, a physical node may refer to one or more computer nodes in a distributed system, and these nodes may be one or more servers. The same services may be deployed on each physical node, and these same services may be used to jointly provide a service capability to the outside world. A node daemon may refer to a computer program running on a physical node, running as a background process. For example, the node daemon A of physical node 1 may manage the resources and tasks on the node, and may also enable node 1 to communicate and collaborate with other nodes through the node daemon.
[0064] In this embodiment, when a command line code for requesting to update a configuration file is received, it can be considered that a file processing request for updating a configuration file is received; or, when a new configuration file is detected to be uploaded, it can be considered that a file processing request for updating a configuration file is received. The configuration file requested to be updated can be for a newly added service or for an existing service. The node daemon corresponding to each physical node in the distributed system is started, and the file processing request is parsed to obtain the metadata information carried by the file processing request, so as to update the configuration file according to the metadata information through the node daemon.
[0065] For example, see Figure 5 ,When a new service is added or the configuration file of an existing service is changed, a task to update the configuration file is created through the ,configuration management tool, and a configuration file update request is sent to the file ,management system. The file management system notifies the node daemon of the physical node to execute the ,configuration file update task.
[0066] S220: Process the metadata information based on the node daemon process to update the configuration file.
[0067] In this embodiment, the configuration file can be updated by the node daemon process according to the metadata information carried by the file processing request. Specifically, the metadata information is processed based on the node daemon process to update the configuration file, including: querying whether the corresponding physical node includes a target configuration file corresponding to the metadata information based on the node daemon process; if the target configuration file does not exist, obtaining the target configuration file from the first server based on the stored information in the metadata information; and updating the configuration file of the physical node based on the obtained target configuration file.
[0068] In actual applications, the node daemon process can be used to query whether there is a target configuration file corresponding to the metadata information in the local physical node where the node is located. If it exists, the target configuration file can be used. If it does not exist, the target configuration file is obtained from the corresponding position in the first server through the file storage address in the metadata information. Furthermore, the configuration file of the physical node can be updated by the obtained target configuration file. For example, the target configuration file replaces the original configuration file of the physical node and deletes the original configuration file. The technical solution provided in this embodiment queries the target configuration file by querying metadata information through the node daemon process, thereby improving the convenience of the query; at the same time, when the target configuration file does not exist locally in the node, the target configuration file is automatically pulled from the first server through the managed file storage address, so as to realize the automatic update of the configuration file and improve the configuration file update efficiency, thereby ensuring the stability of the node service operation.
[0069] For example, see Figure 5 The node daemon process queries whether the target configuration file exists locally on the node, and uses it if it exists. When the target configuration file does not exist locally, the target configuration file is pulled from the first server, so that the first server returns the target configuration file.
[0070] In order to improve the security and correctness of the configuration file, when the stored information and the metadata information of the configuration file are stored in the database for management, the second verification information of the configuration file can be generated by using the verification code generation technology, and the second verification information is stored in the database as the metadata information of the configuration file. When the file is modified or damaged during the transmission or storage process, the second verification information will change, so that the configuration file can be verified to be correct through the second verification information in the future, so as to ensure the integrity of the file. Optionally, the verification code generation technology can be MD5 (Message Digest Algorithm 5), parity check code and cyclic redundancy check (CRC), etc. For example, the MD5 value of the configuration file is generated as the second verification information.
[0071] Based on the above technical solution, before updating the configuration file of the physical node based on the acquired target configuration file, the first verification information of the acquired target configuration file can be determined, and the second verification information of the pre-stored target configuration file can be obtained; when the first verification information and the second verification information are the same, the configuration file of the physical node is updated according to the target configuration file.
[0072] Specifically, when the target configuration file is obtained, the check value of the target configuration file can be calculated as the first check information. The second check information corresponding to the target configuration file that is pre-stored is obtained. Then, the first check information and the second check information can be compared. If the two are the same, it can be considered that the file correctness check has passed. Alternatively, the first check information and the second check information can be processed using a preset logic to obtain a logical value. If the logical value is within a preset range, it is considered that the file correctness check has passed. Alternatively, the first check information and the second check information are logically processed respectively to obtain two logical values. If the two logical values meet the preset conditions, it is considered that the file correctness check has passed. The configuration file of the physical node can be updated through the target configuration file under the condition that the file correctness check has passed. The advantage of this setting is that before updating the configuration file of the physical node based on the target configuration file, the target configuration file is checked for correctness, the integrity of the file can be verified, and the target configuration file used for the update can be ensured to be correct, thereby ensuring the security and stability of the service operation.
[0073] Exemplarily, the node daemon calculates the MD5 value of the target configuration file and compares it with the MD5 value in the metadata information recorded by the file management system. After the comparison is passed, the node daemon performs variable value rendering processing on the target configuration file according to the configuration information issued by the file management system, such as IP address, database, password and other configuration information, and starts the service after the variable value rendering. The advantage of variable value rendering is that the same target configuration file can be used in different system environments. It only needs to update the configuration information corresponding to the corresponding system to the target configuration file. There is no need to manually distinguish the configurations of different system environments, and the target configuration file can be used to start the service in the corresponding system environment.
[0074] The technical solution of the embodiment of the present invention starts the node daemon process corresponding to each physical node when receiving a file processing request for updating the configuration file, determines the metadata information carried by the file processing request, and then processes the metadata information through the node daemon process to update the configuration file, thereby realizing the automatic update of the configuration file and improving the configuration file update efficiency. At the same time, the configuration file of the running service can also be managed to ensure the stability of the service operation.
[0075] Figure 6A flow chart of a configuration file management method provided by an embodiment of the present invention, based on the above-mentioned embodiment, can also be based on the node daemon process corresponding to each physical node regularly reporting the heartbeat and the file information of the configuration file used, and then, based on the received heartbeat, determine the service status of the physical node and based on the file information, determine the version information of the configuration file used by the physical node, and its specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above-mentioned embodiment are not repeated here.
[0076] like Figure 6 As shown, the method includes:
[0077] S310, regularly reporting heartbeats and file information of the used configuration files based on the node daemon process corresponding to each physical node.
[0078] The reported heartbeat can be used to indicate whether the current state of the node is normal, so as to report its own running state to the system through the heartbeat. The file information can refer to the metadata information of the managed configuration file.
[0079] In this embodiment, each time the configuration file of the physical node is updated, the node daemon of the physical node can report the heartbeat and the file information of the configuration file; or the node daemon corresponding to the physical node can report the heartbeat signal and the file information of the used configuration file regularly through a scheduled task. The service status and configuration information of the physical node can be monitored in a timely manner through the regularly reported information.
[0080] For example, see Figure 5 , the node daemon process regularly reports the heartbeat and file information of the configuration file to the file management system, so that the configuration management tool can query the service status based on the heartbeat and determine the version information of the configuration file through the configuration information.
[0081] S320: Determine the service status of the physical node based on the received heartbeat, and determine the version information of the configuration file used by the physical node based on the file information.
[0082] The service status may be used to characterize the running status of the service. For example, the service status may be normal, faulty, running, waiting to run, idle, or the like.
[0083] In this embodiment, the service status of the physical node can be determined through the received heartbeat. For example, if the heartbeat reported by the physical node is received, the service status of the physical node is considered to be normal; or, the heartbeat can also contain service information in the node, such as service status, resource usage, abnormal log, etc. In this way, the service status of the physical node can be queried by parsing the received heartbeat. The version information of the configuration file used by the physical node can also be queried through the received file information, so as to understand the status of the service under the corresponding version information.
[0084] In this embodiment, if the heartbeat reported by the node daemon process is not received within the preset time, the faulty physical node is determined and the fault tolerance mechanism is triggered; based on the fault tolerance mechanism, the node daemon process corresponding to the faulty physical node is associated with the new physical node so that the node daemon process can process the business corresponding to the new physical node.
[0085] Among them, the fault tolerance mechanism may refer to a mechanism that can automatically restore the service status in the node when the node faces a failure, anomaly or error, so as to ensure that the service can continue to run normally on the corresponding node.
[0086] Specifically, when it is detected that the heartbeat reported by the node daemon process is not received within the preset time, it is considered that the physical node may be abnormal, such as downtime or failure. At this time, the physical node can be used as a faulty physical node to trigger the fault tolerance mechanism. Alternatively, when it is detected that the heartbeat reported by the node daemon process is not received within the preset time, a network diagnosis request can be further sent to the physical node. If the physical node does not respond, the physical node is used as a faulty physical node, and the fault tolerance mechanism is automatically triggered at this time. Optionally, the fault tolerance mechanism may include a node switching strategy. For example, when a physical node fails or is abnormal, the faulty physical node is automatically removed from the service list, and the node service is switched to other normally running nodes, and the node daemon process corresponding to the faulty physical node is associated with the new physical node, so that the node daemon process processes the business corresponding to the new physical node. The advantage of this setting is that the service status can be detected through the heartbeat, and the fault can be discovered in time. The fault tolerance mechanism can effectively reduce the service downtime, restore the service status, and ensure the stability and availability of the service operation.
[0087] For example, see Figure 7, when the node daemon of physical node 2 where the existing service is located does not report a heartbeat within a certain period of time, and the file management system fails to respond to the ping request, the service failover is triggered. Failover is a fault-tolerant mechanism. The file management system selects a new physical node 1 to run the service according to a certain strategy, and notifies the node daemon of physical node 1 to start the service, automatically switching the service to run on physical node 1, and then performs a series of operations such as configuration file pulling, correctness verification, configuration file rendering, service startup and heartbeat reporting through the node daemon of physical node 1.
[0088] The technical solution of the embodiment of the present invention is to detect the service status of the physical node according to the received heartbeat by the node daemon process corresponding to each physical node and the file information of the configuration file used, so as to timely discover and handle the faulty physical node, ensure the normal operation of the entire service, and improve the reliability and stability of the service operation. At the same time, the version information of the configuration file used by the physical node can also be determined based on the file information, so as to facilitate the subsequent service operation and maintenance through the version information.
[0089] The following is an embodiment of a configuration file management device provided in an embodiment of the present invention. The device and the configuration file management method of the above embodiment belong to the same inventive concept. For details not described in detail in the embodiment of the configuration file management device, reference can be made to the contents of the above embodiments.
[0090] Figure 8 This is a schematic diagram of the structure of a configuration file management device provided by an embodiment of the present invention. The device includes: a storage module 410 and a management module 420.
[0091] Among them, the storage module 410 is used to store the acquired configuration file to the first server when receiving a configuration file storage request, and to feedback the stored information based on the first server; the management module 420 is used to receive the stored information, and store the stored information and metadata information of the configuration file in a database for management; wherein the metadata information includes at least one of the cluster identifier to which the configuration file belongs, the component identifier to which it belongs, and the configuration file version identifier.
[0092] On the basis of the above-mentioned device, optionally, the device is configured in a distributed system, and the distributed system includes at least one physical node, and the physical node corresponds to a node daemon process.
[0093] Based on the above device, optionally, the device further includes: a request receiving module and an information processing module.
[0094] A request receiving module is used to start the node daemon corresponding to each physical node when receiving a file processing request for updating the configuration file; and to determine the metadata information carried by the file processing request; an information processing module is used to process the metadata information based on the node daemon to update the configuration file.
[0095] Based on the above device, optionally, the information processing module includes a query unit, a file acquisition unit and a file update unit.
[0096] A query unit, used to query whether the corresponding physical node includes a target configuration file corresponding to the metadata information based on the node daemon process; a file acquisition unit, used to acquire the target configuration file from the first server based on the stored information in the metadata information if the target configuration file does not exist; and a file update unit, used to update the configuration file of the physical node based on the acquired target configuration file.
[0097] On the basis of the above device, optionally, the device further includes: a verification information determination unit and a comparison unit.
[0098] A verification information determination unit is used to determine the first verification information of the target configuration file obtained, and to obtain the second verification information of the target configuration file stored in advance; a comparison unit is used to update the configuration file of the physical node according to the target configuration file when the first verification information and the second verification information are the same.
[0099] Based on the above device, optionally, the device further includes: a timing module and a version information determination module.
[0100] A timing module is used to periodically report heartbeats and file information of the configuration files used based on the node daemon process corresponding to each physical node; a version information determination module is used to determine the service status of the physical node based on the received heartbeat, and determine the version information of the configuration file used by the physical node based on the file information.
[0101] On the basis of the above device, optionally, the device further includes: a faulty physical node determination module and an association module.
[0102] A faulty physical node determination module is used to determine the faulty physical node and trigger the fault tolerance mechanism if no heartbeat reported by the node daemon is received within a preset time period; an association module is used to associate the node daemon corresponding to the faulty physical node with the new physical node based on the fault tolerance mechanism, so that the node daemon processes the business corresponding to the new physical node.
[0103] The technical solution of the embodiment of the present invention is to store the acquired configuration file to the first server when receiving a configuration file storage request, and to feedback the stored information based on the first server; receive the stored information, and store the stored information and the metadata information of the configuration file in the database for management; the metadata information includes at least one of the cluster identifier, the component identifier, and the configuration file version identifier of the configuration file. The technical solution of the embodiment of the present invention solves the technical problem that the service configuration file is managed according to the service name, file version, or using an automated operation and maintenance tool in the prior art, resulting in poor stability of the service operation using the configuration file, and realizes that when receiving a configuration file storage request, the acquired configuration file is stored to the first server, so that the first server feedbacks the stored information, and the automatic upload of the file is realized. Furthermore, the stored information fed back by the first server and the metadata information such as the cluster identifier, the component identifier, and the configuration file version identifier of the configuration file are stored in the database for management, so as to realize the management of service configuration files of different clusters and different versions, improve the file management effect, and when the cluster changes later, the configuration file of the service can also adapt to the cluster, avoiding the problem of service operation errors caused by cluster differences, and achieving the technical effect of ensuring the stability of service operation.
[0104] The configuration file management device provided in the embodiment of the present invention can execute the configuration file management method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0105] It is worth noting that the various units and modules included in the above system are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present invention.
[0106] Fig. 9 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Fig. 9 A block diagram of an exemplary server 12 suitable for use in implementing embodiments of the present invention is shown. Fig. 9 The server 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0107] like Fig. 9 As shown, the server 12 is in the form of a general purpose computing device. The components of the server 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0108] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0109] The server 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the server 12, including volatile and non-volatile media, removable and non-removable media.
[0110] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The server 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Fig. 9 not shown, usually called a "hard drive"). Although Fig. 9 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0111] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0112] The server 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the server 12, and / or may communicate with any device that enables the server 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. In addition, the server 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the server 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the server 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0113] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, implementing a configuration file management method provided by the embodiment of the present invention, the method comprising:
[0114] When receiving a configuration file storage request, storing the acquired configuration file in the first server, and feeding back the stored information based on the first server;
[0115] Receiving the stored information, and storing the stored information and metadata information of the configuration file in a database for management;
[0116] The metadata information includes at least one of an identifier of a cluster to which the configuration file belongs, an identifier of a component to which the configuration file belongs, and an identifier of a configuration file version.
[0117] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the configuration file management method provided by any embodiment of the present invention.
[0118] An embodiment of the present invention further provides a storage medium containing computer executable instructions, and when the computer executable instructions are executed by a computer processor, they are used to execute a configuration file management method, the method comprising:
[0119] When receiving a configuration file storage request, storing the acquired configuration file in the first server, and feeding back the stored information based on the first server;
[0120] Receiving the stored information, and storing the stored information and metadata information of the configuration file in a database for management;
[0121] The metadata information includes at least one of an identifier of a cluster to which the configuration file belongs, an identifier of a component to which the configuration file belongs, and an identifier of a configuration file version.
[0122] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0123] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0124] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0125] Computer program code for performing the operation of embodiments of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0126] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0127] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A configuration file management method, characterized in that: include: When receiving a configuration file storage request, storing the acquired configuration file in the first server, and feeding back the stored information based on the first server; Receiving the stored information, and storing the stored information and metadata information of the configuration file in a database for management; The metadata information includes at least one of an identifier of a cluster to which the configuration file belongs, an identifier of a component to which the configuration file belongs, and an identifier of a configuration file version.
2. The method according to claim 1, characterized in that: The method is applied in a distributed system, wherein the distributed system comprises at least one physical node, and the physical node corresponds to a node daemon process.
3. The method according to claim 2, characterized in that Also includes: Upon receiving a file processing request for updating a configuration file, starting a node daemon process corresponding to each physical node; as well as, Determining metadata information carried by the file processing request; The metadata information is processed based on the node daemon process to update a configuration file.
4. The method according to claim 3, characterized in that The processing of the metadata information based on the node daemon process to update the configuration file includes: Based on the node daemon process, query whether the corresponding physical node includes a target configuration file corresponding to the metadata information; If the target configuration file does not exist, obtaining the target configuration file from the first server based on the stored information in the metadata information; The configuration file of the physical node is updated based on the acquired target configuration file.
5. The method according to claim 4, characterized in that Before updating the configuration file of the physical node based on the acquired target configuration file, the method further includes: Determine the first verification information of the acquired target configuration file, and obtain the second verification information of the pre-stored target configuration file; When the first verification information and the second verification information are the same, the configuration file of the physical node is updated according to the target configuration file.
6. The method according to claim 1, characterized in that The method further comprises: Based on the node daemon process corresponding to each physical node, the heartbeat and file information of the used configuration file are reported regularly; The service status of the physical node is determined based on the received heartbeat, and the version information of the configuration file used by the physical node is determined based on the file information.
7. The method according to claim 6, characterized in that Also includes: If the heartbeat reported by the node daemon is not received within the preset time, the faulty physical node is determined and the fault tolerance mechanism is triggered; Based on the fault-tolerant mechanism, the node daemon process corresponding to the failed physical node is associated with the new physical node, so that the node daemon process processes the business corresponding to the new physical node.
8. A configuration file management device, characterized in that: include: A storage module, configured to store the acquired configuration file in the first server upon receiving a configuration file storage request, and to feed back the stored information based on the first server; A management module, used for receiving the stored information, and storing the stored information and metadata information of the configuration file in a database for management; The metadata information includes at least one of an identifier of a cluster to which the configuration file belongs, an identifier of a component to which the configuration file belongs, and an identifier of a configuration file version.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the configuration file management method according to any one of claims 1 to 7.
10. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute the configuration file management method according to any one of claims 1 to 7 when executed by a computer processor.
