A method for cluster file configuration fast recursive comparison check

By using Ansible and Python script automation technology, the problem of low efficiency in cluster configuration checking was solved, enabling fast and automated configuration comparison and improving the efficiency of configuration checking for cluster projects.

CN118467466BActive Publication Date: 2026-07-21CHINA INFOMRAITON CONSULTING & DESIGNING INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA INFOMRAITON CONSULTING & DESIGNING INST CO LTD
Filing Date
2024-04-09
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In existing technologies for OpenStack, Kubernetes, and Hadoop cluster projects, incorrect configuration modifications can lead to service malfunctions. Existing tools are inefficient, requiring manual comparison of each configuration item, and are unable to efficiently detect configuration errors.

Method used

Using Ansible and Python script automation technology, Ansible host files are generated by locating IP addresses and component names, configuration files are collected, and Python programs are used to classify, store, and compare them, automatically identifying and outputting the differences.

Benefits of technology

It enables rapid and automated checking of cluster file configuration consistency, shortens troubleshooting time, improves configuration checking efficiency, and has versatility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118467466B_ABST
    Figure CN118467466B_ABST
Patent Text Reader

Abstract

The application provides a method for cluster file configuration quick recursive comparison check, the method proposes that the confirmation of openstack, k8s, hadoop related cluster component configuration is automatically completed through ansible, python script, the shortcomings of the current scheme are positioned ip address, component name and the directory, and the table items are formed according to classification, and then configuration check and comparison can be further carried out, because there are many names about a certain extension under a certain directory, so classification identification is needed after collection, and the same comparison is carried out again, and the difference part is output, finally, the component name is classified and stored, so that the result check is convenient.Through ansible, python script, the configuration consistency of multiple servers of openstack, k8s, hadoop and other clusters can be directly and quickly checked (the problems such as misconfiguration and omission can be excluded), and the troubleshooting time is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for fast recursive comparison and checking of cluster file configurations. Background Technology

[0002] During the implementation of OpenStack, Kubernetes, and Hadoop cluster projects, operators need to manually modify a large number of configurations. Errors in these configuration modifications can cause cluster service malfunctions. When problems occur, it is necessary to reverse-engineer the errors to correct the cluster service configuration. This process typically involves using the following two tools to collect data, followed by visual comparison for confirmation:

[0003] 1) Use the command 'grep -r "keyword" directory name' to filter out directories and configurations containing that keyword, and visually check if the configuration is correct (refer to...). Figure 1 ).

[0004] Further filtering based on the above, such as grep keystonerc_admin (see...) Figure 2 )

[0005] Filter by using grep -E "regular expressions folder" (see reference). Figure 3 ).

[0006] 2) The `vimdiff` command can be used to open the file to be compared and check for configuration errors. Different parts are usually displayed using different colors or horizontal lines (see [reference]). Figure 4 ).

[0007] Disadvantages of existing technology:

[0008] 1) The command `grep -r "string" directory_name"` can perform a recursive search for files containing certain keywords. However, it can only find and filter specific lines within configuration files. For multiple configuration files across multiple components, searching line by line is too inefficient. Therefore, this method is generally only suitable for further confirmation when you have a general understanding of the problem. It is not suitable for situations where you have no clue or the direction of the problem is unclear (see [reference]). Figure 5 ).

[0009] 2) vimdiff can compare whether a configuration file is consistent as a whole, but this method can only collect data locally and then compare it component by component and configuration by configuration, which is quite cumbersome;

[0010] 3) Both methods require manual visual inspection and verification of each item, which is inefficient. Summary of the Invention

[0011] Purpose of the Invention: The technical problem to be solved by this invention is to address the shortcomings of existing technologies by providing a method for rapid recursive comparison and checking of cluster file configurations. This invention relates to automation technologies related to Ansible, Python, and shell, and is mainly applied in the field of automated technology for rapidly comparing relevant file configurations during the operation and maintenance implementation phase of cluster projects such as OpenStack, Kubernetes, and Hadoop.

[0012] The method of the present invention includes the following steps:

[0013] Step 1: Edit Information Form 1 and fill in the IP address, component name, file extension, and main directory where the component was installed;

[0014] Step 2: Use Python to read the contents of information table 1 file and generate an Ansible host file based on the IP address and component name;

[0015] Step 3: Use Ansible to collect the configuration files in the main directory mentioned in Step 1 and save them to Notepad;

[0016] Step 4: Use a Python program to read the contents of Notepad. Columns containing "d" are folders, and the others are regular files. Store the files directly in a table according to their file extensions.

[0017] Step 5: Determine whether to perform further recursive queries based on the folder size. If further recursive queries are required, proceed to step 6; otherwise, proceed to step 7.

[0018] Step 6: Use a Python program to read the contents of Notepad. Columns containing "d" are folders, and the others are regular files. Store the files directly in a table according to their file extensions.

[0019] Step 7: Exit the collection query and start comparing files; it is not a folder table.

[0020] Step 8: Read the content information that is the same for each IP address and send it to the backend Python for comparison and processing;

