自学内容网 自学内容网

笔记:mysql 5.7 收集数据库信息

说明

MySQL 5.7开始,可以使用sys.diagnostics来获取数据库信息,利用information_schema和performance_schema的数据

CALL sys.diagnostics( in_max_runtime, in_interval, in_auto_config);
CALL sys.diagnostics( 120, 30, 'current');
in_max_runtime (INT UNSIGNED):最大数据采集时间,单位为秒。默认值为 60 秒,自定义需使用大于 0 的值。

in_interval (INT UNSIGNED):数据采集之间的休眠时间,单位为秒。默认值为 30 秒,自定义需使用大于 0 的值。

in_auto_config ENUM('current', 'medium', 'full'): 要使用的 Performance Schema 配置。允许的值有:

    current:使用当前的 instrumen 和 consumers 设置。

    medium:启用部分 instrumen 和 consumers。

    full:启用所有 instrumen 和 consumers。

使用一,保存到txt文件

tee mysql_diag.out
CALL sys.diagnostics( 120, 30, 'current');
notee

使用二,生成html

mysql -hlocalhost -P3306 -uroot -p -H -e "CALL sys.diagnostics(1, 1, 'current')" > /tmp/report_$(date +"%Y-%m-%d_%H-%M").html

原文地址:https://blog.csdn.net/Lizi_TT/article/details/142822219

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!