Automatic synchronization method of kernel parameters between different Linux operating systems
By establishing core parameter specifications and developing a parameter conversion library, the problems of complexity and high error rate in migrating between Linux distributions were solved, achieving efficient and accurate automated migration.
Patent Information
- Application Number
- CN202110585665.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-27
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2041-05-27
AI Technical Summary
Migrating core parameters between different Linux distributions is complex, inefficient, and prone to errors. The lack of a unified standard leads to chaotic migration processes.
Establish core parameter specifications, develop parameter conversion libraries and crawling programs, and implement parameter migration through automated methods, including parameter conversion libraries and crawling programs, using sysctl and configuration file modifications to support automated migration.
It achieves efficient and accurate migration of core parameters, reduces manual intervention, improves migration efficiency, and supports large-scale operations.
Smart Images

Figure CN115408070B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data synchronization between different operating systems, and in particular to a method for automatically synchronizing core parameters between different Linux operating systems. Background Art
[0002] In recent years, with the rapid development of the Linux operating system, numerous Linux distributions have emerged, such as Ubuntu, SUSE, CentOS, openEuler, and Kylin OS. These operating systems have been widely used in various fields. Although all of these systems are Linux operating systems, their core parameter configurations vary. For example, the network parameter configuration paths of SUSE and Kylin OS are completely different. Therefore, migrating core parameters between different Linux distributions is a very complex process.
[0003] Traditional migration methods analyze different operating system configurations and perform the migration manually. This manual migration method requires high technical expertise, is inefficient, and has a high probability of error. Migration can even fail due to improper manual operation. Furthermore, there are multiple ways to enable core parameter migration, without unified standards or specifications, leading to frequent confusion. A standardized and effective method is urgently needed to complete the migration of core parameters between different operating system releases. Summary of the Invention
[0004] To address the deficiencies of the prior art, the present invention provides a method for automatically synchronizing kernel parameters between different Linux operating systems, comprising the following steps:
[0005] Step S1: obtaining the core parameter specifications and parameter configuration specifications of the operating system to be synchronized and the target operating system according to the core parameter types and format specifications of the operating system to be synchronized and the target operating system;
[0006] Step S2: Develop a parameter validation conversion library for different categories of core parameters;
[0007] Step S3: The target operating system reads the parameter configuration specification and uses the parameter validation conversion library to validate the core parameters of the operating system to be synchronized;
[0008] Step S4: The target operating system obtains the second parameter configuration specification through the parameter capture program;
[0009] Step S5: Compare the second parameter configuration specification with the parameter configuration specifications in steps S2 and S3. If the data values of the two are consistent, it indicates that the migration is effective; otherwise, it indicates that the migration has failed.
[0010] The operating system to be synchronized refers to an operating system whose core parameters need to be synchronized with other operating systems, and the target operating system refers to an operating system whose core parameters need to be synchronized with other operating systems.
[0011] Wherein, in step S4, the parameter grabbing program grabbing method includes:
[0012] Step S41: analyzing the installation package file list of the target operating system;
[0013] Step S42: determine whether the installation package of the corresponding application has been analyzed. If it has been analyzed, directly extract the configuration file path of the corresponding application; if it has not been analyzed, analyze the configuration file path of the corresponding application and obtain its core parameter information.
[0014] Among them, in step S2, the parameter conversion method of each core parameter in the parameter effectiveness conversion library includes: command line and physical configuration file modification method. The command line configuration method is to complete the system configuration through some system configuration commands, and the physical configuration file modification method is to complete the core parameter configuration by modifying the parameters of the physical configuration file.
[0015] Among them, the operating system to be synchronized and the target operating system are selected from the SUSE Linux system and the Kylin operating system respectively, and their core parameter specifications include security, kernel, environment variables, service configuration and others. The parameter configuration specifications include but are not limited to parameter type, parameter configuration file path, parameter name, and parameter value.
[0016] The present invention provides an automatic synchronization method for core parameters between different Linux operating systems, which classifies and manages the core parameters of Linux, standardizes the parameter format and migration operation, and does not require manual intervention during the migration process. The migration operation is completed automatically, thus preventing the possibility of manual operation errors, having high execution efficiency, and supporting large-scale migration operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 : Core parameter specifications of Suse Linux and Kylin operating system.
[0018] Figure 2 :Execution program diagram of parameter validation conversion library for Suse Linux and Kylin operating system.
[0019] Figure 3 : The core parameter capture flow chart of the present invention.
[0020] Figure 4 : The core parameter grabbing program execution flow chart of the present invention.
[0021] Figure 5 : A specific migration flow chart of a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to have a further understanding of the technical solution and beneficial effects of the present invention, the technical solution and beneficial effects of the present invention are described in detail below with reference to the accompanying drawings.
[0023] The present invention improves and enhances the traditional migration method, and proposes a solution for automatic intelligent classification and processing of core parameters and migration. The migration efficiency is high, the error rate is low, and the migration method is unified, which can improve the accuracy and standardization of the migration operation.
[0024] The present invention's method for automatically synchronizing and migrating core parameters between different operating systems is primarily applicable to parameter synchronization between Linux operating systems, and is particularly suitable for automatically synchronizing core parameters of a SUSE Linux system to the Kylin operating system. The present invention can also be used to convert core parameters between other Linux distributions, such as CentOS and Ubuntu.
[0025] The technical means adopted by the present invention are: based on the kernel optimization tool sysctl, systemd, environment variable management and other technologies on the Linux system. Specifically, based on the kernel optimization tool sysctl on the Linux system and the technology of modifying application configuration files, the corresponding migration is implemented by programming according to the characteristics of SUSE Linux and Zhongbiao Kylin operating system. The main technical basis for its implementation is as follows:
[0026] 1. Formulate core parameter specifications: formulate unified core parameter specifications for suse Linux and Kylin operating systems. The present invention divides the core parameter table into five categories: safety, kernel, environmental variables, service configuration and others, and formulates unified parameter configuration specifications. The general parameter specification format includes: parameter type, parameter configuration file path, parameter name, parameter value, etc. The parameters of the Linux operating system are huge, and this process also requires an agreement on which core parameters to migrate. Parameter classification is as follows: Figure 1 shown.
[0027] 2. Develop parameter validation conversion library: On the platform of the Kylin operating system, develop parameter validation conversion library for different categories of parameters to ensure that parameter migration can be carried out in accordance with the prescribed method. That is, according to the input parameter p, the parameter conversion method Kmethod is automatically found in the parameter validation conversion library and run to take effect. For example, modifying kernel parameters involves two methods: using sysctl commands and modifying configuration files. The command line configuration method is to complete the system configuration through some system configuration commands such as the "sysctl-w" command. The way to modify the physical configuration file is to complete the configuration of the core parameters by modifying the parameters of the physical configuration file. For example, to complete the configuration of the kernel.watchdog core parameters, you can use the command sysctl-wkernel.watchdog=x to implement parameter configuration, or you can modify
[0028] / etc / sysctl.conf to implement parameter configuration. Enter kernel parameters into the parameter validation conversion library, which will automatically find the corresponding method to migrate the parameters based on the parameter information (sysctl and modify the configuration file method), so that the parameters can automatically take effect on the Kylin system.
[0029] If the input parameter is kernel:vm.swappiness=5, when the parameter is entered, the corresponding validation method sysctl will be automatically mapped through the parameter conversion library, and the system will execute the command sysctl vm.swappiness=5 to make the parameter effective;
[0030] For security-related parameters, the validation conversion library uses complex shell operations such as "sed -i..." to implement parameter validation conversion.
[0031] The execution flow chart of the parameter validation conversion library is as follows: Figure 2 shown.
[0032] 3. Develop a program for capturing core parameters: Based on the characteristics of SUSE Linux and Kylin operating systems, and referring to the core parameter specifications, develop a program for capturing core parameter values. The program is divided into two parts: client and server. The client sends a request to capture core parameters. After receiving the request, the server analyzes the requested data through the Smart Proxy, executes different parameter capture methods for different requests, and finally summarizes the captured data into the core parameter table to form the host core parameter table.
[0033] The program for grabbing core parameters is developed in Python. The communication between the server and the client is implemented through the Restful interface. The communication protocol uses https. The client is divided into: web client (Web UI) and command line client (Cli Client). The implementation flow chart is as follows: Figure 3 shown.
[0034] The program used in the present invention to capture core parameters can automatically analyze the installation package of the host, and by analyzing the installation package file list, analyze the path of the configuration files of the application and other core parameters, and then extract the core parameters. Not only that, the program for capturing core parameters also has a certain self-learning ability. For example, if it detects that the application vsftpd-server is installed on the host, the program will automatically analyze the installation package and obtain the configuration file path ( / etc / vsftpd / vsftpd.conf), and record the path. The next time the program is executed, the program for capturing core parameters does not need to analyze the installation package again, and can directly locate the installation path of the configuration file through the last recorded data. This can greatly improve the execution efficiency of the program. The execution flow chart of the parameter capture program is as follows: Figure 4 shown.
[0035] The related technologies used in this invention may have different implementations for different system versions. This invention takes the migration of kernel core parameters of SUSE Linux Enterprise Server 12SP5 to Kylin Advanced Server Operating System V7.6 as an example to introduce the migration process. Figure 5 FIG. 1 is a specific migration flow chart of a preferred embodiment of the present invention.
[0036] 1. Develop core parameter specifications
[0037] The sysctl --all command can be used to view all kernel-related parameters of SUSE Linux Enterprise Server 12SP5 and Kylin Advanced Server Operating System V7.6. Based on the migration requirements, there are 50 parameters that customers focus on. Parameter table specifications for these 50 parameters are established. The parameter table specification T is shown in the following table:
[0038]
[0039] 2. Refer to parameter table specification T to obtain the relevant values of the above 50 parameters of the SUSE Linux Enterprise Server 12SP5 kernel and generate parameter table T1, as shown in the following table:
[0040]
[0041] 3. On the Zhongbid Kylin Advanced Server V7.6 host, read the parameter values in Table T1 and validate the parameters through the parameter validation conversion library. This invention uses a Python script program to implement the parameter validation conversion library, which mainly involves modifying the / etc / sysctl.conf file and using the sysctl command.
[0042] 4. On the Kylin Advanced Server V7.6 host, run the parameter capture program to obtain parameter table T2. The format of T2 is the same as that of table T1.
[0043] 5. Compare T1 and T2. If the data values are consistent, the migration is successful. Otherwise, the migration fails.
[0044] The beneficial effects of the present invention are as follows:
[0045] 1. The present invention classifies and processes the core parameters of the operating system through methods such as a core parameter table, a core parameter capture program, and a parameter validation conversion library, thereby automatically completing the migration of core parameters, avoiding manual intervention, reducing the time of platform migration, and greatly improving efficiency.
[0046] 2. In contrast to traditional methods, this invention establishes unified specifications for parameter formats, parameter capture methods, and parameter validation methods, thus avoiding the risk of manual intervention. In addition, this method can also be used on a large scale, greatly improving migration efficiency.
[0047] 3. The present invention classifies and manages the core parameters of Linux, standardizes the parameter format and migration operation, and the migration process does not require manual intervention, and the migration operation is completed automatically, thereby preventing the possibility of manual operation errors, having high execution efficiency, and supporting large-scale migration operations.
[0048] Although the present invention has been described using the above preferred embodiments, they are not intended to limit the scope of protection of the present invention. Any person skilled in the art may make various changes and modifications to the above embodiments without departing from the spirit and scope of the present invention. These changes and modifications are still within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be based on the definition of the claims.
Claims
1. A method for automatically synchronizing kernel parameters between different Linux operating systems, characterized in that: The steps include: Step S1: obtaining the core parameter specifications and parameter configuration specifications of the operating system to be synchronized and the target operating system according to the core parameter types and format specifications of the operating system to be synchronized and the target operating system; Step S2: Develop a parameter validation conversion library for different categories of core parameters; Modifying kernel parameters involves two methods: using the sysctl command and modifying the configuration file; The command line configuration method completes system configuration through system configuration commands; Modify the physical configuration file to complete the configuration of core parameters by modifying the parameters of the physical configuration file; Step S3: The target operating system reads the parameter configuration specification and uses the parameter validation conversion library to validate the core parameters of the operating system to be synchronized; Step S4: The target operating system obtains the second parameter configuration specification through the parameter capture program; Step S5: Compare the second parameter configuration specification with the parameter configuration specifications in steps S2 and S3. If the data values of the two are consistent, it indicates that the migration is effective; otherwise, it indicates that the migration has failed. The operating system to be synchronized refers to an operating system whose core parameters need to be synchronized with other operating systems, and the target operating system refers to an operating system whose core parameters need to be synchronized with other operating systems.
2. The method for automatically synchronizing kernel parameters between different Linux operating systems according to claim 1, wherein: In step S4, the parameter grabbing method of the program includes: Step S41: analyzing the installation package file list of the target operating system; Step S42: determine whether the installation package of the corresponding application has been analyzed. If it has been analyzed, directly extract the configuration file path of the corresponding application; if it has not been analyzed, analyze the configuration file path of the corresponding application and obtain its core parameter information.
3. The method for automatically synchronizing kernel parameters between different Linux operating systems according to claim 1, wherein: The operating system to be synchronized and the target operating system are respectively selected from the SUSE Linux system and the Kylin operating system. Their core parameter specifications include security, kernel, environment variables, and service configuration. The parameter configuration specifications include parameter type, parameter configuration file path, parameter name, and parameter value.
Citation Information
Patent Citations
Update-driven migration of data
CN107273148A