[0021] Step 9: Store the collected information in a list according to the number of hosts for later processing;

[0022] Step 10: Use Python to compare the list contents, output the differences and store them in a table.

[0023] In step 1, if it is a configuration file under the neutron directory, first confirm the component configuration name. The component configuration file will be installed in the / etc / neutron directory, and the server address will be stored in Table 1.

[0024] In step 2, first, a .xlsx file is read. Then, with the format fixed, a list is defined. Cells are read line by line, and the content read from each cell is added to the list. Finally, the file is written to Notepad. An example is shown below:

[0025]

[0026]

[0027] In step 5, a threshold is set. For folders whose size is greater than the threshold, a recursive query is required.

[0028] In step 5, the threshold is 100.

[0029] In step 5, a pop-up window may appear asking if further folder searches are needed.

[0030] In step 8, Ansible is used to read the same content information for each IP address.

[0031] In step 9, Python is used to store the collected information into a list for processing according to the number of hosts.

[0032] In step 10, two notebook files containing the collected content are read, and the difference set is calculated by comparing the lists.

[0033] The present invention also provides a storage medium, characterized in that it stores a computer program or instructions, which, when the computer program or instructions are run, implement the method for fast recursive comparison and checking of cluster file configuration.

[0034] During project implementation, when OpenStack, Kubernetes, and Hadoop clusters are involved, a large number of configuration modifications need to be made manually. The system then performs the corresponding functions based on the configuration. However, various omissions or mismatches are inevitable during the modification process. Using grep-r or vimdiff to compare and find these errors requires checking the results one by one, which is inefficient. This solution provides an automated method to quickly identify potential error points.

[0035] Beneficial effects: Ansible and Python scripts can be used to quickly check whether the configurations of multiple servers in a cluster such as OpenStack, Kubernetes, and Hadoop are consistent (eliminating problems such as misconfiguration and omissions), shortening troubleshooting time. This example uses the Neutron configuration of an OpenStack cluster, but it can be extended to other configuration file types such as Glance or related configuration comparisons for other clusters such as Kubernetes, making it universally applicable. Attached Figure Description

[0036] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention in the above and / or other aspects will become clearer.

[0037] Figure 1 This is a configuration example diagram for filtering entries containing 192.168.26.51.

[0038] Figure 2 This is a configuration example diagram for further filtering of entries containing keystonerc_admin.

[0039] Figure 3 This is an example image using regular expressions for filtering.

[0040] Figure 4 This is an example image of vimdiff comparing two files.

[0041] Figure 5 This is an example diagram of an OpenStack cluster component.

[0042] Figure 6 This is a diagram of the comparison script. Detailed Implementation

[0043] This solution proposes to automate the confirmation of configurations for OpenStack, Kubernetes, and Hadoop cluster components using Ansible and Python scripts. Addressing the shortcomings of current solutions, it identifies IP addresses, component names, and their directories, categorizing them into a form for further configuration checks and comparisons. Since many names with a specific extension exist within a directory, they need to be collected, categorized, and compared within the same category to confirm differences. Finally, the results are stored categorized by component name for easy verification. The detailed solution is as follows, using the configuration file in the Neutron directory as an example:

[0044] Step 1: First, you need to confirm the component configuration name. For example, if the configuration of neutron has been modified beforehand, you can see that the configuration file for this component will be installed in the / etc / neutron directory, and the server address will also be stored in Table 1.

[0045] Table 1

[0046] 192.168.10.5 neutron / etc / neutron 192.168.10.6 neutron / etc / neutron 192.168.10.4 barbican / etc / barbican 192.168.10.5 barbican / etc / barbican 192.168.10.6 barbican / etc / barbican

[0047] The file structure in the / etc / neutron directory on a certain server is as follows:

[0048] [root@TM-POD24~]#ll / etc / neutron

[0049] total 84K

[0050] drwxr-xr-x 13 200 200 314Aug 30 2022conf.d

[0051] -rw-r-----1 200 200 322Aug 30 2022dhcp_agent.ini

[0052] -rw-r--r--1 200 200 63Aug 30 2022dnsmasq-neutron.conf-rw-r-----1 200200 589Aug 30 2022fwaas_driver.ini-rw-r-----1 200 200 442Aug 30 2022l3_agent.ini

[0053] -rw-r-----1 200 200 113Aug 30 2022lbaas_agent.ini-rw-r-----1 200 20011K Aug 30 2022metadata_agent.ini-rw-r-----1root root 4.7K Mar 7 20:31neutron.conf

[0054] -rw-r-----1 200 200 4.4K Aug 30 2022neutron.conf_ori-rw-r-----1 200200 2.4K Aug 30 2022neutron_lbaas.conf-rw-r-----1 200 200 300Aug 302022neutron_vpnaas.conf-rw-r-----1 200 200 430Aug 30 2022plugin.ini drwxr-xr-x 3 200 200 17Aug 30 2022plugins

[0055] -rw-r-----1 200 200 12K Aug 30 2022policy.json

