Skip to content

Commit

Permalink
更新在线体验地址,完整慢日志脚本操作说明
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyo committed Jul 9, 2018
1 parent 46c2937 commit 15cbb94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
## 系统体验
[点击体验](http://54.169.188.51:9123/sqlquery/)
[点击体验](http://52.221.195.102:9123/)
| 角色 | 账号 | 密码 |
| --- | --- | --- |
Expand Down Expand Up @@ -269,6 +269,10 @@ inception无法连接备份库
- 审核人看不到待审核工单
代办列表被隐藏至右上角的消息图标中,当有待审核信息时会显示图标,可以进入查看待办数据
#### 慢日志管理
- 检查脚本内的配置,hostname和archer主库配置内容保持一致,用于archer做筛选
- 检查mysql_slow_query_review_history表收集的日志信息hostname_max是否和hostname一致
#### 定时任务
- 未执行
检查django-apscheduler相关表是否有创建,可使用`python3 manage.py migrate`创建
Expand Down
16 changes: 6 additions & 10 deletions src/script/analysis_slow_query.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand All @@ -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

0 comments on commit 15cbb94

Please sign in to comment.