TiDB 系统参数对比工具
作者:TiDB 社区干货传送门
- 2024-09-06 北京
本文字数:3713 字
阅读完需:约 12 分钟
来源:https://asktug.com/t/topic/1014347/24
作者:人如其名
简单写了个参数对比脚本:https://gitee.com/wencycool/something_for_tidb/tree/main/tidb_config_diff
使用说明:
PS E:\PythonProjects\something_for_tidb\tidb_config_diff> python main.py -h usage: main.py [-h] [-d DB] {collect,report} ...
参数对比工具
options: -h, --help show this help message and exit -d DB, --db DB sqlite3的存放地址
Subcommands: {collect,report} collect 搜集系统参数和集群参数 report 参数对比输出PS E:\PythonProjects\something_for_tidb\tidb_config_diff> python main.py collect -husage: main.py collect [-h] [-H HOST] [-P PORT] [-u USER] [-p [PASSWORD]]
options: -h, --help show this help message and exit -H HOST, --host HOST IP地址 -P PORT, --port PORT 端口号 -u USER, --user USER 用户名 -p [PASSWORD], --password [PASSWORD] 密码PS E:\PythonProjects\something_for_tidb\tidb_config_diff> python main.py report -h usage: main.py report [-h] [-l] [--table1 TABLE1] [--table2 TABLE2] [--limit LIMIT]
options: -h, --help show this help message and exit -l, --list-tables 打印当前已经完成采集的系统表 --table1 TABLE1 对比的第一个表 --table2 TABLE2 对比的第二个表 --limit LIMIT 打印输出行数,默认输出所有行
复制代码
先对需要对比的版本搜集参数
#搜集第一个待对比版本的参数文件PS E:\PythonProjects\something_for_tidb\tidb_config_diff> python main.py collect -H 192.168.31.201 -P 4000 -u root -p Enter your password:
复制代码
#搜集第二个待对比版本的参数文件PS E:\PythonProjects\something_for_tidb\tidb_config_diff> python main.py collect -H 192.168.31.201 -P 4001 -u root -p Enter your password:
复制代码
# 查看当前采集了哪些参数表(可以自己指定表来做对比)PS E:\PythonProjects\something_for_tidb\tidb_config_diff> python main.py report -lTABLE LIST:[tidb_cfg_v7_5_0,tidb_cfg_v7_1_2]
示例:
#默认情况下会找版本最高的2个参数表做比较(这里--limit参数只打印前N行,避免全部输出)PS E:\PythonProjects\something_for_tidb\tidb_config_diff> python main.py report --limit 5 ┌──────────┬─────────┬──────────┬───────────────────────────────────────┬───────────────────────────────┬────────────────────┐│ Number │ scope │ type │ var_name │ var_value_v7.5.0 │ var_value_v7.1.2 │├──────────┼─────────┼──────────┼───────────────────────────────────────┼───────────────────────────────┼────────────────────┤│ 1 │ global │ variable │ tidb_allow_tiflash_cop │ OFF │ NotFound │├──────────┼─────────┼──────────┼───────────────────────────────────────┼───────────────────────────────┼────────────────────┤│ 2 │ global │ variable │ tidb_analyze_skip_column_types │ json,blob,mediumblob,longblob │ NotFound │├──────────┼─────────┼──────────┼───────────────────────────────────────┼───────────────────────────────┼────────────────────┤│ 3 │ global │ variable │ tidb_build_sampling_stats_concurrency │ 2 │ NotFound │├──────────┼─────────┼──────────┼───────────────────────────────────────┼───────────────────────────────┼────────────────────┤│ 4 │ global │ variable │ tidb_cloud_storage_uri │ │ NotFound │├──────────┼─────────┼──────────┼───────────────────────────────────────┼───────────────────────────────┼────────────────────┤│ 5 │ global │ variable │ tidb_enable_async_merge_global_stats │ ON │ NotFound │└──────────┴─────────┴──────────┴───────────────────────────────────────┴───────────────────────────────┴────────────────────┘
上述可以看到该参数名称在v7.5.0版本中有,v7.1.2中没有,说明v7.5.0中新增。
E:\PythonProjects\something_for_tidb\tidb_config_diff> python main.py report --limit 100,5┌──────────┬─────────┬──────────┬───────────────────────────────────────────────┬────────────────────┬────────────────────┐│ Number │ scope │ type │ var_name │ var_value_v7.5.0 │ var_value_v7.1.2 │├──────────┼─────────┼──────────┼───────────────────────────────────────────────┼────────────────────┼────────────────────┤│ 101 │ global │ tiflash │ raftstore-proxy.raftstore.allow-remove-leader │ NotFound │ false │├──────────┼─────────┼──────────┼───────────────────────────────────────────────┼────────────────────┼────────────────────┤│ 102 │ global │ variable │ tidb_remove_orderby_in_subquery │ ON │ OFF │├──────────┼─────────┼──────────┼───────────────────────────────────────────────┼────────────────────┼────────────────────┤│ 103 │ global │ tidb │ performance.enable-stats-cache-mem-quota │ true │ false │├──────────┼─────────┼──────────┼───────────────────────────────────────────────┼────────────────────┼────────────────────┤│ 104 │ global │ tidb │ performance.force-init-stats │ true │ false │├──────────┼─────────┼──────────┼───────────────────────────────────────────────┼────────────────────┼────────────────────┤│ 105 │ global │ tidb │ performance.lite-init-stats │ true │ false │└──────────┴─────────┴──────────┴───────────────────────────────────────────────┴────────────────────┴────────────────────┘
上述可以看到没有发现NotFound字样,说明在两个版本中都存在,只是默认值发生了变化。
复制代码
划线
评论
复制
发布于: 刚刚阅读数: 2
TiDB 社区干货传送门
关注
TiDB 社区官网:https://tidb.net/ 2021-12-15 加入
TiDB 社区干货传送门是由 TiDB 社区中布道师组委会自发组织的 TiDB 社区优质内容对外宣布的栏目,旨在加深 TiDBer 之间的交流和学习。一起构建有爱、互助、共创共建的 TiDB 社区 https://tidb.net/







评论