This is a widget designed for openGauss Database inspection Tool!
Project description
Grz - openGauss 自动巡检工具
项目概述
Grz 是专为 openGauss 数据库开发的自动巡检工具,旨在简化和优化数据库的监控与管理操作。该工具参考了 Oracle 的 Orz 工具和达梦数据库的 Drz 工具,帮助用户通过简单的命令获取数据库的健康状况和性能指标。
Grz 工具能够将用户输入的简单命令自动转换为底层复杂操作,如通过输入 grz status 获取数据库状态。此外,Grz 支持生成 HTML 格式的巡检报告,便于管理员对数据库状态和性能指标进行综合分析。
功能模块
Grz 工具采用模块化设计,包含以下主要模块:
- 命令采集模块:收集并验证用户输入的指令。
- 命令解析模块:将简单命令映射为底层复杂操作。
- 命令执行模块:使用 subprocess 模块执行解析后的复杂命令。
- 错误处理模块:确保在执行过程中捕获并记录所有错误信息。
安装指南
环境要求
- Python 3.6+
- openGauss 企业版数据库环境
- 必需的 Python 库:
argparse,subprocess,logging
安装步骤
-
确保openGauss 企业版数据库环境正确
-
克隆或下载本项目代码:
git clone https://gitee.com/cndba/orz
or
pip install grz
使用方法
1. 常见命令操作
| 命令 | 描述 |
|---|---|
grz help |
显示所有命令的帮助信息 |
grz start |
启动 openGauss |
grz stop |
停止 openGauss |
grz restart |
重启 openGauss |
grz status |
查看 openGauss 状态 |
grz generateconf |
生成配置文件 |
grz check |
检查 openGauss 整体健康状态 |
grz checkos <optional> |
检查操作系统参数 |
grz checkperf |
检查数据库性能 |
grz wdr <file_path> |
生成 WDR 报告 |
grz collect <start_time> <end_time> |
收集数据库运行日志 |
2. 使用示例
以下为一些常用操作命令示例:
-
启动 openGauss:
grz start -
查看数据库状态:
grz status -
生成 WDR 报告:
grz wdr /file_path
-
收集运行日志:
grz collect "20240818 01:01" "20240818 23:59"
3. 帮助信息
可以help 参数查看帮助信息:
grz help
输出:
❯ grz help
Available commands:
start - Start the openGauss database
stop - Stop the openGauss database
restart - Restart the openGauss database
----------------------------------------------------------------------------
status - Show detailed status of the database cluster
generateconf - Generate and distribute configuration files
check - Check cluster state with specified option
checkos - Check operating system compatibility
checkperf - Check system performance
----------------------------------------------------------------------------
wdr - Generate WDR performance report (requires --file_path)
collect - Collect diagnostic logs (requires --start_time, --end_time)
help - Show this help message
代码结构
grz
├── LICENSE.html
├── README.md
├── dist
│ ├── grz-1.3.0-py3-none-any.whl
│ └── grz-1.3.0.tar.gz
├── pyproject.toml
├── setup.py
├── src
│ ├── grz
│ │ ├── CommandCollector
│ │ │ ├── Collector.py
│ │ │ ├── __init__.py
│ │ │ └── __pycache__
│ │ │ ├── Collector.cpython-310.pyc
│ │ │ └── __init__.cpython-310.pyc
│ │ ├── CommandParser
│ │ │ ├── Parser.py
│ │ │ ├── __init__.py
│ │ │ └── __pycache__
│ │ │ ├── Parser.cpython-310.pyc
│ │ │ └── __init__.cpython-310.pyc
│ │ ├── ErrorHandler
│ │ │ ├── Handler.py
│ │ │ ├── __init__.py
│ │ │ └── __pycache__
│ │ │ ├── Handler.cpython-310.pyc
│ │ │ └── __init__.cpython-310.pyc
│ │ └── grz.py
│ └── grz.egg-info
│ ├── PKG-INFO
│ ├── SOURCES.txt
│ ├── dependency_links.txt
│ ├── entry_points.txt
│ └── top_level.txt
└── tests
12 directories, 24 files
错误处理
Grz 工具内置错误处理模块,能够在执行过程中捕获并记录所有错误信息,包括缺失参数、无效命令等。日志文件保存在项目根目录下,便于用户进行后续的审计和问题排查。
未来开发
Grz 工具后续计划包括:
- 增加命令支持:涵盖更多数据库监控、备份和恢复功能。
- 增强错误处理:增加自动恢复机制,减少手动干预。
- 性能优化:优化工具执行效率,降低资源消耗。
贡献
如果您有任何建议或改进意见,欢迎提交 Issue 或 Pull Request。您的贡献将帮助 Grz 工具更好地服务 openGauss 社区。
许可证
本项目使用 Mulan PSL v2 许可证 - 有关详细信息,请参见 LICENSE 文件。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grz-1.2.0.tar.gz.
File metadata
- Download URL: grz-1.2.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7174853e32167d7d8eba7d9f051e561b45b90896f068fb51f6a27a834f4d6e39
|
|
| MD5 |
46d28737d099803bc0d36f377ffd6481
|
|
| BLAKE2b-256 |
aefb872f22907b7cd0c2c9f7de1611db01103b5255a4cf3648fb363a9d1c64b1
|
File details
Details for the file grz-1.2.0-py3-none-any.whl.
File metadata
- Download URL: grz-1.2.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6baf5d14569968c9a1fdd0e6e4d678e33dbb1b8cee7219e3b98cd02ef9e16d37
|
|
| MD5 |
f3b09898aa0faaa83a5e6037943ee74f
|
|
| BLAKE2b-256 |
0891d31421b21b0d815affdc381b5016c8fb9013099b81294b55b92df9a16132
|