[0056] -rw-r--r--1 200 200 1.2K Aug 30 2022rootwrap.conf

[0057] -rw-r-----1 200 200 3.5K Aug 30 2022services_lbaas.conf-rw-r-----1200 200 209Aug 30 2022vpn_agent.ini[root@TM-POD24~]#

[0058] The file structure in the / etc / barbican directory on a certain server is as follows:

[0059] root@root@TM-POD24]#ls-la / etc / barbican

[0060] total 88K

[0061] -rw-r--r--1root root 674Dec 28 2020api_audit_map.conf-rw-r--r--1rootroot 2.1K Dec 28 2020barbican-api-paste.ini-rw-r--r--1root root 1.1K Mar 816:32barbican.conf

[0062] -rw-r-----1root root 60K Mar 8 14:44barbican.conf.bak

[0063] -rw-r--r--1root root 2.8K Dec 28 2020barbican-functional.conf-rw-r--r--1root root 225Mar 8 15:16gunicorn-config.py

[0064] -rw-r--r--1root root 5.0K Dec 28 2020policy.json drwxr-xr-x 2rootroot 30Mar 8 13:23vassals

[0065] [root@root@TM-POD24]#

[0066] Step 2: Use Python to read the contents of Table 1 and generate an Ansible host file based on the IP address in the first column and the component name in the second column. The contents are as follows:

[0067] 1) Host file:

[0068] [neutron] 192.168.10.4 192.168.10.5 192.168.10.6

[0072] [barbican] 192.168.10.4 192.168.10.5 192.168.10.6

[0076] The third step is to use Ansible to collect the configuration files in the directory and save them to Notepad.

[0077] [root@TM-POD24~]#ansible-i hosts ne-m shell-a"ls-la / etc / neutron"

[0078] 192.168.10.4|SUCCESS|rc=0>>

[0079] total 100

[0080] drwxr-xr-x 4 200 200 4096Mar 8 21:46.

[0081] drwxr-xr-x.97root root 8192Mar 8 13:23..

[0082] drwxr-xr-x 13 200 200 314Aug 30 2022conf.d

[0083] -rw-r-----1 200 200 322Aug 30 2022dhcp_agent.ini

[0084] -rw-r--r--1 200 200 63Aug 30 2022dnsmasq-neutron.conf

[0085] -rw-r-----1 200 200 589Aug 30 2022fwaas_driver.ini

[0086] -rw-r-----1 200 200 442Aug 30 2022l3_agent.ini

[0087] -rw-r-----1 200 200 113Aug 30 2022lbaas_agent.ini

[0088] -rw-r-----1 200 200 10917Aug 30 2022metadata_agent.ini

[0089] -rw-r-----1root root 4778Mar 7 20:31neutron.conf

[0090] -rw-r-----1 200 200 4482Aug 30 2022neutron.conf_ori

[0091] -rw-r-----1 200 200 2457Aug 30 2022neutron_lbaas.conf

[0092] -rw-r-----1 200 200 300Aug 30 2022neutron_vpnaas.conf-rw-r-----1 200200 430 Aug 30 2022 plugin.inidrwxr-xr-x 3 200 200 17 Aug 30 2022 plugins

[0093] -rw-r-----1 200 200 11849 Aug 30 2022 policy.json

[0094] -rw-r--r--1 200 200 1195 Aug 30 2022 rootwrap.conf

[0095] -rw-r-----1 200 200 3568 Aug 30 2022 services_lbaas.conf-rw-r-----1200 200 209 Aug 30 2022 vpn_agent.ini

[0096] 192.168.10.6|SUCCESS|rc=0>>

[0097] total 92

[0098] drwxr-xr-x 4 200 200 4096 Mar 7 22:41.

[0099] drwxr-xr-x.97 root root 8192 Mar 8 15:10..

[0100] drwxr-xr-x 13 200 200 314 Aug 30 2022 conf.d

[0101] -rw-r-----1 200 200 322 Aug 30 2022 dhcp_agent.ini-rw-r--r--1 200 20063 Aug 30 2022 dnsmasq-neutron.conf-rw-r-----1 200 200 589 Aug fwaas_driver.ini-rw-r-----1 200 200 442 Aug 30 2022 l3_agent.ini

[0102] -rw-r-----1 200 200 113 Aug 30 2022 lbaas_agent.ini-rw-r-----1 200200 10917 Aug 30 2022 metadata_agent.ini-rw-r-----1 root root 4778 Mar 7 20:31 neutron.conf

[0103] -rw-r-----1 200 200 2457 Aug 30 2022 neutron_lbaas.conf-rw-r-----1200 200 300 Aug 30 2022 neutron_vpnaas.conf-rw-r-----1 200 200 430 Aug 302022 plugin.inidrwxr-xr-x 3 200 200 17 Aug 30 2022 plugins

[0104] -rw-r-----1 200 200 11849 Aug 30 2022 policy.json

[0105] -rw-r--r--1 200 200 1195 Aug 30 2022 rootwrap.conf

