Skip to content

Commit

Permalink
提升版本为v1.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyo committed Dec 21, 2019
1 parent 7d8e670 commit 8ef7547
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Release](https://img.shields.io/github/release/hhyo/archery.svg)](https://github.com/hhyo/archery/releases/)
[![codecov](https://codecov.io/gh/hhyo/archery/branch/master/graph/badge.svg)](https://codecov.io/gh/hhyo/archery)
[![version](https://img.shields.io/badge/python-3.6.5-blue.svg)](https://www.python.org/downloads/release/python-365/)
[![version](https://img.shields.io/badge/django-2.2-brightgreen.svg)](https://docs.djangoproject.com/zh-hans/2.0/)
[![version](https://img.shields.io/badge/django-2.2-brightgreen.svg)](https://docs.djangoproject.com/zh-hans/2.2/)
[![docker_pulls](https://img.shields.io/docker/pulls/hhyo/archery.svg)](https://hub.docker.com/r/hhyo/archery/)
[![HitCount](http://hits.dwyl.io/hhyo/hhyo/Archery.svg)](http://hits.dwyl.io/hhyo/hhyo/Archery)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](http://github.com/hhyo/archery/blob/master/LICENSE)
Expand Down
2 changes: 1 addition & 1 deletion archery/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = (1, 7, 3)
version = (1, 7, 4)
display_version = '.'.join(str(i) for i in version)
2 changes: 1 addition & 1 deletion src/charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replicaCount: 1

image:
repository: hhyo/archery
tag: 1.7.3
tag: 1.7.4
pullPolicy: IfNotPresent

nameOverride: ""
Expand Down
2 changes: 1 addition & 1 deletion src/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
- "./inception/config.toml:/etc/config.toml"

archery:
image: hhyo/archery:1.7.3
image: hhyo/archery:1.7.4
container_name: archery
restart: always
ports:
Expand Down
34 changes: 18 additions & 16 deletions src/script/analysis_slow_query.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
#!/bin/bash
DIR="$( cd "$( dirname "$0" )" && pwd )"
cd $DIR
cd ${DIR}

#配置Archery数据库的连接地址
monitor_db_host="127.0.0.1"
monitor_db_port=3306
monitor_db_user="root"
monitor_db_password="123456"
monitor_db_database="archery"
archery_db_host="127.0.0.1"
archery_db_port=3306
archery_db_user="root"
archery_db_password="123456"
archery_db_database="archery"

#被分析实例的慢日志位置
#被分析实例的慢日志位置,建议定期清理日志文件,否则会影响分析效率
slowquery_file="/home/mysql/log_slow.log"

#pt-query-digest可执行文件路径
pt_query_digest="/usr/bin/pt-query-digest"

#被分析实例的连接信息
hostname="mysql_host:mysql_port" # 需要和Archery实例配置中的内容保持一致,用于筛选,配置错误会导致数据无法展示

#获取上次分析时间,初始化时请删除last_analysis_time_$hostname文件,可分析全部日志数据
if [ -s last_analysis_time_$hostname ]; then
last_analysis_time=`cat last_analysis_time_$hostname`
if [[ -s last_analysis_time_${hostname} ]]; then
last_analysis_time=`cat last_analysis_time_${hostname}`
else
last_analysis_time='1000-01-01 00:00:00'
fi

#收集日志
#RDS需要增加--no-version-check选项
$pt_query_digest \
--user=$monitor_db_user --password=$monitor_db_password --port=$monitor_db_port \
--review h=$monitor_db_host,D=$monitor_db_database,t=mysql_slow_query_review \
--history h=$monitor_db_host,D=$monitor_db_database,t=mysql_slow_query_review_history \
${pt_query_digest} \
--user=${archery_db_user} --password=${archery_db_password} --port=${archery_db_port} \
--review h=${archery_db_host},D=${archery_db_database},t=mysql_slow_query_review \
--history h=${archery_db_host},D=${archery_db_database},t=mysql_slow_query_review_history \
--no-report --limit=100% --charset=utf8 \
--since "$last_analysis_time" \
--filter="\$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$hostname\" and \$event->{client}=\$event->{ip} " \
$slowquery_file > /tmp/analysis_slow_query.log
${slowquery_file} > /tmp/analysis_slow_query.log

if [ $? -ne 0 ]; then
if [[ $? -ne 0 ]]; then
echo "failed"
else
echo `date +"%Y-%m-%d %H:%M:%S"`>last_analysis_time_$hostname
echo `date +"%Y-%m-%d %H:%M:%S"`>last_analysis_time_${hostname}
fi

0 comments on commit 8ef7547

Please sign in to comment.