Configuration changing method and device and electronic equipment
By obtaining configuration snapshots of the device and generating differential files, the problem of restarting is solved when the device configuration changes is changed, and configuration updates are completed without restarting, ensuring the normal operation and maintenance efficiency and system stability are improved.
Patent Information
- Application Number
- CN202411110056.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-26
AI Technical Summary
The prior art requires restarting the device when changing the device configuration file, resulting in interruption of the operation of software without environmental changes, affecting normal operation.
By obtaining the current configuration snapshot of the target device and the target configuration snapshot, determine the generation strategy of the configuration difference file, generate the configuration difference file, and update the current configuration while keeping the device running normally, achieving the purpose of completing configuration changes without restarting the device .
It realizes updating configuration files without affecting the operation of the target device, ensuring that software that does not require configuration file changes can run normally, improving operation and maintenance efficiency and system stability.
Smart Images

Figure CN119025153A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a configuration change method, device and electronic device. Background Art
[0002] In software development and operation and maintenance practices, we often encounter scenarios where we need to change the configuration files of devices. Specifically, when the target software in a device needs to be changed from the development environment to the test environment, or from the test environment to the production environment, the configuration files in the device that have dependencies on the target software need to be changed to complete the change of the software environment. In addition, in certain situations, such as responding to network attacks, sudden increases in traffic, and other events, it is also necessary to temporarily adjust the device configuration to enhance security or respond to peak loads.
[0003] Currently, when changing the configuration file of a device, a method usually adopted is to replace the old configuration file A with the new configuration file B in the device. However, this method requires the device to be restarted. If the device restart time is long, the running status of each software in the device will be interrupted, thereby affecting the normal operation of the software that does not require environmental changes.
[0004] Currently, no effective solution has been proposed to solve the problem that the method of directly replacing the device configuration file in the related art requires restarting the device, thereby affecting the normal operation of the software that does not require environmental changes. Summary of the invention
[0005] The present application provides a configuration change method, apparatus and electronic device to solve the problem in the related art that the method of directly replacing the device configuration file requires restarting the device, thereby affecting the normal operation of software that does not require configuration file changes.
[0006] According to one aspect of the present application, a configuration change method is provided. The method includes: obtaining a first configuration snapshot corresponding to the current configuration of a target device, and a second configuration snapshot corresponding to the target configuration to be changed to the target device; determining a configuration generation strategy for generating a configuration difference file according to the difference between the first configuration snapshot and the second configuration snapshot; generating a configuration difference file according to the configuration generation strategy; and updating the current configuration according to the configuration difference file to obtain the target configuration while maintaining the normal operation of the target device.
[0007] Optionally, based on the difference between the first configuration snapshot and the second configuration snapshot, determining the configuration generation strategy for generating the configuration difference file includes: when the file size difference between the first configuration snapshot and the second configuration snapshot is greater than a preset difference, determining that the configuration generation strategy is the first configuration generation strategy; when the configuration generation strategy is the first configuration generation strategy, generating the configuration difference file according to the configuration generation strategy, including: generating a first configuration difference file according to the third configuration snapshot corresponding to the initial configuration of the target device, the first configuration snapshot, and the second configuration snapshot, wherein the initial configuration is used to initialize the target device.
[0008] Optionally, determining, based on the difference between the first configuration snapshot and the second configuration snapshot, a configuration generation strategy for generating a configuration difference file includes: when the file size difference between the first configuration snapshot and the second configuration snapshot is less than or equal to a preset difference, determining a difference requirement based on the third configuration snapshot, the first configuration snapshot, and the second configuration snapshot corresponding to the initial configuration of the target device, and judging whether the content difference between the first configuration snapshot and the second configuration snapshot meets the difference requirement; when the content difference does not meet the difference requirement, determining the configuration generation strategy to be the first configuration generation strategy; when the content difference meets the difference requirement, determining the configuration generation strategy to be the second configuration generation strategy; when the configuration generation strategy is the second configuration generation strategy, generating a configuration difference file according to the configuration generation strategy, including: generating a second configuration difference file according to the first configuration snapshot and the second configuration snapshot.
[0009] Optionally, calculating the file size difference between the first configuration snapshot and the second configuration snapshot includes: obtaining the file size of the first configuration snapshot to obtain a first data volume, obtaining the file size of the second configuration snapshot to obtain a second data volume; subtracting the first data volume from the second data volume to obtain a first difference, and dividing the first difference and the first data volume to obtain the file size difference.
[0010] Optionally, generating a first configuration difference file based on the third configuration snapshot, the first configuration snapshot and the second configuration snapshot corresponding to the initial configuration of the target device includes: obtaining first difference information between the first configuration snapshot and the third configuration snapshot; obtaining second difference information between the second configuration snapshot and the third configuration snapshot; combining the first difference information and the second difference information into a first configuration difference file; updating the current configuration according to the configuration difference file to obtain the target configuration, including: restoring the current configuration to the initial configuration according to the first difference information, and updating the initial configuration according to the second difference information to obtain the target configuration.
[0011] Optionally, determining the difference requirement according to the third configuration snapshot, the first configuration snapshot and the second configuration snapshot corresponding to the initial configuration of the target device, and judging whether the content difference between the first configuration snapshot and the second configuration snapshot meets the difference requirement includes: obtaining the number of difference modules between the first configuration snapshot and the third configuration snapshot to obtain the first module number, wherein the first configuration snapshot, the third configuration snapshot and the second configuration snapshot each contain a plurality of configuration data modules; obtaining the number of difference modules between the second configuration snapshot and the third configuration snapshot to obtain the second module number; obtaining the number of difference modules between the second configuration snapshot and the first configuration snapshot to obtain the third module number, and determining the third module number as the content difference; calculating the sum of the first module number and the second module number to obtain the total module number, and determining the difference requirement according to the total module number; when the third module number is greater than the total module number, determining that the content difference does not meet the difference requirement; when the third module number is less than or equal to the total module number, determining that the content difference meets the difference requirement.
[0012] Optionally, generating a second configuration difference file according to the first configuration snapshot and the second configuration snapshot includes: obtaining difference information between the first configuration snapshot and the second configuration snapshot to obtain the second configuration difference file; updating the current configuration according to the configuration difference file to obtain the target configuration includes: updating the current configuration to the target configuration according to the second configuration difference file.
[0013] Optionally, when the configuration difference file is generated by the second configuration generation strategy, the method further includes: if first feedback information sent by the target device is received, and when the first feedback information indicates that the target device fails to change from the current configuration to the target configuration, changing the configuration generation strategy from the second configuration generation strategy to the first configuration generation strategy, and executing the step of generating the configuration difference file according to the configuration generation strategy through the first configuration generation strategy; when the second feedback information is received, obtaining a configuration update log from the target device, wherein the second feedback information indicates that the change from the current configuration to the target configuration fails again; identifying abnormal log information of the abnormality in the configuration update log, and sending the abnormal log information and the second configuration difference file to the target terminal; receiving the modified second configuration difference file fed back by the target terminal, and updating the current configuration in the target device through the modified second configuration difference file to obtain the target configuration.
[0014] According to another aspect of the present application, a configuration change device is provided. The device includes: a first acquisition unit, used to acquire a first configuration snapshot corresponding to the current configuration of a target device, and a second configuration snapshot corresponding to the target configuration to be changed to the target device; a determination unit, used to determine a configuration generation strategy for generating a configuration difference file according to the difference between the first configuration snapshot and the second configuration snapshot; a generation unit, used to generate a configuration difference file according to the configuration generation strategy; and a first update unit, used to update the current configuration according to the configuration difference file to obtain the target configuration while maintaining the normal operation of the target device.
[0015] According to another aspect of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, a configuration change method provided in the aforementioned embodiment of the present application is implemented.
[0016] According to another aspect of the present invention, an electronic device is provided, comprising one or more processors and a memory; the memory stores computer-readable instructions, and the processor is used to execute the computer-readable instructions, wherein when the computer-readable instructions are executed, a configuration change method provided in the aforementioned embodiment is executed.
[0017] Through this application, the following steps are adopted: obtaining a first configuration snapshot corresponding to the current configuration of the target device, and a second configuration snapshot corresponding to the target configuration to be changed to the target device; determining a configuration generation strategy for generating a configuration difference file according to the difference between the first configuration snapshot and the second configuration snapshot; generating a configuration difference file according to the configuration generation strategy; and updating the current configuration according to the configuration difference file while maintaining the normal operation of the target device to obtain the target configuration. This solves the problem that the method of directly replacing the device configuration file in the related art requires restarting the device, thereby affecting the normal operation of the software that does not require configuration file changes. By comparing the first configuration snapshot and the second configuration snapshot, the difference between the current configuration and the target configuration is determined, and the generation strategy of the configuration difference file is determined according to the difference, thereby obtaining the configuration difference file, and then the current configuration is updated in the device according to the configuration difference file, thereby achieving the technical effect that the current configuration can be updated without shutting down the target device, and ensuring that some software in the target device that is not affected by the update operation can operate normally. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] Figure 1 is a flowchart of a configuration change method provided according to an embodiment of the present application;
[0020] Figure 2 is a flowchart of an optional configuration change method provided according to an embodiment of the present application;
[0021] Figure 3 is a schematic diagram of a configuration change device provided according to an embodiment of the present application;
[0022] Figure 4 It is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0026] It should be noted that the configuration change method, device and electronic device determined in the present disclosure can be used in the computer field, and can also be used in any field other than the computer field. The application field of the configuration change method, device and electronic device determined in the present disclosure is not limited.
[0027] It should be noted that the collected information, user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) used in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of the relevant regions, necessary confidentiality measures are taken, and public order and good customs are not violated. Corresponding operation portals are provided for users to choose to authorize or refuse to use. For example, an interface is set up between this system and relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0028] It should be noted that the embodiments or examples of the present disclosure are not exhaustive, but are only illustrative of some embodiments or examples, and are not intended to be specific limitations on the scope of protection of the present disclosure. In the absence of contradiction, each step in a certain embodiment or example can be implemented as an independent example, and the steps can be combined arbitrarily. For example, the scheme after removing some steps in a certain embodiment or example can also be implemented as an independent example, and the order of the steps in a certain embodiment or example can be arbitrarily exchanged. In addition, the optional methods or optional examples in a certain embodiment or example can be combined arbitrarily; in addition, the various embodiments or examples can be combined arbitrarily, for example, some or all steps of different embodiments or examples can be combined arbitrarily, and a certain embodiment or example can be combined arbitrarily with the optional methods or optional examples of other embodiments or examples.
[0029] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0030] Configuration file: A device's configuration file is usually a text file that contains various settings and parameter information about the device. The configuration file is used to configure various functions and behaviors of the device, such as network settings, system settings, security settings, etc.
[0031] Configuration snapshot: A device configuration snapshot is a snapshot of the device's current configuration information, including hardware configuration, software configuration, network configuration, etc. Configuration snapshots can help users understand the device configuration, and can also be used to back up and restore device configurations, as well as to evaluate device performance and security.
[0032] According to an embodiment of the present application, a configuration change method is provided.
[0033] Figure 1 is a flow chart of a configuration change method provided according to an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0034] Step S101 : obtaining a first configuration snapshot corresponding to a current configuration of a target device and a second configuration snapshot corresponding to a target configuration to which the target device is to be changed.
[0035] It should be noted that the target device can be a server, computer or other device, the target device can be a border security device (including but not limited to network traffic border security devices, network data forwarding devices, network traffic analysis devices, network traffic management devices), or it can be a virtualized border security device (including but not limited to virtualized network traffic border security devices, virtualized network data forwarding devices, virtualized network traffic analysis devices, virtualized network traffic management devices).
[0036] Here, the current configuration may be a configuration file currently used by the target device, the target configuration may be a configuration file to be used by the target device, or a configuration file generated for the target device at a target historical moment, and the configuration snapshot may be a snapshot file of the configuration file, which includes all configuration contents in the configuration file.
[0037] Furthermore, the target device may include multiple software, the current configuration of the target device may include the configuration content (or called: module configuration) of each of the multiple software applied in the first operating environment, and the target configuration of the target device may include the configuration content of each of the multiple software applied in the second operating environment; here, the multiple software of the target device in the first operating environment may be completely or partially the same as the multiple software of the target device in the second operating environment.
[0038] For example, the configuration information corresponding to the operating environment of software A is file module A in the current configuration file, and the configuration information corresponding to the operating environment of software B is file module B in the current configuration file. By way of example, when a target software in a target device needs to change the operating environment or test scenario, the device configuration file corresponding to the target software needs to be modified. At this time, the current configuration of the target device needs to be updated so that the target software can be tested or run in the updated environment.
[0039] For example, when updating the configuration of a target device, in order to avoid restarting the device, a configuration difference file can be generated based on the difference between the current configuration and the target configuration, and the current configuration in the device can be updated based on the configuration difference file, thereby updating the configuration content that needs to be updated in the current configuration to the configuration content in the target configuration, thereby eliminating the need to directly replace the current configuration with the target configuration, thereby avoiding the need to restart the device.
[0040] When updating the current configuration, it is first necessary to obtain a first configuration snapshot of the current configuration from the target device, wherein the first configuration snapshot records the configuration content of the current configuration, and obtain a second configuration snapshot of the target configuration from the database, wherein the second configuration snapshot records the configuration content of the target configuration. Here, the target configuration can be a configuration file written by the operation and maintenance personnel for the target device in a specific scenario and stored in the database, or a configuration file generated based on the configuration parameters received by the configuration interface of the target device.
[0041] Furthermore, after obtaining the first configuration snapshot and the second configuration snapshot, a strategy for generating a configuration difference file may be determined according to the difference between the first configuration snapshot and the second configuration snapshot, thereby completing the configuration difference file generation operation.
[0042] Step S102: determining a configuration generation strategy for generating a configuration difference file according to the difference between the first configuration snapshot and the second configuration snapshot.
[0043] It should be noted that the difference degree can be used to characterize the degree of difference between the file size of the first configuration snapshot and the file size of the second configuration snapshot. For example, the difference degree can be determined by comparing the file size of the first configuration snapshot and the file size of the second configuration snapshot; or, the difference degree can be used to characterize the degree of difference between the number of file modules of the first configuration snapshot and the number of file modules of the second configuration snapshot. For example, the difference degree can be determined by comparing the number of different file modules in the first configuration snapshot and the second configuration snapshot. For example, module 1 and module 3 in the first configuration snapshot and the second configuration snapshot are different. When the total number of modules is 10, the difference degree between the first configuration snapshot and the second configuration snapshot is 20%.
[0044] Exemplarily, after obtaining the difference between the first configuration snapshot and the second configuration snapshot, the difference can be compared with a preset threshold to determine which configuration generation strategy to select to generate the configuration difference file. For example, when the difference is greater than the preset threshold, strategy A can be used to generate the configuration difference file, and when the difference is less than the preset threshold, strategy B can be used to generate the configuration difference file, thereby accurately determining the configuration generation strategy according to the difference, and generating different configuration difference files according to different configuration generation strategies.
[0045] It should be noted that the configuration generation strategy may be a process for generating a configuration difference file, and may also determine how to update the current configuration according to the configuration difference file based on the process for generating the configuration difference file, thereby obtaining an update method for the current configuration.
[0046] Step S103: Generate a configuration difference file according to the configuration generation strategy.
[0047] Exemplarily, after the configuration generation strategy is determined, the configuration difference file can be generated according to the process in the configuration generation strategy.
[0048] Step S104: while keeping the target device running normally, update the current configuration according to the configuration difference file to obtain the target configuration.
[0049] Exemplarily, after obtaining the configuration difference file, the current configuration in the target device is updated according to the configuration difference file. When updating the current configuration, the current configuration in the target device can be modified directly according to the configuration difference file, so that part of the configuration content in the current configuration is modified, while the remaining configuration content unrelated to the configuration difference file remains unchanged, so that the software corresponding to the configuration content unrelated to the configuration difference file can still run normally, and only the software corresponding to the configuration content modified by the configuration difference file is in an updated state, so that the current configuration is updated to the target configuration without restarting the target device, thereby achieving the technical effect of ensuring that the software in the target device that is not affected by the update operation can run normally.
[0050] The configuration change method provided in the embodiment of the present application obtains a first configuration snapshot corresponding to the current configuration of the target device, and a second configuration snapshot corresponding to the target configuration to be changed to the target device; determines a configuration generation strategy for generating a configuration difference file according to the difference between the first configuration snapshot and the second configuration snapshot; generates a configuration difference file according to the configuration generation strategy; and updates the current configuration according to the configuration difference file while maintaining the normal operation of the target device to obtain the target configuration. This solves the problem that the method of directly replacing the device configuration file in the related art requires restarting the device, thereby affecting the normal operation of the software that does not require configuration file changes. By comparing the first configuration snapshot and the second configuration snapshot, the difference between the current configuration and the target configuration is determined, and the generation strategy of the configuration difference file is determined according to the difference, thereby obtaining the configuration difference file, and then the current configuration is updated in the device according to the configuration difference file, thereby achieving the technical effect that the current configuration can be updated without shutting down the target device, and ensuring that some software in the target device that is not affected by the update operation can operate normally.
[0051] Optionally, in the configuration change method provided in the embodiment of the present application, determining a configuration generation strategy for generating a configuration difference file according to the difference between the first configuration snapshot and the second configuration snapshot includes: when the file size difference between the first configuration snapshot and the second configuration snapshot is greater than a preset difference, determining that the configuration generation strategy is the first configuration generation strategy; when the configuration generation strategy is the first configuration generation strategy, generating a configuration difference file according to the configuration generation strategy, including: generating a first configuration difference file according to the third configuration snapshot corresponding to the initial configuration of the target device, the first configuration snapshot, and the second configuration snapshot, wherein the initial configuration is used to initialize the target device.
[0052] Exemplarily, when determining the difference between the first configuration snapshot and the second configuration snapshot, a judgment may be made based on the difference between the snapshot sizes. First, the file size of the first configuration snapshot may be obtained, and the file size of the second configuration snapshot may be obtained, and the sizes of the two files may be subtracted to obtain the file size difference, and the file size difference may be compared with a preset difference. If the file size difference is greater than the preset difference, it indicates that the difference between the two snapshots is too large, and the configuration generation strategy may be determined to be the first configuration generation strategy.
[0053] Furthermore, when determining to use the first configuration generation strategy to generate a configuration difference file, it is necessary to obtain the initial configuration of the target device and use the third configuration snapshot of the initial configuration and the first configuration snapshot and the second configuration snapshot to generate a configuration difference file. That is, since the difference between the first configuration snapshot and the second configuration snapshot is large, the third configuration snapshot can be used as an intermediate file to change the first configuration snapshot to the second configuration snapshot through the third configuration snapshot, thereby ensuring the accuracy of the target configuration during and after the change.
[0054] This embodiment determines a generation strategy of a configuration difference file according to the file size difference between configuration snapshots, thereby ensuring the accuracy of the configuration difference file and ensuring that the current configuration can be updated to the target configuration through the configuration difference file.
[0055] Optionally, in the configuration change method provided in the embodiment of the present application, determining a configuration generation strategy for generating a configuration difference file according to the difference between the first configuration snapshot and the second configuration snapshot includes: when the file size difference between the first configuration snapshot and the second configuration snapshot is less than or equal to a preset difference, determining a difference requirement according to the third configuration snapshot, the first configuration snapshot, and the second configuration snapshot corresponding to the initial configuration of the target device, and judging whether the content difference between the first configuration snapshot and the second configuration snapshot meets the difference requirement; when the content difference does not meet the difference requirement, determining the configuration generation strategy to be the first configuration generation strategy; when the content difference meets the difference requirement, determining the configuration generation strategy to be the second configuration generation strategy; when the configuration generation strategy is the second configuration generation strategy, generating a configuration difference file according to the configuration generation strategy, including: generating a second configuration difference file according to the first configuration snapshot and the second configuration snapshot.
[0056] Exemplarily, when the file size difference is less than or equal to the preset difference, it is necessary to further determine the content difference between the first configuration snapshot and the second configuration snapshot, so as to determine whether the current configuration needs to be updated using the third configuration snapshot as an intermediate file based on the content difference.
[0057] When further determining the content difference between the first configuration snapshot and the second configuration snapshot, it is first necessary to determine the difference requirement, wherein the difference requirement can be determined by the file difference between the first configuration snapshot, the second configuration snapshot, and the third configuration snapshot. For example, a difference 1 between the third configuration snapshot and the first configuration snapshot is obtained, a difference 2 between the third configuration snapshot and the second configuration snapshot is obtained, and the difference 1 and the difference 2 are used as the difference requirement, and a difference 3 between the first configuration snapshot and the second configuration snapshot is obtained, and it is determined whether the difference 3 meets the difference requirement, for example, whether the difference 3 is greater than the sum of the difference 1 and the difference 2. When the difference 3 is greater than the sum of the difference 1 and the difference 2, it is determined that the content difference does not meet the difference requirement. At this time, it is characterized that the content difference between the first configuration snapshot and the second configuration snapshot is high, and it is determined that the configuration generation strategy is still the first configuration generation strategy, thereby ensuring the generation accuracy of the configuration difference file.
[0058] Furthermore, when difference 3 is less than or equal to the sum of difference 1 and difference 2, it is determined that the content difference meets the difference requirement, which indicates that the difference between the first configuration snapshot and the second configuration snapshot is small, thereby determining that the configuration generation strategy is the second configuration generation strategy. At this time, a second configuration difference file can be directly generated based on the first configuration snapshot and the second configuration snapshot, and the current configuration in the device can be directly updated by the second configuration difference file, thereby reducing the generation complexity of the configuration difference file and improving the generation efficiency of the configuration difference file.
[0059] This embodiment determines the method for generating a configuration difference file by determining the content difference between the first configuration snapshot and the second configuration snapshot, thereby ensuring that a method with high accuracy and efficiency in generating the configuration difference file can be selected, thereby improving the accuracy and efficiency of updating the configuration file.
[0060] Optionally, in the configuration change method provided in an embodiment of the present application, calculating the file size difference between the first configuration snapshot and the second configuration snapshot includes: obtaining the file size of the first configuration snapshot to obtain a first data volume, obtaining the file size of the second configuration snapshot to obtain a second data volume; subtracting the first data volume from the second data volume to obtain a first difference, and dividing the first difference and the first data volume to obtain the file size difference.
[0061] Specifically, when calculating the file size difference between the first configuration snapshot and the second configuration snapshot, the calculation may be performed using the following formula:
[0062] File size difference = (first data volume - second data volume) / first data volume;
[0063] The first data volume is the file size of the first configuration snapshot, and the second data volume is the file size of the second configuration snapshot. The proportion of the difference volume to the first data volume is determined by dividing the difference between the first data volume and the second data volume by the first data volume, thereby determining the degree of difference between the file sizes of the first configuration snapshot and the second configuration snapshot.
[0064] For example, if the first data volume is 100KB and the second data volume is 110KB, then the file size difference = (100-110) / 100 = 10%. When the preset difference is 50%, it is determined that the file size difference is less than the preset difference, then the step of determining the difference requirement according to the third configuration snapshot, the first configuration snapshot, and the second configuration snapshot is executed, and a strategy for generating a configuration difference file is determined according to the difference requirement. When the preset difference is 5%, it is determined that the file size difference is greater than the preset difference, then the configuration generation strategy is determined to be the first configuration generation strategy.
[0065] This embodiment uses the proportion of the file size difference between the first configuration snapshot and the second configuration snapshot to the first configuration snapshot as the difference, thereby improving the accuracy of determining the file size difference, thereby improving the accuracy of subsequent determination of the configuration generation strategy.
[0066] Optionally, in the configuration change method provided in the embodiment of the present application, generating a first configuration difference file according to the third configuration snapshot, the first configuration snapshot and the second configuration snapshot corresponding to the initial configuration of the target device includes: obtaining first difference information between the first configuration snapshot and the third configuration snapshot; obtaining second difference information between the second configuration snapshot and the third configuration snapshot; combining the first difference information and the second difference information into a first configuration difference file; updating the current configuration according to the configuration difference file to obtain the target configuration, including: restoring the current configuration to the initial configuration according to the first difference information, and updating the initial configuration according to the second difference information to obtain the target configuration.
[0067] Specifically, when generating the first configuration difference file, it is first necessary to obtain the difference information between the first configuration snapshot and the third configuration snapshot to obtain the first difference information, wherein obtaining the difference information may include: comparing the first configuration snapshot with the third configuration snapshot, recording the difference part (including newly added, modified and deleted configuration items), and generating a configuration difference file AC based on the difference part, thereby obtaining the first difference information, wherein the configuration difference file AC is used to change the current configuration to the initial configuration.
[0068] It should be noted that when generating a configuration difference file, it needs to be divided into three parts: a new part, a modified part, and a deleted part, and generated separately. The deleted part is a configuration item that is located in the first configuration snapshot but not in the third configuration snapshot. The modified part is a configuration item that is located in the first configuration snapshot and the third configuration snapshot, but the parameters in the configuration item are not exactly the same. The new part is to delete the configuration items corresponding to the modified part and the deleted part after comparing the first configuration snapshot and the third configuration snapshot and finding the modified part and the deleted part. The remaining configuration items in the third configuration snapshot are the new part. The above three parts are obtained and combined to obtain the first difference information.
[0069] It should be noted that when combining the above three parts, the newly added part is first marked with the first identifier to obtain the first part of the content, then the configuration items in the modified part located in the first configuration snapshot are marked with the second identifier, and the configuration items located in the third configuration snapshot are marked with the third identifier to obtain the second part of the content, finally, the deleted part is marked with the fourth identifier to obtain the third part of the content, and the three parts of the content are combined in the order of the above marking to obtain the configuration difference file AC, that is, the first difference information.
[0070] Furthermore, the same method may be used to obtain second difference information between the second configuration snapshot and the third configuration snapshot, and the two parts of difference information may be combined to obtain a configuration difference file generated by the first configuration generation strategy.
[0071] Furthermore, after obtaining the configuration difference file, the configuration difference file can be used to update the current configuration in the target device. At this time, it is necessary to first use the first difference information in the configuration difference file to update the current configuration to obtain the initial configuration, and then use the second difference information in the configuration difference file to update the initial configuration to obtain the target configuration, thereby completing the operation of updating the current configuration in the device to the target configuration.
[0072] This embodiment generates and uses a relatively complex configuration difference file by combining two difference information, thereby reducing the complexity of the device configuration update operation and improving the update efficiency of the device configuration when the device configuration update process is relatively complex.
[0073] Optionally, in the configuration change method provided in the embodiment of the present application, determining the difference requirement according to the third configuration snapshot, the first configuration snapshot and the second configuration snapshot corresponding to the initial configuration of the target device, and judging whether the content difference between the first configuration snapshot and the second configuration snapshot meets the difference requirement includes: obtaining the number of difference modules between the first configuration snapshot and the third configuration snapshot to obtain the first module number, wherein the first configuration snapshot, the third configuration snapshot and the second configuration snapshot each contain a plurality of configuration data modules; obtaining the number of difference modules between the second configuration snapshot and the third configuration snapshot to obtain the second module number; obtaining the number of difference modules between the second configuration snapshot and the first configuration snapshot to obtain the third module number, and determining the third module number as the content difference; calculating the sum of the first module number and the second module number to obtain the total module number, and determining the difference requirement according to the total module number; when the third module number is greater than the total module number, determining that the content difference does not meet the difference requirement; when the third module number is less than or equal to the total module number, determining that the content difference meets the difference requirement.
[0074] It should be noted that when judging whether the content difference between the first configuration snapshot and the second configuration snapshot meets the difference requirement, it is necessary to determine the difference requirement first. When determining the difference requirement, the main basis is to determine whether the difference 3 between the first configuration snapshot and the second configuration snapshot is greater than the sum of the difference 1 between the first configuration snapshot and the third configuration snapshot and the difference 2 between the second configuration snapshot and the third configuration snapshot.
[0075] Specifically, first obtain the number of difference modules between the first configuration snapshot and the third configuration snapshot to obtain the first module number, wherein, since the configuration snapshot is composed of multiple file modules, the number of file modules with differences can be determined, and thus the difference between the configuration snapshots is determined according to the number of difference file modules.
[0076] Furthermore, it is necessary to obtain the number of difference modules between the second configuration snapshot and the third configuration snapshot to obtain the number of second modules, and to obtain the number of difference modules between the second configuration snapshot and the first configuration snapshot to obtain the number of third modules, so as to determine the size of the difference based on the number of first modules, the number of second modules and the number of third modules.
[0077] Among them, the first module quantity can be used to characterize the difference between the first configuration snapshot and the third configuration snapshot, and obtain the difference 1. Similarly, the second module quantity can be used to characterize the difference 2 between the second configuration snapshot and the third configuration snapshot. The third module quantity can be used to characterize the difference 3 between the first configuration snapshot and the second configuration snapshot. When the difference 1+the difference 2 is less than or equal to the difference 3, the sum of the difference between the first configuration snapshot and the third configuration snapshot and the difference between the second configuration snapshot and the third configuration snapshot is less than the difference between the first configuration snapshot and the second configuration snapshot. At this time, it can be determined that the configuration update using the third configuration snapshot as an intermediate file is more efficient. Therefore, when the number of third modules is greater than the total number of modules, it is determined that the content difference does not meet the difference requirement.
[0078] Further, when difference 1 + difference 2 is greater than difference 3, the sum of the difference between the first configuration snapshot and the third configuration snapshot and the difference between the second configuration snapshot and the third configuration snapshot is greater than or equal to the difference between the first configuration snapshot and the second configuration snapshot. At this time, the difference between the first configuration snapshot and the second configuration snapshot is small, and therefore, it can be determined that the content difference meets the difference requirement.
[0079] This embodiment determines the relationship between the sum of the difference between the first configuration snapshot and the third configuration snapshot and the difference between the second configuration snapshot and the third configuration snapshot, and the difference between the first configuration snapshot and the second configuration snapshot, and then determines the configuration generation strategy, thereby improving the generation efficiency of the configuration difference file.
[0080] Optionally, in the configuration change method provided in the embodiment of the present application, generating a second configuration difference file based on the first configuration snapshot and the second configuration snapshot includes: obtaining difference information between the first configuration snapshot and the second configuration snapshot to obtain the second configuration difference file; updating the current configuration according to the configuration difference file to obtain the target configuration includes: updating the current configuration to the target configuration according to the second configuration difference file.
[0081] Specifically, when generating the second configuration difference file, it is also necessary to obtain the first configuration snapshot and the second configuration snapshot, and record the difference between the snapshots (including newly added, modified and deleted configuration items), and generate the configuration difference file based on the difference. It should be noted that when generating the configuration difference file, it is necessary to generate three contents, namely, the newly added part, the modified part and the deleted part, respectively. The deleted part is the configuration item located in the first configuration snapshot but not in the second configuration snapshot. The modified part is the configuration item located in the first configuration snapshot and the second configuration snapshot, but the parameters in the configuration item are not exactly the same. The newly added part is to delete the configuration items corresponding to the modified part and the deleted part after comparing the first configuration snapshot and the second configuration snapshot and finding the modified part and the deleted part. The remaining configuration items in the second configuration snapshot are the newly added part. The above three parts are obtained and combined to obtain the second configuration difference file.
[0082] Optionally, in the configuration change method provided in the embodiment of the present application, when the configuration difference file is generated by the second configuration generation strategy, the method further includes: if first feedback information sent by the target device is received, and when the first feedback information indicates that the target device fails to change from the current configuration to the target configuration, changing the configuration generation strategy from the second configuration generation strategy to the first configuration generation strategy, and executing the step of generating the configuration difference file according to the configuration generation strategy through the first configuration generation strategy; when the second feedback information is received, obtaining a configuration update log from the target device, wherein the second feedback information indicates that the change from the current configuration to the target configuration fails again; identifying abnormal log information of an abnormality in the configuration update log, and sending the abnormal log information and the second configuration difference file to the target terminal; receiving the modified second configuration difference file fed back by the target terminal, and updating the current configuration in the target device through the modified second configuration difference file to obtain the target configuration.
[0083] Specifically, after obtaining the second configuration difference file through the second configuration generation strategy, the current configuration in the target device needs to be updated according to the second configuration difference file. However, during the update process, an error may occur due to preset rules in the current configuration.
[0084] For example, the current configuration includes the following configuration items:
[0085] (1) The eth1 interface is configured with a static IP address of ip1.
[0086] (2) The eth2 interface uses DHCP to automatically obtain an IP address (ip2).
[0087] The above configuration items need to be changed to:
[0088] (1) The eth2 interface uses DHCP to automatically obtain the IP address ip1.
[0089] (2) The eth1 interface is configured with a static IP address ip2.
[0090] At this time, since the IP addresses corresponding to different interfaces in the current configuration cannot be the same, when the second configuration difference file is used to change the current configuration, since the configuration item parameters in the current configuration need to be changed one by one when changing, the following situation will occur at a certain moment:
[0091] (1) The eth2 interface uses DHCP to automatically obtain the IP address ip2.
[0092] (2) The eth1 interface is configured with a static IP address ip2.
[0093] At this time, the target device will recognize that there is an error in the configuration information being changed, and then trigger a rollback operation, so that the configuration of the target device is restored to the current configuration state. At this time, the first feedback information indicating the failure of the configuration update sent by the target device will be received. Therefore, it is necessary to change the configuration generation strategy from the second configuration generation strategy to the first configuration generation strategy, and regenerate the first configuration difference file through the first configuration generation strategy, and update the current configuration according to the first configuration difference file. Since the configurations in the third configuration snapshot are all in the initialized state, the above-mentioned IP address duplication will not occur. Therefore, the initial configuration can be updated normally through the first configuration difference file to obtain the target configuration.
[0094] Furthermore, when the current configuration is updated through the first configuration difference file, certain abnormal situations may occur, resulting in the inability to update the configuration normally. In this case, it is necessary to obtain the configuration update log from the target device, identify the abnormal log information of the abnormality in the configuration update log, and send the abnormal log information and the second configuration difference file to the target terminal (for example, the operation and maintenance end). The staff of the target terminal processes the second configuration difference file according to the abnormal log information to obtain the second configuration difference file that can update the device configuration normally, thereby completing the update operation of the configuration of the target device.
[0095] It should be noted that, if an abnormality is detected in the configuration update operation again, the target device will automatically roll back the configuration file and reset the configuration of the target device to the current configuration, thereby ensuring the normal operation of the software in the target device.
[0096] This embodiment ensures accurate update of the configuration in the target device by regenerating the configuration difference file by changing the configuration generation strategy.
[0097] Figure 2 is a flowchart of an optional configuration change method provided in an embodiment of the present application, such as Figure 2 As shown, first, a first configuration snapshot A of the current configuration of the target device and a second configuration snapshot B of the target configuration are obtained, and a third configuration snapshot C of the initial configuration of the target device is obtained, and the file size difference between snapshot A and snapshot B is compared to see whether it is greater than a preset difference. If so, the configuration generation strategy is determined to be the first configuration generation strategy.
[0098] Furthermore, when the file size difference is less than or equal to the preset difference, the difference requirement is determined based on the third configuration snapshot, the first configuration snapshot, and the second configuration snapshot, and it is judged whether the content difference between the first configuration snapshot and the second configuration snapshot meets the difference requirement; when the content difference meets the difference requirement, the configuration generation strategy is determined to be the second configuration generation strategy; when the content difference does not meet the difference requirement, the configuration generation strategy is determined to be the first configuration generation strategy.
[0099] Furthermore, after obtaining the configuration generation strategy, a configuration difference file is generated according to the configuration generation strategy, and the current configuration in the target device is updated according to the configuration difference file. At this time, it is also necessary to determine whether the target device sends the first feedback information. When the first feedback information is sent and the strategy used is the second configuration generation strategy, the second configuration generation strategy is changed to the first configuration generation strategy. When the feedback information is sent and the strategy used is the first configuration generation strategy, the current configuration is rolled back, and the configuration update log is obtained from the target device. Exception log information of the exception is identified in the configuration update log, and the exception log information and the second configuration difference file are sent to the target terminal. The staff of the target terminal processes the second configuration difference file according to the exception log information to obtain the second configuration difference file that can normally update the device configuration, thereby completing the configuration update operation of the target device.
[0100] The present application determines the difference between the current configuration and the target configuration by comparing the first configuration snapshot and the second configuration snapshot, and determines the generation strategy of the configuration difference file according to the difference, thereby obtaining the configuration difference file, and then updating the current configuration in the device according to the configuration difference file, thereby achieving the technical effect of updating the current configuration without shutting down the target device, and ensuring that some software in the target device that is not affected by the update operation can run normally.
[0101] In summary, the technical solution provided by this application has at least the following effects:
[0102] 1) Improve operation and maintenance efficiency: Automated configuration snapshots combined with reverse configuration solutions restore the target configuration, reducing manual operations and speeding up configuration changes, thereby significantly improving the efficiency of operation and maintenance work.
[0103] 2) Enhanced system stability: By comparing transactional operations (for example, when changing a configuration, if an error occurs, the completed change will be rolled back to the state before the change) with configuration snapshots, the accuracy and predictability of configuration changes are ensured, the risk of system failures caused by configuration errors is reduced, and the stability of the overall system is enhanced.
[0104] 3) Optimize business continuity: Restoring configuration does not require restarting the device, and the rapid configuration recovery capability reduces service interruption time caused by configuration updates, which can support the continuous operation of the business, especially in business scenarios with critical services and high real-time requirements.
[0105] 4) Reduce operational risks: Modular configuration comparison combined with the reverse configuration solution to restore the target configuration provides more refined control and reduces the possibility of operational errors. At the same time, the existence of the transaction mechanism allows for rapid rollback when problems occur, reducing operational risks.
[0106] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0107] The embodiment of the present application also provides a configuration change device. It should be noted that the configuration change device of the embodiment of the present application can be used to execute the configuration change method provided in the embodiment of the present application. The configuration change device provided in the embodiment of the present application is introduced below.
[0108] Figure 3 Schematic diagram of a configuration change device provided according to an embodiment of the present application. Figure 3 As shown, the device includes: a first acquisition unit 31, a determination unit 32, a generation unit 33, and a first updating unit 34.
[0109] The first acquisition unit 31 is configured to acquire a first configuration snapshot corresponding to a current configuration of a target device and a second configuration snapshot corresponding to a target configuration to which the target device is to be changed.
[0110] The determining unit 32 is configured to determine a configuration generation strategy for generating a configuration difference file according to the difference between the first configuration snapshot and the second configuration snapshot.
[0111] The generating unit 33 is used to generate a configuration difference file according to the configuration generation strategy.
[0112] The first updating unit 34 is used to update the current configuration according to the configuration difference file to obtain the target configuration while keeping the target device running normally.
[0113] The configuration change device provided in the embodiment of the present application obtains the first configuration snapshot corresponding to the current configuration of the target device and the second configuration snapshot corresponding to the target configuration to be changed to the target device through the first acquisition unit 31; the determination unit 32 determines the configuration generation strategy for generating the configuration difference file according to the difference between the first configuration snapshot and the second configuration snapshot; the generation unit 33 generates the configuration difference file according to the configuration generation strategy; the first update unit 34 updates the current configuration according to the configuration difference file while maintaining the normal operation of the target device to obtain the target configuration. The problem that the method of directly replacing the device configuration file in the related art requires restarting the device, thereby affecting the normal operation of the software that does not need to change the configuration file, is solved. By comparing the first configuration snapshot with the second configuration snapshot, the difference between the current configuration and the target configuration is determined, and the generation strategy of the configuration difference file is determined according to the difference, thereby obtaining the configuration difference file, and then the current configuration is updated in the device according to the configuration difference file, thereby achieving the technical effect that the current configuration can be updated without shutting down the target device, and ensuring that the part of the software in the target device that is not affected by the update operation can operate normally.
[0114] Optionally, in the configuration change device provided in the embodiment of the present application, the determination unit 32 includes: a first determination module, used to determine that the configuration generation strategy is the first configuration generation strategy when the file size difference between the first configuration snapshot and the second configuration snapshot is greater than a preset difference; when the configuration generation strategy is the first configuration generation strategy, the generation unit 33 includes: a first generation module, used to generate a first configuration difference file according to the third configuration snapshot, the first configuration snapshot and the second configuration snapshot corresponding to the initial configuration of the target device, wherein the initial configuration is used to initialize the target device.
[0115] Optionally, in the configuration change device provided in the embodiment of the present application, the determination unit 32 includes: a second determination module, which is used to determine the difference requirement according to the third configuration snapshot, the first configuration snapshot and the second configuration snapshot corresponding to the initial configuration of the target device when the file size difference between the first configuration snapshot and the second configuration snapshot is less than or equal to a preset difference, and judge whether the content difference between the first configuration snapshot and the second configuration snapshot meets the difference requirement; a third determination module, which is used to determine that the configuration generation strategy is the first configuration generation strategy when the content difference does not meet the difference requirement; a fourth determination module, which is used to determine that the configuration generation strategy is the second configuration generation strategy when the content difference meets the difference requirement; when the configuration generation strategy is the second configuration generation strategy, the generation unit 33 includes: a second generation module, which is used to generate a second configuration difference file according to the first configuration snapshot and the second configuration snapshot.
[0116] Optionally, in the configuration change device provided in the embodiment of the present application, the determination unit 32 includes: an acquisition module, used to obtain the file size of the first configuration snapshot to obtain a first data volume, and obtain the file size of the second configuration snapshot to obtain a second data volume; a calculation module, used to subtract the first data volume from the second data volume to obtain a first difference, and divide the first difference and the first data volume to obtain a file size difference.
[0117] Optionally, in the configuration change device provided in the embodiment of the present application, the first generation module includes: a first acquisition sub-module, used to obtain first difference information between the first configuration snapshot and the third configuration snapshot; a second acquisition sub-module, used to obtain second difference information between the second configuration snapshot and the third configuration snapshot; a combination sub-module, used to combine the first difference information and the second difference information into a first configuration difference file; the first update unit includes: a first update module, used to restore the current configuration to the initial configuration according to the first difference information, and update the initial configuration according to the second difference information to obtain the target configuration.
[0118] Optionally, in the configuration change device provided in the embodiment of the present application, the second determination module includes: a third acquisition submodule, used to acquire the number of difference modules between the first configuration snapshot and the third configuration snapshot, and obtain the first module number, wherein the first configuration snapshot, the third configuration snapshot, and the second configuration snapshot each contain multiple configuration data modules; a fourth acquisition submodule, used to acquire the number of difference modules between the second configuration snapshot and the third configuration snapshot, and obtain the second module number; a fifth acquisition submodule, used to acquire the number of difference modules between the second configuration snapshot and the first configuration snapshot, and obtain the third module number, and determine the third module number as the content difference; a calculation submodule, used to calculate the sum of the first module number and the second module number, and obtain the total module number, and determine the difference requirement according to the total module number; the first determination submodule, used to determine that the content difference does not meet the difference requirement when the third module number is greater than the total module number; the second determination submodule, used to determine that the content difference meets the difference requirement when the third module number is less than or equal to the total module number.
[0119] Optionally, in the configuration change device provided in the embodiment of the present application, the second generation module includes: a sixth acquisition submodule, used to obtain difference information between the first configuration snapshot and the second configuration snapshot to obtain a second configuration difference file; the first update unit includes: a second update module, used to update the current configuration to the target configuration according to the second configuration difference file.
[0120] Optionally, in the configuration change device provided in the embodiment of the present application, when the configuration difference file is generated by the second configuration generation strategy, the device also includes: a changing unit, which is used to change the configuration generation strategy from the second configuration generation strategy to the first configuration generation strategy if the first feedback information sent by the target device is received, and when the first feedback information indicates that the target device fails to change from the current configuration to the target configuration, and execute the step of generating the configuration difference file according to the configuration generation strategy through the first configuration generation strategy; a second obtaining unit, which is used to obtain the configuration update log from the target device when the second feedback information is received, wherein the second feedback information indicates that the current configuration fails to change to the target configuration again; a sending unit, which is used to identify abnormal log information of the abnormality in the configuration update log, and send the abnormal log information and the second configuration difference file to the target terminal; a second updating unit, which is used to receive the modified second configuration difference file fed back by the target terminal, and update the current configuration in the target device through the modified second configuration difference file to obtain the target configuration.
[0121] The configuration change device includes a processor and a memory. The first acquisition unit 31, determination unit 32, generation unit 33, first update unit 34, etc. are all stored in the memory as program units. The processor executes the program units stored in the memory to implement corresponding functions.
[0122] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set. By adjusting the kernel parameters, the problem that the method of directly replacing the device configuration file in the related art requires restarting the device, thereby affecting the normal operation of the software that does not require the configuration file change, is solved.
[0123] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0124] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the configuration changing method is implemented.
[0125] An embodiment of the present invention provides a processor, which is used to run a program, wherein the configuration change method is executed when the program is running.
[0126] Figure 4 is a schematic diagram of an electronic device provided according to an embodiment of the present application, such as Figure 4 As shown, an embodiment of the present invention provides an electronic device, the electronic device 40 includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the steps of the above configuration change method when executing the program. The device in this article can be a server, a PC, a PAD, a mobile phone, etc.
[0127] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the steps of the above configuration change method.
[0128] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0129] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0130] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0131] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0132] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0133] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0134] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0135] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0136] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A configuration change method, characterized in that: include: Acquire a first configuration snapshot corresponding to a current configuration of a target device, and a second configuration snapshot corresponding to a target configuration to be changed to the target device; determining, according to a degree of difference between the first configuration snapshot and the second configuration snapshot, a configuration generation strategy for generating a configuration difference file; Generate the configuration difference file according to the configuration generation strategy; While keeping the target device operating normally, the current configuration is updated according to the configuration difference file to obtain the target configuration.
2. The method according to claim 1, characterized in that Determining, according to the difference between the first configuration snapshot and the second configuration snapshot, a configuration generation strategy for generating a configuration difference file includes: In a case where the file size difference between the first configuration snapshot and the second configuration snapshot is greater than a preset difference, determining that the configuration generation strategy is the first configuration generation strategy; In a case where the configuration generation strategy is the first configuration generation strategy, generating the configuration difference file according to the configuration generation strategy includes: A first configuration difference file is generated according to a third configuration snapshot corresponding to an initial configuration of the target device, the first configuration snapshot, and the second configuration snapshot, wherein the initial configuration is used to initialize the target device.
3. The method according to claim 1 or 2, characterized in that: Determining, according to the difference between the first configuration snapshot and the second configuration snapshot, a configuration generation strategy for generating a configuration difference file includes: In a case where the file size difference between the first configuration snapshot and the second configuration snapshot is less than or equal to a preset difference, determining a difference requirement according to a third configuration snapshot corresponding to the initial configuration of the target device, the first configuration snapshot, and the second configuration snapshot, and judging whether the content difference between the first configuration snapshot and the second configuration snapshot meets the difference requirement; In a case where the content difference does not meet the difference requirement, determining that the configuration generation strategy is a first configuration generation strategy; In a case where the content difference meets the difference requirement, determining that the configuration generation strategy is a second configuration generation strategy; In a case where the configuration generation strategy is the second configuration generation strategy, generating the configuration difference file according to the configuration generation strategy includes: A second configuration difference file is generated according to the first configuration snapshot and the second configuration snapshot.
4. The method according to claim 2, characterized in that: Calculating the file size difference between the first configuration snapshot and the second configuration snapshot includes: Obtaining a file size of the first configuration snapshot to obtain a first data volume, and obtaining a file size of the second configuration snapshot to obtain a second data volume; The first data amount is subtracted from the second data amount to obtain a first difference, and the first difference is divided by the first data amount to obtain the file size difference.
5. The method according to claim 2 or 4, characterized in that: Generating a first configuration difference file according to a third configuration snapshot corresponding to the initial configuration of the target device, the first configuration snapshot, and the second configuration snapshot includes: Acquire first difference information between the first configuration snapshot and the third configuration snapshot; Acquire second difference information between the second configuration snapshot and the third configuration snapshot; combining the first difference information and the second difference information into the first configuration difference file; The current configuration is updated according to the configuration difference file to obtain the target configuration, including: According to the first difference information, the current configuration is restored to the initial configuration, and according to the second difference information, the initial configuration is updated to obtain the target configuration.
6. The method according to claim 3, characterized in that Determining a difference requirement according to a third configuration snapshot corresponding to the initial configuration of the target device, the first configuration snapshot, and the second configuration snapshot, and judging whether the content difference between the first configuration snapshot and the second configuration snapshot meets the difference requirement includes: Obtaining the number of different modules between the first configuration snapshot and the third configuration snapshot to obtain a first module number, wherein the first configuration snapshot, the third configuration snapshot, and the second configuration snapshot each include a plurality of configuration data modules; Obtaining the number of different modules between the second configuration snapshot and the third configuration snapshot to obtain a second module number; Acquire the number of different modules between the second configuration snapshot and the first configuration snapshot to obtain a third number of modules, and determine the third number of modules as the content difference degree; Calculating the sum of the first module quantity and the second module quantity to obtain a total module quantity, and determining the difference requirement according to the total module quantity; When the number of the third modules is greater than the total number of modules, determining that the content difference does not meet the difference requirement; When the number of the third modules is less than or equal to the total number of modules, it is determined that the content difference meets the difference requirement.
7. The method according to claim 3, characterized in that Generating a second configuration difference file according to the first configuration snapshot and the second configuration snapshot includes: Obtaining difference information between the first configuration snapshot and the second configuration snapshot to obtain the second configuration difference file; The current configuration is updated according to the configuration difference file to obtain the target configuration, including: According to the second configuration difference file, the current configuration is updated to the target configuration.
8. The method according to claim 3, characterized in that In the case where the configuration difference file is generated by the second configuration generation strategy, the method further includes: If first feedback information sent by the target device is received, and in the case where the first feedback information indicates that the target device fails to change from the current configuration to the target configuration, the configuration generation strategy is changed from the second configuration generation strategy to the first configuration generation strategy, and the step of generating the configuration difference file according to the configuration generation strategy is performed through the first configuration generation strategy; When receiving the second feedback information, obtaining a configuration update log from the target device, wherein the second feedback information indicates that the change of the current configuration to the target configuration fails again; identifying abnormal log information in the configuration update log where an abnormality occurs, and sending the abnormal log information and the second configuration difference file to a target terminal; The modified second configuration difference file fed back by the target terminal is received, and the current configuration in the target device is updated by using the modified second configuration difference file to obtain the target configuration.
9. A configuration change device, characterized in that: include: A first acquisition unit, configured to acquire a first configuration snapshot corresponding to a current configuration of a target device, and a second configuration snapshot corresponding to a target configuration to be changed to the target device; a determining unit, configured to determine a configuration generation strategy for generating a configuration difference file according to a difference between the first configuration snapshot and the second configuration snapshot, wherein the configuration difference file is used to update the target configuration; A generating unit, configured to generate the configuration difference file according to the configuration generating strategy; The first updating unit is used to update the current configuration according to the configuration difference file to obtain the target configuration while keeping the target device operating normally.
10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the configuration change method described in any one of claims 1 to 8.
Citation Information
Cited By
Software configuration management method and storage device
CN122411981A