[0106] -rw-r-----1 200 200 3568 Aug 30 2022 services_lbaas.conf-rw-r-----1200 200 209 Aug 30 2022 vpn_agent.ini

[0107] 192.168.10.5|SUCCESS|rcC0>>

[0108] total

[0109] drwxr-xr-x 4 200 200 4096 Mar 7 8:30 PM.

[0110] drwxr-xr-x.97 root root 8192 Mar 8 15:10..

[0111] drwxr-xr-x 13 200 200 314 Aug 30 2022 conf.d

[0112] -rw-r-----1 200 200 322 Aug 30 2022 dhcp_agent.ini

[0113] -rw-r--r--1 200 200 63 Aug 30 2022 dnsmasq-neutron.conf-rw-r-----1200 200 589 Aug 30 2022 fwaas_driver.ini

[0114] -rw-r-----1 200 200 442 Aug 30 2022 l3_agent.ini

[0115] -rw-r-----1 200 200 113 Aug 30 2022 lbaas_agent.ini

[0116] -rw-r-----1 200 200 10917 Aug 30 2022 metadata_agent.ini-rw-r-----1200 200 4778 Mar 7 8:30 pm neutron.conf

[0117] -rw-r-----1 root root 4482 Mar 7 20:01 neutron.conf.bak

[0118] -rw-r-----1 200 200 2457 Aug 30 2022 neutron_lbaas.conf-rw-r-----1200 200 300 Aug 30 2022 neutron_vpnaas.conf-rw-r-----1 200 200 430 Aug 302022 plugin.inidrwxr-xr-x 3 200 200 17 Aug 30 2022 plugins

[0119] -rw-r-----1 200 200 11849 Aug 30 2022 policy.json

[0120] -rw-r--r--1 200 200 1195 Aug 30 2022 rootwrap.conf

[0121] -rw-r-----1 200 200 3568 Aug 30 2022 services_lbaas.conf-rw-r-----1200 200 209 Aug 30 2022 vpn_agent.ini

[0122] [root@TM-POD24~]#

[0123] [ root@TM-POD24~]#ansible-i-hosts-ne-m-shell-a"ls-la / etc / barbican"192.168.10.4|SUCCESS|rcC0>>

[0124] total 88K

[0125] -rw-r--r--1 root root 674 Dec 28 2020 api_audit_map.conf

[0126] -rw-r--r--1 root root 2.1K Dec 28 2020 barbican-api-paste.ini

[0127] -rw-r--r--1 root root 1.1K Mar 8 16:32 barbican.conf

[0128] -rw-r-----1 root root 60K Mar 8 14:44 barbican.conf.bak

[0129] -rw-r--r--1root root 2.8K Dec 28 2020barbican-functional.conf

[0130] -rw-r--r--1root root 225Mar 8 15:16gunicorn-config.py

[0131] -rw-r--r--1root root 5.0K Dec 28 2020policy.json

[0132] drwxr-xr-x 2root root 30Mar 8 13:23vassals

[0133] 192.168.10.5|SUCCESS|rc=0>>

[0134] total 88K

[0135] -rw-r--r--1root root 674Dec 28 2020api_audit_map.conf

[0136] -rw-r--r--1root root 2.1K Dec 28 2020barbican-api-paste.ini

[0137] -rw-r--r--1root root 1.1K Mar 8 16:32barbican.conf

[0138] -rw-r-----1root root 60K Mar 8 14:44barbican.conf.bak

[0139] -rw-r--r--1root root 2.8K Dec 28 2020barbican-functional.conf

[0140] -rw-r--r--1root root 225Mar 8 15:16gunicorn-config.py

[0141] -rw-r--r--1root root 5.0K Dec 28 2020policy.json

[0142] drwxr-xr-x 2root root 30Mar 8 13:23vassals

[0143] 192.168.10.6|SUCCESS|rc=0>>

[0144] total 88K

[0145] -rw-r--r--1root root 674Dec 28 2020api_audit_map.conf

[0146] -rw-r--r--1root root 2.1K Dec 28 2020barbican-api-paste.ini

[0147] -rw-r--r--1root root 1.1K Mar 8 16:32barbican.conf

[0148] -rw-r-----1root root 60K Mar 8 14:44barbican.conf.bak

[0149] -rw-r--r--1root root 2.8K Dec 28 2020barbican-functional.conf

[0150] -rw-r--r--1root root 225Mar 8 15:16gunicorn-config.py

[0151] -rw-r--r--1root root 5.0K Dec 28 2020policy.json

[0152] drwxr-xr-x 2root root 30Mar 8 13:23vassals

[0153] Step 4: Use a Python program to read the contents of the Notepad file. Entries containing "d" in the first column are folders, and the others are regular files. Store the files directly in Tables 2 and 3 according to their file extensions.

[0154] Table 2

[0155]

[0156]

[0157]

[0158] Table 3

[0159]

[0160] Step 5: Further process the folder table, determining whether to perform further recursive queries based on folder size. This can be done in two ways: first, by setting a threshold (e.g., folders larger than 100 should be queried, others not); second, by having the program display a pop-up asking if further folder queries are needed. This solution uses a threshold setting as an example: the `conf.d` folder meets the query criteria, so further queries will be performed on that folder.

