diff --git a/README.md b/README.md index 69b6576..9e0fc75 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ - **日志记录和错误处理**:配备先进的日志系统和错误处理机制。 - **实用功能**:包含搜索、复制、导出等多种功能,并设有忽略列表。 -程序截图: +主窗口截图: ![main screen](https://raw.githubusercontent.com/hxz393/ConfigCenterComparer/main/doc/main_screen.jpg) @@ -23,7 +23,7 @@ ### 操作系统 - **开发环境**:`Windows 10 专业工作站版`,版本 `22H2`。 -- **兼容性**:支持 `Win10 x64` 及更高版本操作系统。不支持 `Win 7` 和 `Win XP`,因为使用了 `Python 3.10`。 +- **兼容性**:支持 `Win 7 x64` 及更高版本操作系统。不支持`Win XP`。支持服务器 `Windows Server 2008` 以上版本。 - **跨平台特性**:由于 QT 跨平台特征,其他操作系统理论上可手动编译成可执行文件。编译指南详见下文。 ### 配置中心 @@ -46,7 +46,7 @@ Nacos 支持 `yaml` 格式的配置。不支持其他格式。 ## 获取程序 -对于 Win10 以上操作系统用户,可以直接下载使用。其他操作系统用户,可尝试通过源码构建可执行程序,或在 Python IDE 中运行。 +在 Windows 平台,已打包两种版本。Win7 下可用版本,在文件名中标注了`-Win7(x64)`,请按需下载。其他操作系统用户,可尝试通过源码构建可执行程序,或在 Python IDE 中运行。 ### 下载地址 @@ -55,11 +55,11 @@ Nacos 支持 `yaml` 格式的配置。不支持其他格式。 - **方式一**:前往 [release](https://github.com/hxz393/ConfigCenterComparer/releases) 页面下载 `ConfigCenterComparer.exe`。 - **方式二**:通过 [百度网盘](https://pan.baidu.com/s/1RK7uBqaqgqJHLJbadXI48g?pwd=6666) 下载 `ConfigCenterComparer.7z` 压缩包,解压后运行。 -下载的压缩包,需要解压缩后运行可执行文件,否则程序配置将无法保存。 +下载的压缩包,需要解压缩后再运行,否则程序配置将无处保存。 ### 自行打包 -手动编译需要事先安装好 `Python 3.10` 以上版本、`PyQT 5.15` 以上版本和 `pyinstaller` 软件包。其他依赖报缺啥装啥。 +手动编译需要事先安装好 `Python 3.7` 以上版本、`PyQT 5.10` 以上版本和 `pyinstaller 5.6` 软件包。其他第三方依赖库有:`PyMySQL`、`PyYAML`、`paramiko`、`requests`、`sshtunnel`,没有版本规定。 编译步骤如下: @@ -94,6 +94,12 @@ Nacos 支持 `yaml` 格式的配置。不支持其他格式。 pyinstaller -F -w -i media/main.ico --add-data 'media/;media' ConfigCenterComparer.py ``` + 如果使用 `Anaconda` 作为虚拟环境,打包时要加上 `-p` 参数,指定虚拟环境所在目录。例如: + + ```sh + pyinstaller -F -w -i media/main.ico --add-data media/;media -p C:\ProgramData\Anaconda3\envs\ccc ConfigCenterComparer.py + ``` + 成功编译后,可执行文件会生成到 `dist` 目录下面。 @@ -157,7 +163,7 @@ Nacos 支持 `yaml` 格式的配置。不支持其他格式。 - **选择语言** - 默认为「English」。更换语言后需重启程序。 + 默认为「English」。选择可切换程序显示语言。 - **选择配置中心类型** @@ -169,7 +175,7 @@ Nacos 支持 `yaml` 格式的配置。不支持其他格式。 - **表格颜色开关** - 如果配置条目数量超过一万条,可以关闭表格颜色展示,可大幅提高运行速度。 + 如果配置条目数量有上万条,可以关闭表格颜色展示,能大幅提高运行速度。 - **替换服务名** @@ -195,7 +201,7 @@ Nacos 支持 `yaml` 格式的配置。不支持其他格式。 Apollo 和 Nacos 的连接配置分别保存在 `config\config_apollo.json` 和 `config\config_nacos.json`。同样,不建议手动修改。 -最多支持 4 套环境配置比对,通过选项卡点击切换。Apollo 和 Nacos 连接需要的配置一样,各配置项说明如下: +最多支持四套环境配置比对,通过选项卡点击切换。Apollo 和 Nacos 连接需要的配置一样,各配置项说明如下: - **启用** @@ -225,13 +231,13 @@ Apollo 和 Nacos 的连接配置分别保存在 `config\config_apollo.json` 和 ## 开始 -点击「测试连接」或「开始运行」按钮后,按钮变为灰色状态。运行完毕会显示弹窗或数据,完成时间由网络速度决定,请耐心等待。 +点击「测试连接」或「开始运行」按钮后,按钮变为灰色状态。运行完毕会显示弹窗或数据,完成时间主要由网络速度决定,请耐心等待。 ### 测试 配置好数据库连接后,可以先进行连通性测试。从工具栏或 「开始」菜单中,点击「测试连接」按钮或选项进行测试: -- 如果连接顺畅,大约 10 秒后会弹窗显示测试通过结果。 +- 如果连接顺畅,大约 10 秒后会弹窗显示 MySQL 和 SSH 连接测试结果。 - 如果有网络或配置问题,导致连接失败,可能需要一段时间才会弹窗显示测试结果。可以在「查看日志」中分析连接失败具体原因。 ### 运行 @@ -242,11 +248,28 @@ Apollo 和 Nacos 的连接配置分别保存在 `config\config_apollo.json` 和 - 如果有个别环境连接失败,将不会在最终结果中展示对应环境配置。可以在「查看日志」中分析连接失败具体原因。 - 如果要获取更新配置,可重新点击「开始运行」来更新表格。程序不会将结果缓存到本地文件中。 +### 查重 + +从数据库获取到数据后,从工具栏或 「开始」菜单中,点击「配置查重」按钮或选项,可以对运行结果进行进一步查重。这个查重功能,对比的是同一环境下重复配置。例如: + +在公共配置中配置过数据库连接池大小,那么在其他应用私有配置中,同样配置数据库连接池大小,且值与公共环境一致,可以认为应用私有配置中存在重复配置。 + +查重功能可以查找出此类配置。查重结果窗口如下图所示: + +![connect settings](https://raw.githubusercontent.com/hxz393/ConfigCenterComparer/main/doc/comparison_results.jpg) + +窗口分为两块: + +- 主要区域为查重结果表格,通过选项卡对不同环境进行区分。出了主窗口中见过的字段,最左侧还有一列数字行号,由分组号码和组内号码组成。 +- 上面有两个输入框,具体作用为: + - 公共配置输入框,用于标记公共配置所在行。输入公共配置名例如 `global` ,点击「设置」后,global 所在的整行会以红色字体显示。 + - 搜索输入框,从配置键或值中搜索内容。没有匹配的行将会被隐藏。搜索字段不区分大小写。 + ## 结果展示 -主界面包含菜单栏、工具栏、过滤栏、主表格和状态栏,下面主要说明主表格。 +主界面从上到下分别为菜单栏、工具栏、过滤栏、主表格和状态栏,下面主要说明主表格。 ### 表头 @@ -264,7 +287,7 @@ Apollo 和 Nacos 的连接配置分别保存在 `config\config_apollo.json` 和 - 不一致:所有不符合以上状态的情况,都归为不一致。 - **忽略**:值为「是」或者「否」。为用户手动设置。 -表头支持拖动排列,点击表头能排序。右键表头可以选择隐藏或显示某列数据。 +表头支持拖动排列,点击表头能排序。表头右键菜单可以选择隐藏或显示某列数据。 ### 颜色 @@ -288,7 +311,7 @@ Apollo 和 Nacos 的连接配置分别保存在 `config\config_apollo.json` 和 ### 快速过滤 -针对「一致性」和「忽略」列的值,进行过滤。在下拉框中选择过滤条件,选中的条件如果匹配某行的值,匹配行会从表格中隐藏。 +针对「一致性」和「忽略」列的值进行过滤。在下拉框中选择过滤条件,选中的条件如果匹配某行的值,匹配行会从表格中隐藏。 如果勾选「反选」框,则表格中只会展示匹配的行。 @@ -338,6 +361,8 @@ Apollo 和 Nacos 的连接配置分别保存在 `config\config_apollo.json` 和 左下角「清空」按钮,点击会清空日志文件内容。日志文件存放在 `logs` 目录内,超过 1MB 大小会回滚,最多保留十个文件。 +右下角「刷新」按钮,点击可以切换日志持续显示模式,方便监控日志。 + ### 检查更新 从「帮助」菜单选择「检查更新」,将会在线检查程序是否有更新版本。以弹窗告知检查结果。 @@ -346,6 +371,10 @@ Apollo 和 Nacos 的连接配置分别保存在 `config\config_apollo.json` 和 从「帮助」菜单选择「关于软件」,弹出程序说明和构建信息。 +### 调试程序 + +开发调试代码使用,对用户没有实际作用。 + # 常见问题 @@ -358,6 +387,20 @@ Apollo 和 Nacos 的连接配置分别保存在 `config\config_apollo.json` 和 为避免更新日志过长,只保留最近更新日志。 +## 版本 1.1.0(2023.11.28) + +新增内容: + +1. 新增配置查重功能; +2. 日志查看窗口新增刷新按钮。 + +优化内容: + +1. 修改语言管理类,切换语言立即生效,不再需要重启; +2. 修改配置管理类,减少对配置文件读取次数; +3. 修改日志查看窗口显示模式,可独立主窗口运行; +4. 修改代码以向下支持到 Python 3.7,并提供 Win 7 下可用版本。 + ## 版本 1.0.2(2023.11.21) 新增内容: diff --git a/doc/README_EN.md b/doc/README_EN.md index c876544..667656e 100644 --- a/doc/README_EN.md +++ b/doc/README_EN.md @@ -1,90 +1,92 @@ # [English](https://github.com/hxz393/ConfigCenterComparer/blob/main/doc/README_EN.md) | [中文](https://github.com/hxz393/ConfigCenterComparer/blob/main/README.md) -# Program Introduction +# Introduction -`ConfigCenterComparer` is a configuration center comparison tool. Its primary function is to compare configuration data across different configuration centers, ensuring consistency and accuracy of configurations across environments. +`ConfigCenterComparer` is a configuration center comparison tool. Its primary function is to compare configuration data across different configuration centers, ensuring consistency and accuracy of configurations between environments. -Main Features: +Key Features: -- **Supports Multiple Configuration Centers**: Compatible with mainstream `Apollo` and `Nacos` configuration centers. Implements cross-cluster data retrieval. -- **Data Formatting and Comparison**: Provides a graphical interface for convenient data formatting and comparison. -- **Database Integration**: Integrates MySQL database query module, supporting SSH tunnel connections. -- **Log Recording and Error Handling**: Equipped with an advanced log system and error handling mechanism. -- **Practical Functions**: Includes various features such as search, copy, export, and an skip list. +- **Support for Multiple Configuration Centers**: Compatible with mainstream configuration centers such as `Apollo` and `Nacos`, allowing for cross-cluster data retrieval. +- **Data Formatting and Comparison**: Provides a graphical user interface for easy data formatting and comparison. +- **Database Integration**: Integrates with MySQL database querying module, supporting SSH tunnel connections. +- **Log Recording and Error Handling**: Equipped with an advanced logging system and error handling mechanisms. +- **Practical Utilities**: Includes various features like search, copy, export, and more. + +Screenshot: ![main screen](https://raw.githubusercontent.com/hxz393/ConfigCenterComparer/main/doc/main_screen_en.jpg) -## Requirements +## Usage Requirements -The following use case descriptions apply, unless explicitly stated as unsupported, and results should be tested independently. +The following usage scenarios are described for your reference. Unless explicitly stated as unsupported, results should be tested independently. ### Operating Systems - **Development Environment**: `Windows 10 Professional Workstation Edition`, version `22H2`. -- **Compatibility**: Supports `Win10 x64` and higher versions of the operating system. Does not support `Win 7` and `Win XP`, due to the use of `Python 3.10`. -- **Cross-Platform Features**: Thanks to QT's cross-platform characteristics, it is theoretically possible to manually compile the software into executable files for other operating systems. Compilation guide is detailed below. +- **Compatibility**: Supports `Win 7 x64` and higher versions of operating systems. Does not support `Win XP`. Also compatible with `Windows Server 2008` and above. +- **Cross-Platform Features**: Due to QT's cross-platform characteristics, it's theoretically possible to manually compile executables for other operating systems. See the following sections for compilation guidelines. ### Configuration Centers Nacos supports configurations in `yaml` format. Other formats are not supported. -Tested configuration centers and versions: +Tested configuration centers and their versions: - **Apollo**: `2.0.x`, `2.1.x` - **Nacos**: `v2.1.x` -Other versions have not been tested. Database structure differences may lead to query failures. Feedback on related issues is welcome. +Other versions have not been tested. Differences in database structure may lead to query failures. Feedback on related issues is welcome. ### Database -- **Tested Version**: MySQL `5.7`. Theoretically, `8.x` should also be supported. -- **Case Sensitivity**: The database configuration should be set to case-insensitive. Apollo's database query SQL uses camel case and ignores case sensitivity settings. Compatibility with Nacos database configuration is pending verification, and feedback is welcome. +- **Tested Version**: MySQL `5.7`. In theory, `8.x` should also be supported. +- **Case Sensitivity**: Database configurations should disable case sensitivity. Apollo's database query SQL uses camel case and disregards case sensitivity settings. The compatibility of Nacos' database configuration remains to be verified, and feedback is welcome. ## Getting the Program -For users of Win10 and above, the program can be directly downloaded and used. Users of other operating systems can try to build an executable from the source code, or run it in a Python IDE. +On the Windows platform, two versions have been packaged. For Windows 7, the compatible version is marked with `-Win7(x64)` in the file name, which can be downloaded as needed. Users of other operating systems can try building the executable from the source code or run it in a Python IDE. -### Download Address +### Download Links -Methods to download the software: +Ways to download the software: -- **Method 1**: Go to the [release](https://github.com/hxz393/ConfigCenterComparer/releases) page and download `ConfigCenterComparer.exe`. +- **Method 1**: Visit the [release](https://github.com/hxz393/ConfigCenterComparer/releases) page to download `ConfigCenterComparer.exe`. - **Method 2**: [Direct link](https://www.x2b.net/download/ConfigCenterComparer.7z) download. -The downloaded compressed file needs to be extracted before running the executable file, otherwise, the program configuration will not be saved. +The downloaded compressed file needs to be extracted before running; otherwise, the program's configuration will have nowhere to be saved. ### Manual Packaging -Manual compilation requires prior installation of `Python 3.10` or above, `PyQT 5.15` or above, and the `pyinstaller` package. Install other dependencies as they are reported missing. +Manual compilation requires prior installation of `Python 3.7` or higher, `PyQT 5.10` or higher, and the `pyinstaller 5.6` package. Other third-party dependencies include `PyMySQL`, `PyYAML`, `paramiko`, `requests`, `sshtunnel`, with no specific version requirements. -Compilation steps are as follows: +The compilation steps are as follows: -1. Clone the project on a system with `Git` installed. Use the following command: +1. Clone the project on a system with `Git` installed. Use the command: ```sh git clone https://github.com/hxz393/ConfigCenterComparer.git ``` - Or, on the [project homepage](https://github.com/hxz393/ConfigCenterComparer), click the green `<> Code` button and choose the `Download ZIP` option to [download](https://github.com/hxz393/ConfigCenterComparer/archive/refs/heads/main.zip) the source code zip file. After downloading, use compression software or command tools to extract it. + Alternatively, click the green `<> Code` button on the [project homepage](https://github.com/hxz393/ConfigCenterComparer) and select the `Download ZIP` option to [download](https://github.com/hxz393/ConfigCenterComparer/archive/refs/heads/main.zip) the source code zip file. After downloading, extract the contents using a compression tool or command. -2. Use the command to switch to the project path. +2. Switch to the project path using a command. - For example, in Windows, open the `CMD` command prompt and enter: + For example, in Windows, open the `CMD` prompt and enter: ```sh cd B:\git\ConfigCenterComparer B: ``` - In Linux, use the `cd` command to switch to the project path: + In Linux, use the `cd` command to navigate to the project path: ```sh cd /root/ConfigCenterComparer ``` - If using `PyCharm` as an IDE, you can directly enter the following packaging command in the built-in terminal. + If using `PyCharm` as an IDE, you can directly enter the packaging command in the built-in terminal. 3. Use the `pyinstaller` command to compile and package into an executable file: @@ -92,109 +94,123 @@ Compilation steps are as follows: pyinstaller -F -w -i media/main.ico --add-data 'media/;media' ConfigCenterComparer.py ``` + If using `Anaconda` as a virtual environment, add the `-p` parameter when packaging to specify the directory of the virtual environment. For example: + + ```sh + pyinstaller -F -w -i media/main.ico --add-data media/;media -p C:\ProgramData\Anaconda3\envs\ccc ConfigCenterComparer.py + ``` + After successful compilation, the executable file will be generated in the `dist` directory. ## Development Related -Below is information related to development. +Below is information related to the development of the program. ### Program Principles -The main workflow of this program is as follows: +The main workflow of the program is as follows: + +1. By querying Apollo's database tables `app`, `namespace`, and `item`, it retrieves data for fields `AppId` (or `Name`), `NamespaceName`, `Key`, `Value`, and `DataChange_LastTime`. + + For Nacos databases, it queries the `config_info` table for fields `data_id`, `group_id`, `content`, and `gmt_modified`. Then, it parses and splits the `yaml` format content in the `content` field into multiple configuration entries. + +2. For each configuration entry, it combines the name, group, and key name as a unique index and merges the configuration values and modification times from different environments into the result dictionary. -1. By querying Apollo's database `app`, `namespace`, and `item` tables, it retrieves data for fields `AppId` (or `Name`), `NamespaceName`, `Key`, `Value`, and `DataChange_LastTime`. - For the Nacos database, it queries the `config_info` table for fields `data_id`, `group_id`, `content`, and `gmt_modified`. Then, it parses the `yaml` formatted content in the `content` field into multiple configurations. -2. For each configuration, it combines the name, group, and key as a unique index and merges the configuration values and modification times from different environments into the result dictionary. -3. It compares the values of different configuration environments, obtains consistency information, and updates the result dictionary. -4. By comparing against a filter list, it determines whether to filter and updates the result dictionary. -5. Inserts all results into the main window table. -6. Applies filters to color table rows or cells and performs other display optimization actions. +3. It compares the values across different configuration environments to determine consistency and updates this information in the result dictionary. -If an error occurs during program execution, as long as it does not affect the operation, there will be no popup notifications, but an "Error occurred" message will be displayed in the status bar label at the bottom right. Logs can be checked for program bugs or other issues. +4. The program checks against a filter list to determine if certain entries should be filtered out and updates this information in the result dictionary. -### Module Description +5. All results are inserted into the main window table. -The project structure is as follows: +6. Filters are applied to color-code table rows or cells and perform other display optimization actions. + +If an error occurs during the program's operation, as long as it doesn't affect the functioning, no popup message will appear. However, an "Error Occurred" notice will be displayed in the status bar label at the bottom right. You can check the logs for potential program bugs or other issues. + +### Module Descriptions + +The project structure is outlined as follows: - `ConfigCenterComparer.py`: The main program. - `config/`: Configuration folder, containing language dictionaries and global variables. -- `lib/`: Utility library, containing general functions such as file handling, database querying, etc. -- `media/`: Media folder, storing icons, etc. -- `module/`: Contains modules related to project functions, such as querying configuration paths, executing queries, and formatting results. +- `lib/`: A utility library storing common functions, including file handling, database queries, etc. +- `media/`: Media folder, storing icons and other media files. +- `module/`: Contains modules related to project-specific functions, such as querying configuration paths, executing queries, and formatting results. - `ui/`: Modules related to UI definition and operations. ### Language Translation -Due to the small amount of program text, a language dictionary is used to store all display texts. The file path is: `config\lang_dict_all.py`, where other language translations can be added. +Given the minimal amount of program text, a language dictionary is used to store all display texts. The file path is: `config\lang_dict_all.py`. Additional language translations can be added in this file. ### Open Source License -Follows the [GPL-3.0 license](https://github.com/hxz393/ConfigCenterComparer/blob/main/LICENSE). Violations of the open source community guidelines will be subject to legal action. +This project adheres to the [GPL-3.0 license](https://github.com/hxz393/ConfigCenterComparer/blob/main/LICENSE). Violations of the open-source community guidelines will result in legal action. -# Program Usage +# Usage Before using `ConfigCenterComparer`, please read this section carefully. ## Settings -On first use, you need to enter the settings page for configuration. +Initial configuration is required upon first use. ### Program Settings -In the toolbar or the "Options" menu, select "Program Settings" to enter the settings interface, as shown in the image below: +In the toolbar or under the 'Options' menu, select 'Program Settings' to enter the settings interface, as shown in the following image: ![main settings](https://raw.githubusercontent.com/hxz393/ConfigCenterComparer/main/doc/main_settings_en.jpg) The configuration file is located at `config\config_main.json`. Do not modify it manually to avoid errors. If the configuration file is corrupted, it can be deleted and regenerated. -The explanations for each configuration item are as follows: +Descriptions of various configuration items are as follows: - **Select Language** - Default is "English". The program needs to be restarted after changing the language. + The default is 'English'. Select to switch the display language of the program. - **Select Configuration Center Type** - Choose between "Apollo" or "Nacos". Reads different connection configuration files based on the selection. + Options include 'Apollo' or 'Nacos'. Based on the selection, the program reads different connection configuration files. - **Select Apollo Service Name Field** - Effective when the configuration center type is set to "Apollo". It sets which database field to use as the service name display field. Dropdown options "AppId" and "Name" correspond to the "AppId" and "Application Name" in Apollo's "Application Information". + Effective when the configuration center type is set to 'Apollo'. It sets which database field is displayed as the service name. Dropdown options 'AppId' and 'Name' correspond to 'AppId' and 'Application Name' in Apollo's 'Application Information'. - **Table Color Switch** - If the number of configuration entries exceeds ten thousand, you can turn off the display of table colors to significantly improve execution speed. + If there are tens of thousands of configuration entries, you can turn off the table color display to significantly improve running speed. - **Replace Service Name** - - Enter the "original name" and "new name" in the input box to completely replace the service name. This is usually used for aligning service names across different environments. For example, if the AppId in the development environment is "1025" and the AppId in other environments is "api-web", replacing 1025 with api-web allows for comparing configurations of api-web in the program. - - Multiple sets of service name replacements can be set, separated by spaces. The number of fields in the "original name" and "new name" must be the same, and their content must correspond; otherwise, excess fields will be truncated. Replacement operation is performed only once for each service name. - - Replacement occurs only if there is an exact match of the service name. In the example above, 1025 will not match service names like "10258" or "api-1025". Full names must be entered for replacement. - - Service name replacement is performed after trimming the service name. Please pay attention to the order. + - Enter 'Original Name' and 'New Name' in the input box to fully replace the service name. This is commonly used for aligning service names in different environments. For instance, if the AppId in the development environment is '1025', and in other environments, it's named 'api-web', replacing 1025 with api-web allows for the comparison of configurations for 'api-web' in the program. + - Multiple sets of service name replacements can be configured, with each set separated by a space. The number of fields in 'Original Name' and 'New Name' must match, and the contents must correspond; otherwise, the excess fields will be truncated. Each service name undergoes replacement only once. + - Replacement occurs only when there's an exact match of the service name. In the above example, 1025 will not match service names like '10258' or 'api-1025'. Full names are required for replacements. + - Service name replacement is carried out after trimming service names, so be aware of the sequence. - **Trim Service Name** - - Removes prefixes or suffixes from the service name. Similar to replacing the service name, it is used for aligning service names. Prefixes match from the beginning of the service name, and suffixes match from the end of the service name. If matched, the matched text is removed from the service name. For example, if the suffix trim is set to ".yaml", then all service names like "api-web.yaml" will be replaced with "api-web". - - Multiple sets of trimming fields can be set, separated by spaces. Each service name undergoes prefix and suffix trimming only once; if matched, no further checks are conducted. For example, if the prefix trim is set to "pc-" and the suffix trim is set to ".yaml -web", then the service name "pc-api-web.yaml" can be trimmed at most to "api-web". - - Both service name trimming and replacement operations are case-sensitive. + - Removes prefixes or suffixes from the service name. Similar to replacing service names, this is used for aligning service names. The prefix is matched from the start of the service name, and the suffix from the end. If matched, the corresponding text is deleted from the service name. For example, if the suffix to be trimmed is '.yaml', then service names like 'api-web.yaml' will be replaced with 'api-web'. + - Multiple sets of trimming fields can be configured, with each set separated by space. Each service name undergoes prefix and suffix trimming only once; if a match is found, subsequent checks are not performed. For example, if the prefix to be trimmed is 'pc-' and the suffix is '.yaml -web', then the service name 'pc-api-web.yaml' can be trimmed to a maximum of 'api-web'. + - Both service name trimming and replacement are case-sensitive. ### Connection Settings -After configuring the main settings, you also need to configure the database. From the toolbar or "Options" menu, click the "Connection Settings" button or option to enter the database configuration window, as shown in the image below: +After configuring the main settings, it is necessary to set up the database. From the toolbar or the "Options" menu, click on the "Connection Settings" button or option to enter the database configuration window, as shown in the image: ![connect settings](https://raw.githubusercontent.com/hxz393/ConfigCenterComparer/main/doc/connect_settings_en.jpg) -The connection configurations for Apollo and Nacos are saved in `config\config_apollo.json` and `config\config_nacos.json`, respectively. Again, it is not recommended to modify these files manually. -Up to four sets of environment configurations can be compared, switchable through tabs. The required configurations for Apollo and Nacos connections are the same, and each configuration item is explained as follows: + +The connection settings for Apollo and Nacos are separately stored in `config\config_apollo.json` and `config\config_nacos.json`. It is advised not to modify these manually. + +Up to four sets of environment configurations can be compared, which can be switched between using tabs. The configuration requirements for connecting to Apollo and Nacos are the same, and the details of each configuration item are as follows: - **Enable** - Only after checking the "Enable" option in the "MySQL Connection Configuration" will the current environment be included in the configuration comparison. If you need to connect to the database through an SSH tunnel, check the "Enable" option in the "SSH Tunnel Configuration" and fill in the relevant parameters. + By checking the "Enable" option in the "MySQL Connection Configuration", the current environment is included in the configuration comparison. If you need to connect to the database via an SSH tunnel, check the "Enable" option in the "SSH Tunnel Configuration" and enter the relevant parameters. - **Address** @@ -206,7 +222,7 @@ Up to four sets of environment configurations can be compared, switchable throug - **Username** - Enter a username with connection permissions. For example: "apollo" or "root". + Enter the username that has connection permissions. For example: "apollo" or "root". - **Password** @@ -218,74 +234,91 @@ Up to four sets of environment configurations can be compared, switchable throug -## Starting +## Getting Started -After clicking the "Test" or "Run" button, the button becomes greyed out. A popup or data will display once the operation is complete. The completion time depends on the network speed, so please be patient. +After clicking the "Test" or "Run" buttons, they will turn grey. A pop-up window or data will be displayed upon completion of the operation. The completion time mainly depends on the network speed, so please be patient. ### Testing -After configuring the database connection, you can perform a connectivity test first. From the toolbar or the "Start" menu, click the "Test" button or option to conduct the test: +After configuring the database connection, you can perform a connectivity test. From the toolbar or the "Start" menu, click on the "Test" button or option to start the test: -- If the connection is smooth, a popup indicating a successful test result will appear after about 10 seconds. -- If there are network or configuration issues causing a connection failure, it may take some time before a popup displays the test result. You can analyze the specific reasons for the connection failure in "View Logs". +- If the connection is smooth, a pop-up window displaying the MySQL and SSH connection test results will appear in about 10 seconds. +- If there are network or configuration issues causing the connection to fail, it may take some time before the test results are displayed in a pop-up window. The specific reasons for the connection failure can be analyzed in the "View Logs" section. ### Running -Once all configurations are complete, from the toolbar or the "Start" menu, click the "Run" button or option to start retrieving data from the database: +Once all configurations are complete, click the "Run" button or option from the toolbar or "Start" menu to begin retrieving data from the database: + +- If everything goes well, the main window form will display all the data pulled from the database. +- If the connection fails in some environments, the corresponding environment configurations will not be displayed in the final results. The specific reasons for the connection failure can be analyzed in the "View Logs" section. +- To retrieve updated configurations, you can click "Run" again to refresh the table. The program does not cache the results to local files. + +### Compare -- If everything goes well, the main window form will display all the data retrieved from the database. -- If the connection fails in some environments, the configurations for those environments will not be displayed in the final results. You can analyze the specific reasons for the connection failure in "View Logs". -- To retrieve updated configurations, you can click "Run" again to refresh the table. The program does not cache results to a local file. +After retrieving data from the database, you can perform a further duplication check by clicking on the "Compare" button or option from the toolbar or "Start" menu. This feature compares duplicate configurations within the same environment. For example: + +If the database connection pool size is configured in the public namespace, and the same setting with the same value is configured in the private namespace of another application, it can be considered a duplicate configuration in the private settings. + +The compare feature can identify such configurations. The results window for the duplication check is shown in the following image: + +![connect settings](https://raw.githubusercontent.com/hxz393/ConfigCenterComparer/main/doc/comparison_results_en.jpg) + +The window is divided into two parts: + +- The main area is the duplication check results table, differentiated by tabs for different environments. Besides the fields seen in the main window, there is a column of numbers on the far left, consisting of group numbers and internal group numbers. +- Above are two input boxes, whose specific functions are: + - Public Namespace Input Box, for marking the line where the public configuration is located. For example, entering `global` and clicking "Set" will display the entire line where `global` is located in red font. + - Search Configuration Input Box, for searching content within configuration keys or values. Rows with no matching content will be hidden. The search field is case-insensitive. ## Result Display -The main interface includes a menu bar, toolbar, filter bar, main table, and status bar. The main table is described in detail below. +The main interface is divided from top to bottom into the menu bar, toolbar, filter bar, main table, and status bar. The focus here is on the main table. ### Table Header -The table header is divided into the following items: +The table header consists of the following items: -- **Name**: The service name, in Apollo it's "AppId" or "Application Name". In Nacos, there is only one field, "Data Id". -- **Group**: In Apollo, it's the "Namespace", usually the private namespace is called "application". In Nacos, the field is "Group". -- **Key**: In Apollo, it's "Key". In Nacos, it's extracted from "Configuration Content", formatted the same as in Apollo. -- **Value**: By default, divided into four columns for different environments, with the environment names as headers. In Apollo, it's "Value". In Nacos, it's extracted from "Configuration Content". -- **Modified Time**: By default hidden. Divided into four columns for different environments, indicating the last modification time of the configuration in the corresponding environment. -- **Consistency**: Divided into four statuses. - - Fully Consistent: Indicates that all environment configuration values are exactly the same. Requires at least two comparison environments. - - Partially Consistent: The production environment and preview environment values are equal, but differ from values in other environments. - - Unknown Status: Only a single environment has a configuration value. Other environments may not have a configuration, or the value retrieval may have failed. - - Inconsistent: All cases that do not fit the above statuses are classified as inconsistent. -- **Skip**: The value is either "Yes" or "No". Set manually by the user. +- **Name**: This refers to the service name. In Apollo, it is known as "AppId" or "Application Name". In Nacos, it is represented by a single field called "Data Id". +- **Group**: In Apollo, this is the "Namespace", usually the private namespace is called "application". In Nacos, the equivalent field is "Group". +- **Key**: In Apollo, this is referred to as "Key". In Nacos, it is extracted from "Configuration Content" and follows the same format as in Apollo. +- **Value**: By default, this is divided into four columns for different environments, with the headers being the names of the environments. In Apollo, it is "Value". In Nacos, it is extracted from "Configuration Content". +- **Modified Time**: This is hidden by default. It is divided into four columns for different environments, representing the last modification time of the corresponding environment configuration. +- **Consistency**: This is divided into four statuses. + - Fully Consistent: Indicates that all environment configuration values are exactly the same. Requires at least two environments for comparison. + - Partially Consistent: The values in the production environment and the preview environment are equal, but different from other environments. + - Unknown Status: Only a single environment has a value. Other environments may not have a configuration or the value retrieval may have failed. + - Inconsistent: All situations that do not meet the above statuses are considered inconsistent. +- **Skip**: The value can be either "Yes" or "No". This is set manually by the user. -The table header supports drag-and-drop arrangement, and clicking on the header can sort the table. Right-clicking on the header allows you to choose to hide or show certain columns. +The table header supports drag-and-drop arrangement, and clicking on the header can sort the table. The right-click context menu on the header allows you to hide or show certain columns. ### Colors -After retrieving the configuration data, the main window form will display each configuration status in different colors. Their meanings are as follows: +Once the configuration data is retrieved, the main window form displays each configuration status in different colors, which signify the following: -- Gray: In the skip list, with the skip value set to "Yes". -- Green: Consistency value is "Fully Consistent". -- Blue: Consistency value is "Partially Consistent". -- Red: Cells where the configuration is missing or the configuration value was not retrieved. -- White: Default state. +- Grey: Included in the skip list, where the skip value is "Yes". +- Green: The consistency value is "Fully Consistent". +- Blue: The consistency value is "Partially Consistent". +- Red: Cells that either have no configuration or failed to retrieve the configuration value. +- White: The default state. -## Filtering Operations +## Filter Operations -The filter bar is divided into three parts: filter by name, quick filter, and global search. These three methods can be used in combination to quickly find and compare configurations. +The filter bar is divided into three parts: filter service, quick filter, and global search. These methods can be combined to quickly find and compare configurations. ### Filter Name -Select a service name from the dropdown menu, and the table will display configurations only for the selected service. The default setting shows all configurations. +Select a service name from the dropdown box, and the table will display only the configurations of the selected service. By default, all configurations are displayed. ### Quick Filter -Filters based on the values in the "Consistency" and "Skip" columns. Select a filtering condition from the dropdown menu. If the selected condition matches the value in a row, that row will be hidden from the table. +This applies to the "Consistency" and "Skip" columns. Select a filtering condition from the dropdown box. If the selected condition matches the value of a row, that row will be hidden from the table. -If the "Invert" box is checked, the table will only display the rows that match the condition. +If the "Invert" box is checked, then only the rows matching the selected condition will be displayed in the table. ### Global Search @@ -293,33 +326,33 @@ Enter the search content in the input box and click the search button to perform ### Reset Conditions -Click the reset button next to the search button to reset all filtering conditions and clear the search input box, displaying the full table content. +By clicking the reset button next to the search button, all filter conditions will be reset, clearing the content in the search input box, and the full table content will be displayed. ## Editing Operations -The program does not modify the original configurations. The skip list is stored in the local file `config\config_skip.txt`. +The program does not modify any original configurations. The skip list is stored in the local file `config\config_skip.txt`. ### Copy Content -Click or drag a cell with the mouse. In the right-click context menu or the toolbar, select "Copy" to copy the selected data to the system clipboard. +Click or drag a cell with the mouse, then select "Copy" from the right-click context menu or the toolbar. The selected data will be copied to the system clipboard. ### Export List -Export the data currently displayed in the table to a file. From the "Edit" menu bar or the table's right-click menu, select "Export". In the file save window, choose the export format. Supports `JSON` or `CSV` formats. Click save to export. +Export the data displayed in the current table to a file. From the "Edit" menu bar or the right-click context menu on the table, select "Export". In the file save window, choose the export format. It supports `JSON` or `CSV` formats. Click save to export the data. ### Ignore Operation -Users can customize which configuration rows to ignore. Click or drag a cell with the mouse, and in the right-click context menu or the toolbar, select "Skip". The configuration row will be marked as ignored. The quick filter can then be applied to hide the ignored configuration rows. +Users can customize which configuration rows to ignore. Click or drag a cell with the mouse, then select "Skip" from the right-click context menu or the toolbar. The configuration row will be marked as ignored. Afterwards, quick filter can be applied to hide the ignored configuration rows. -To undo the ignore operation, similarly select "Unskip". The configuration row will be removed from the skip list. +To undo the ignore operation, select "Unskip", and the configuration row will be removed from the filter list. ## Help Operations -This includes viewing logs, checking for program updates, and viewing program information. +This includes viewing logs, checking for new versions of the program, and viewing program information. ### View Logs @@ -327,51 +360,73 @@ Select "View Logs" from the "Help" menu or quick toolbar to open the log viewing ![view logs](https://raw.githubusercontent.com/hxz393/ConfigCenterComparer/main/doc/view_logs_en.jpg) -The dropdown box in the upper left corner allows you to select the log level to display. For example, if you select "WARNING", only logs of the WARNING level and above will be displayed, and INFO level log messages will be filtered out. +In the top-left dropdown box, you can select the log level you wish to display. For example, if you choose "WARNING", only logs of WARNING level and above will be displayed, and INFO level logs will be filtered out. + +The "Feedback" button in the bottom left corner, when clicked, will redirect to the GitHub project's Issues page, making it easy to submit error reports. -The "Feedback" button in the lower left corner, when clicked, redirects to the GitHub project Issues page for easy submission of error information. +The "Clear" button in the bottom left corner, when clicked, will clear the contents of the log file. Log files are stored in the `logs` directory. If a file exceeds 1MB, it will roll over, with a maximum of ten files being retained. -The "Clear" button in the lower left corner, when clicked, clears the content of the log file. The log files are stored in the `logs` directory. They roll over after reaching 1MB in size, with a maximum of ten files kept. +The "Refresh" button in the bottom right corner can be clicked to switch the log display to continuous mode, which is convenient for monitoring logs. ### Check for Updates -Select "Check Updates" from the "Help" menu to check online for program updates. A popup will inform you of the results. +Select "Check Updates" from the "Help" menu to check online if there is an updated version of the program available. The result of the check will be notified via a pop-up window. + +### About Program + +Select "About" from the "Help" menu to display a pop-up with program explanations and build information. -### About Software +### Debugging the Program -Select "About" from the "Help" menu to pop up the program description and build information. +This is used for development and debugging code and is not of practical use to users. -# Common Issues +# FAQ -When encountering errors in software operation, first check the logs. If it's a connection issue, please check the configuration and retry. Then refer to the solutions for common issues below. Finally, check all [Issues](https://github.com/hxz393/ConfigCenterComparer/issues) to see if the same problem exists. For further assistance, you can submit a new [Issue](https://github.com/hxz393/ConfigCenterComparer/issues) and include relevant logs. +When encountering errors during software operation, first check the logs. If the issue is related to connectivity, please verify your configurations and try again. Then, refer to the solutions for common problems listed below. Lastly, check all [Issues](https://github.com/hxz393/ConfigCenterComparer/issues) to see if the same problem exists. If further help is needed, submit a new Issue and attach the relevant logs. # Update Log -To avoid an overly lengthy update log, only the most recent updates are retained. +To avoid an excessively long update log, only the most recent updates are retained. + +## Version 1.1.0 (2023.11.28) + +New Features: + +1. Added configuration duplication check feature; +2. Refresh button added to the log viewing window. + +Enhancements: + +1. Modified the language management class for immediate effect upon language switch, eliminating the need to restart; +2. Changed configuration management class to reduce the number of reads from the configuration file; +3. Updated the log viewing window display mode to operate independently of the main window; +4. Adjusted the code to support down to Python 3.7 and provided a version compatible with Windows 7. + + ## Version 1.0.2 (2023.11.21) -Features: +New Features: -1. Added a table color switch to address performance degradation due to large data volumes. +1. Added a table color switch to address performance issues due to large data volumes. -Updates: +Fixes: -1. Modified color application logic to improve execution speed; +1. Modified color application logic to improve performance; 2. Optimized main thread code to enhance UI stability. ## Version 1.0.1 (2023.11.19) -Updates: +Fixes: -1. Clear filter bar conditions before starting the run to prevent the interface from freezing when running again; -2. Optimize the text displayed in logs. +1. Cleared filter bar conditions before starting to run, preventing interface freezing on subsequent runs; +2. Improved log display text. diff --git a/doc/view_logs.jpg b/doc/view_logs.jpg index 6c497c8..c6af5d3 100644 Binary files a/doc/view_logs.jpg and b/doc/view_logs.jpg differ diff --git a/doc/view_logs_en.jpg b/doc/view_logs_en.jpg index 3e490a8..cad93d0 100644 Binary files a/doc/view_logs_en.jpg and b/doc/view_logs_en.jpg differ