diff --git a/README.md b/README.md index 0a31b5cc..a76fbda0 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ ## 系统体验 -[点击体验](http://54.169.188.51:9123/sqlquery/) +[点击体验](http://52.221.195.102:9123/) | 角色 | 账号 | 密码 | | --- | --- | --- | @@ -269,6 +269,10 @@ inception无法连接备份库 - 审核人看不到待审核工单 代办列表被隐藏至右上角的消息图标中,当有待审核信息时会显示图标,可以进入查看待办数据 +#### 慢日志管理 +- 检查脚本内的配置,hostname和archer主库配置内容保持一致,用于archer做筛选 +- 检查mysql_slow_query_review_history表收集的日志信息hostname_max是否和hostname一致 + #### 定时任务 - 未执行 检查django-apscheduler相关表是否有创建,可使用`python3 manage.py migrate`创建 diff --git a/src/script/analysis_slow_query.sh b/src/script/analysis_slow_query.sh index ba8051b1..4b7e2034 100644 --- a/src/script/analysis_slow_query.sh +++ b/src/script/analysis_slow_query.sh @@ -2,23 +2,19 @@ DIR="$( cd "$( dirname "$0" )" && pwd )" cd $DIR -#config monitor database server 收集日志 配置archer数据库的连接地址 +#配置archer数据库的连接地址 monitor_db_host="127.0.0.1" monitor_db_port=3306 monitor_db_user="root" monitor_db_password="123456" monitor_db_database="archer" -#config mysql server 被监控机 -mysql_host=$mysql_host # 和archer主库配置保持一致 -mysql_port=$mysql_port # 和archer主库配置保持一致 - -#config slowqury 被监控机慢日志位置 +#被监控机慢日志位置 slowquery_file="/home/mysql/log_slow.log" pt_query_digest="/usr/bin/pt-query-digest" -#config server_id -hostname="${mysql_host}:${mysql_port}" # 用于archer做筛选 +#被监控机连接信息 +hostname=mysql_host:mysql_port # 被监控机连接信息,和archer主库配置内容保持一致,用于archer做筛选 #获取上次分析时间,初始化时请删除last_analysis_time_$hostname文件,可分析全部日志数据 if [ -s last_analysis_time_$hostname ]; then @@ -27,7 +23,7 @@ else last_analysis_time='1000-01-01 00:00:00' fi -#collect mysql slowquery log into monitor database +#收集日志 #RDS需要增加--no-version-check选项 $pt_query_digest \ --user=$monitor_db_user --password=$monitor_db_password --port=$monitor_db_port \ @@ -38,4 +34,4 @@ $pt_query_digest \ --filter="\$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$hostname\" and \$event->{client}=\$event->{ip} " \ $slowquery_file > /tmp/analysis_slow_query.log -echo `date +"%Y-%m-%d %H:%M:%S"`>last_analysis_time_$hostname +echo `date +"%Y-%m-%d %H:%M:%S"`>last_analysis_time_$hostname \ No newline at end of file