[0161] [root@TM-POD24~]#ansible-i hosts ne-m shell-a"ls-la / etc / neutron / conf.d"

[0162] 192.168.10.4|SUCCESS|rc=0>>

[0163] total 8

[0164] drwxr-xr-x 13 200 200 314Aug 30 2022.

[0165] drwxr-xr-x 4 200 200 4096Mar 8 21:46..

[0166] drwxr-xr-x 2 200 200 6Aug 30 2022common

[0167] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-dhcp-agent

[0168] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-l3-agent

[0169] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-lbaasv2-agent

[0170] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-linuxbridge-cleanup

[0171] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-metadata-agentdrwxr-xr-x 2200 200 6 Aug 30 2022 neutron-netns-cleanupdrwxr-xr-x 2 200 200 6 Aug 30 2022neutron-openvswitch-agentdrwxr-xr-x 2 200 200 6 Aug 30 2022 neutron-ovs-cleanupdrwxr-xr-x 2 200 200 6 Aug 30 2022 neutron-serverdrwxr-xr-x 2 200 2006 Aug 30 2022 neutron-vpn-agent

[0172] -rwxr-xr-x 1 200 200 501 Aug 30 2022 README

[0173] 192.168.10.5|SUCCESS|rc=0>>

[0174] total 8

[0175] drwxr-xr-x 13 200 200 314 Aug 30 2022.

[0176] drwxr-xr-x 4 200 200 4096 Mar 7 20:30..

[0177] drwxr-xr-x 2 200 200 6 Aug 30 2022 commondrwxr-xr-x 2 200 200 6 Aug30 2022 neutron-dhcp-agentdrwxr-xr-x 2 200 200 6 Aug 30 2022 neutron-l3-agentdrwxr-xr-x 2 200 200 6 Aug 30 2022 neutron-lbaasv2-agentdrwxr-xr-x 2 200200 6 Aug 30 2022 neutron-linuxbridge-cleanupdrwxr-xr-x 2 200 200 6 Aug 302022 neutron-metadata-agentdrwxr-xr-x 2 200 200 6 Aug 30 2022 neutron-netns-cleanupdrwxr-xr-x 2 200 200 6 Aug 30 2022 neutron-openvswitch-agentdrwxr-xr-x2 200 200 6 Aug 30 2022 neutron-ovs-cleanupdrwxr-xr-x 2 200 200 6 Aug 30 2022neutron-serverdrwxr-xr-x 2 200 200 6 Aug 30 2022 neutron-vpn-agent

[0178] -rwxr-xr-x 1 200 200 501 Aug 30 2022 README

[0179] 192.168.10.6|SUCCESS|rc=0>>

[0180] total 8

[0181] drwxr-xr-x 13 200 200 314 Aug 30 2022.

[0182] drwxr-xr-x 4 200 200 4096 Mar 7 22:41..

[0183] drwxr-xr-x 2 200 200 6 Aug 30 2022 commondrwxr-xr-x 2 200 200 6 Aug30 2022 neutron-dhcp-agent

[0184] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-l3-agent

[0185] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-lbaasv2-agent

[0186] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-linuxbridge-cleanup

[0187] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-metadata-agent

[0188] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-netns-cleanup

[0189] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-openvswitch-agent

[0190] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-ovs-cleanup

[0191] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-server

[0192] drwxr-xr-x 2 200 200 6Aug 30 2022neutron-vpn-agent

[0193] -rwxr-xr-x 1 200 200 501Aug 30 2022README

[0194] [root@TM-POD24~]#

[0195] Step 6: Use a Python program to read the contents of the Notepad file. Entries containing "d" in the first column are folders, and the others are regular files. Store the files directly in Tables 4 and 5 according to their file extensions.

[0196] Table 4

[0197] 192.168.10.4 / etc / neutron / conf.d README 192.168.10.5 / etc / neutron / conf.d README 192.168.10.6 / etc / neutron / conf.d README

[0198] Table 5

[0199]

[0200]

[0201] Step 7: Further processing of folder queries revealed that none met the threshold requirements, so the collection query was exited, and file comparison began. First, non-folder table 6 was merged:

[0202] Table 6

[0203]

[0204]

[0205]

[0206] Step 8: According to the table above, use Ansible to read the same content information for each address and send it to the backend Python for processing. Taking the l3_agent.ini file of neutron and the barbican.conf file of barbican. as examples, store the path list in B1:

[0207] B1:

[0208] [' / etc / neutron / l3_agent.ini',' / etc / barbican / barbican.conf']

[0209] Step 9: Loop through B1, use background Python to retrieve background data and store the collected information in a list for processing. First, process / etc / neutron / l3_agent.ini:

[0210] First loop:

[0211] `ansible -i hosts neutron -m shell -a "cat / etc / neutron / l3_agent.ini"` / / Collects background information.

[0212] 192.168.10.4|SUCCESS|rc=0>>

[0213] [DEFAULT]

[0214] interface_driver=openvswitch

[0215] ovs_use_veth = False

[0216] router_delete_namespaces=True

[0217] use_namespaces=True

[0218] #external_network_bridge=br-ex

[0219] enable_metadata_proxy=False

[0220] ha_vrrp_advert_int=5

[0221] #gateway_external_network_id=3de9e6ae-a9d3-4f81-9b70-7ffb92189b36

[0222] [agent]

[0223] extensions=fip_qos,port_forwarding,gateway_ip_qos,fwaas

[0224] availability_zone=novareport_interval=30

[0225] [ovs]

[0226] ovsdb_interface=nativeovsdb_connection=tcp:127.0.0.1:6640

[0227] 192.168.10.6|SUCCESS|rc=0>>

[0228] [DEFAULT]

[0229] interface_driver=openvswitch

[0230] ovs_use_veth=False

[0231] router_delete_namespaces=True

[0232] use_namespaces=True

[0233] #external_network_bridge=br-ex

[0234] enable_metadata_proxy=Trueha_vrrp_advert_int=5

[0235] #gateway_external_network_id=3de9e6ae-a9d3-4f81-9b70-7ffb92189b36[agent]

[0236] extensions=fip_qos,port_forwarding,gateway_ip_qos,fwaasavailability_zone=novareport_interval=30

[0237] [ovs]

[0238] ovsdb_interface=nativeovsdb_connection=tcp:127.0.0.1:6640

[0239] 192.168.10.5|SUCCESS|rc=0>>

[0240] [DEFAULT]

[0241] interface_driver=openvswitch

[0242] ovs_use_veth=False

[0243] router_delete_namespaces=True

[0244] use_namespaces=True

[0245] #external_network_bridge=br-ex

[0246] enable_metadata_proxy=False

[0247] ha_vrrp_advert_int=5

[0248] #gateway_external_network_id=3de9e6ae-a9d3-4f81-9b70-7ffb92189b36

[0249] [agent]

[0250] extensions=fip_qos,port_forwarding,gateway_ip_qos,fwaas

[0251] availability_zone=nova

[0252] report_interval=30

[0253] [ovs]

[0254] ovsdb_interface=native

[0255] ovsdb_connection=tcp:127.0.0.1:6640

[0256] [root@T-M-POD24~]#

[0257] List1:

[0258] ['192.168.10.4|SUCCESS|rc=0>>','[DEFAULT]','interface_driver=openvswitch','ovs_use_veth=False','router_delete_namespaces=True','use_namespaces=True','#external_network_bridge=br-ex','enable_metadata_proxy=False','ha_vrrp_advert_int=5','#gateway_external_network_id=3de9e6ae-a9d3-4f81-9b70-7ffb92189b36','[agent]','extensions=fip_qos,port_forwarding,gateway_ip_qos,fwaas','availability_zone=nova','report_interval=30','[ovs]','ovsdb_interface=native','ovsdb_connection=tcp:127.0.0.1:6640']

[0259] List2:

[0260] ['192.168.10.6|SUCCESS|rc=0>>','[DEFAULT]','interface_driver=openvswitch','ovs_use_veth=False','router_delete_namespaces=True','use_namespaces=True','#external_network_bridge=br-ex','enable_metadata_proxy=True','ha_vrrp_advert_int=5','#gateway_external_network_id=3de9e6ae-a9d3-4f81-9b70-7ffb92189b36','[agent]','extensions=fip_qos,port_forwarding,gateway_ip_qos,fwaas','availability_zone=nova','report_interval=30','[ovs]','ovsdb_interface=native','ovsdb_connection=tcp:127.0.0.1:6640']

[0261] List3:

[0262] ['192.168.10.5|SUCCESS|rc=0>>','[DEFAULT]','interface_driver=openvswitch','ovs_use_veth=False','router_delete_namespaces=True','use_namespaces=True','#external_network_bridge=br-ex','enable_metadata_proxy=False','ha_vrrp_advert_int=5','#gateway_external_network_id=3de9e6ae-a9d3-4f81-9b70-7ffb92189b36','[agent]','extensions=fip_qos,port_forwarding,gateway_ip_qos,fwaas','availability_zone=nova','report_interval=30','[ovs]','ovsdb_interface=native','ovsdb_connection=tcp:127.0.0.1:6640']

[0263] Second loop:

[0264] $ansible -i hosts barbican -m shell -a "cat / etc / barbican / barbican.conf"

[0265] 192.168.10.4|SUCCESS|rc=0>>

[0266] [DEFAULT]

[0267] sql_connection=mysql + pymysql: / / root:ROOT_SQPWD@mysql - ha - vip / barbican

[0268] transport_url=rabbit: / / rabbitmq:M_123@192.168.10.4:5672,rabbitmq:M_123@192.168.10.5:5672,rabbitmq:M_123@192.168.10.6:5672

[0269] db_auto_create=false

[0270] host_href=http: / / barbican-ha-vip:9311

[0271] log_file= / var / log / barbican / api.log

[0272] [crypto]

[0273] enabled_crypto_plugins=simple_crypto

[0274] [keystone_authtoken]

[0275] auth_uri=http: / / keystone-ha-vip:5000

[0276] auth_url=http: / / keystone-ha-vip:35357

[0277] memcached_servers=192.168.0.39:11211

[0278] auth_type=password

[0279] project_domain_name=default

[0280] user_domain_name=default

[0281] project_name=service

[0282] username=barbican

[0283] password=BARBICAN_PWD

[0284] [secretstore]

[0285] namespace=barbican.secretstore.plugin

[0286] enabled_secretstore_plugins=store_crypto

[0287] [simple_crypto_plugin]

[0288] kek=dGhpcnR5X3R3b19ieXRlX2tleWJsYWhibGFoYmxhaGg=

[0289] 192.168.10.5|SUCCESS|rc=0>>

[0290] [DEFAULT]

[0291] sql_connection=mysql+pymysql: / / root:ROOT_SQPWD@mysql-ha-vip / barbican

[0292] transport_url=rabbit: / / rabbitmq:M_123@192.168.10.4:5672,rabbitmq:M_123@192.168.10.5:5672,rabbitmq:M_123@192.168.10.6:5672

[0293] db_auto_create=false

[0294] host_href=http: / / barbican-ha-vip:9311

[0295] log_file= / var / log / barbican / api.log

[0296] [crypto]

[0297] enabled_crypto_plugins=simple_crypto

[0298] [keystone_authtoken]

[0299] auth_uri=http: / / keystone-ha-vip:5000

[0300] auth_url=http: / / keystone-ha-vip:35357

[0301] memcached_servers=192.168.10.101:11211

[0302] auth_type=password

[0303] project_domain_name=default

[0304] user_domain_name=default

[0305] project_name=service

[0306] username=barbican

[0307] password=BARBICAN_PWD

[0308] [secretstore]

[0309] namespace=barbican.secretstore.plugin

[0310] enabled_secretstore_plugins=store_crypto

[0311] [simple_crypto_plugin]

[0312] kek=dGhpcnR5X3R3b19ieXRlX2tleWJsYWhibGFoYmxhaGg=

[0313] 192.168.10.6|SUCCESS|rc=0>>

[0314] [DEFAULT]

[0315] sql_connection=mysql+pymysql: / / root:ROOT_SQPWD@mysql-ha-vip / barbican

[0316] transport_url=rabbit: / / rabbitmq:M_123@192.168.10.4:5672,rabbitmq:M_123@192.168.10.5:5672,rabbitmq:M_123@192.168.10.6:5672

[0317] db_auto_create=false

[0318] host_href=http: / / barbican-ha-vip:9311

[0319] log_file= / var / log / barbican / api.log

[0320] [crypto]

[0321] enabled_crypto_plugins=simple_crypto

[0322] [keystone_authtoken]

[0323] auth_uri=http: / / keystone-ha-vip:5000

[0324] auth_url=http: / / keystone-ha-vip:35357

[0325] memcached_servers=192.168.10.101:11211

[0326] auth_type=password

[0327] project_domain_name=default

[0328] user_domain_name=default

[0329] project_name=services

[0330] username=barbican

[0331] password=BARBICAN_PWD

[0332] [secretstore]

[0333] namespace=barbican.secretstore.plugin

[0334] enabled_secretstore_plugins=store_crypto

[0335] [simple_crypto_plugin]

[0336] kek=dGhpcnR5X3R3b19ieXRlX2tleWJsYWhibGFoYmxhaGg=

[0337] List1:

[0338] ['[DEFAULT]', 'sql_connection=mysql+pymysql: / / root:ROOT_SQPWD@mysql-ha-vip / barbican', 'transport_url=rabbit: / / rabbitmq:M_123@192.168.10.4:5672,rabbitmq:M_123@192.168.10.5:5672,rabbitmq:M_123@192.168.10.6:5672','db_auto_create=false','host_href=http: / / barbican-ha-vip:9311','log_file= / var / log / barbican / api.log','[crypto]','enabled_crypto_plugins=simple_crypto','[keystone_authtoken]','auth_uri=http: / / keystone-ha-vip:5000','auth_url=http: / / keystone-ha-vip:35357','memcached_servers=192.168.0.39:11211','auth_type=password','project_domain_name=default','user_domain_name=default','project_name=service','username=barbican','password=BARBICAN_PWD','[secretstore]','namespace=barbican.secretstore.plugin','enabled_secretstore_plugins=store_crypto','[simple_crypto_plugin]','kek=dGhpcnR5X3R3b19ieXRlX2tleWJsYWhibGFoYmxhaGg=']

[0339] List2:

[0340] ['[DEFAULT]', 'sql_connection=mysql+pymysql: / / root:ROOT_SQPWD@mysql-ha-vip / barbican', 'transport_url=rabbit: / / rabbitmq:M_123@192.168.10.4:5672,rabbitmq:M_123@192.168.10.5:5672,rabbitmq:M_123@192.168.10.6:5672','db_auto_create=false','host_href=http: / / barbican-ha-vip:9311','log_file= / var / log / barbican / api.log','[crypto]','enabled_crypto_plugins=simple_crypto','[keystone_authtoken]','auth_uri=http: / / keystone-ha-vip:5000','auth_url=http: / / keystone-ha-vip:35357','memcached_servers=192.168.10.101:11211','auth_type=password','project_domain_name=default','user_domain_name=default','project_name=service','username=barbican','password=BARBICAN_PWD','[secretstore]','namespace=barbican.secretstore.plugin','enabled_secretstore_plugins=store_crypto','[simple_crypto_plugin]','kek=dGhpcnR5X3R3b19ieXRlX2tleWJsYWhibGFoYmxhaGg=']

[0341] List3:

[0342] ['[DEFAULT]', 'sql_connection=mysql+pymysql: / / root:ROOT_SQPWD@mysql-ha-vip / barbican', 'transport_url=rabbit: / / rabbitmq:M_123@192.168.10.4:5672,rabbitmq:M_123@192.168.10.5:5672,rabbitm q:M_123@192.168.10.6:5672','db_auto_create=false','host_href=http: / / barbican-ha-vip:9311','log_file= / var / log / barbican / api.log','[crypto]','enabled_crypto_plugin s=simple_crypto','[keystone_authtoken]','auth_uri=http: / / keystone-ha-vip:5000','auth_url=http: / / keystone-ha-vip:35357','memcached_servers=192.168.10.101:11211', 'auth_type=password','project_domain_name=default','user_domain_name=default','project_name=services','username=barbican','password=BARBICAN_PWD','[secretstore] ','namespace=barbican.secretstore.plugin','enabled_secretstore_plugins=store_crypto','[simple_crypto_plugin]','kek=dGhpcnR5X3R3b19ieXRlX2tleWJsYWhibGFoYmxhaGg=']

[0343] Step 10: Based on the output of each loop in Step 9, use a Python program (partial code can be found here). Figure 6 Read two notebook files containing the collected content, find the difference between them by comparing the lists, compare the contents of the lists, output the differences and store them in Table 7:

[0344] Table 7, Step 9, First Loop:

[0345] 192.168.10.4 / etc / neutron / README 'enable_metadata_proxy=False' 192.168.10.5 / etc / neutron / README 'enable_metadata_proxy=False' 192.168.10.6 / etc / neutron / README 'enable_metadata_proxy=True'

[0346] Step 9, second cycle:

[0347]

[0348]

[0349] This invention provides a method for fast recursive comparison and checking of cluster file configurations. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment of the invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.

Claims

1. A method for fast recursive comparison and checking of cluster file configurations, characterized in that, Includes the following steps: Step 1: Edit Information Form 1 and fill in the IP address, component name, file extension, and main directory where the component was installed; Step 2: Use Python to read the contents of information table 1 file and generate an Ansible host file based on the IP address and component name; Step 3: Use Ansible to collect the configuration files in the main directory mentioned in Step 1 and save them to Notepad; Step 4: Use a Python program to read the contents of Notepad. Columns containing "d" are folders, and the others are regular files. Store the files directly in a table according to their file extensions. Step 5: Determine whether to perform further recursive queries based on the folder size. If further recursive queries are required, proceed to step 6; otherwise, proceed to step 7. Step 6: Use a Python program to read the contents of Notepad. Columns containing "d" are folders, and the others are regular files. Store the files directly in a table according to their file extensions. Step 7: Exit the collection query and start comparing files; it is not a folder table. Step 8: Read the content information that is the same for each IP address and send it to the backend Python for comparison and processing; Step 9: Store the collected information in a list according to the number of hosts for later processing; Step 10: Use Python to compare the list contents, output the differences and store them in a table.

2. The method according to claim 1, characterized in that, In step 1, if it is a configuration file under the neutron directory, first confirm the component configuration name. The component configuration file will be installed in the / etc / neutron directory, and the server address will be stored in Table 1.

3. The method according to claim 1, characterized in that, In step 2, first read the .xlsx file, then fix the format, define a list, read the cells line by line, add the content read from the cells to the list, and then perform the file writing operation to Notepad.

4. The method according to claim 1, characterized in that, In step 5, a threshold is set. For folders whose size is greater than the threshold, a recursive query is required.

5. The method according to claim 4, characterized in that, In step 5, the threshold is 100.

6. The method according to claim 1, characterized in that, In step 5, a pop-up window will ask if you need to search the folder further.

7. The method according to claim 1, characterized in that, In step 8, Ansible is used to read the same content information for each IP address.

8. The method according to claim 1, characterized in that, In step 9, Python is used to store the collected information into a list for processing according to the number of hosts.

9. The method according to claim 1, characterized in that, In step 10, two notebook files containing the collected content are read, and the difference set is calculated by comparing the lists.

10. A storage medium, characterized in that, It stores a computer program or instructions that, when executed, implement the method as described in any one of claims 1 to 9.