Skip to content

Commit

Permalink
scripts: fix scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mickamy committed Jan 9, 2024
1 parent 7312c8d commit 868307b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 5 additions & 3 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ sudo mysql -u root -pishocon -e 'GRANT ALL ON *.* TO ishocon;'
echo "mysql user set up completed."

echo "importing data..."
# data import 時の slow query log は無視する
sudo mysql -u root -pishocon -e 'set global slow_query_log=0;'
tar -jxvf ~/data/ishocon2.dump.tar.bz2 -C ~/data && sudo mysql -u root -pishocon ishocon2 < ~/data/ishocon2.dump
sudo mysql -u root -pishocon -e 'set global slow_query_log=1;'
echo "data imported."

echo "modifying db schema..."
sudo mysql -u root -pishocon ishocon2 < ~/scripts/modify_db_schema.sql
echo "modifying db schema..."

# data import 時の sloq_query.log を削除
sudo rm -rf /var/log/mysql/slow_query.log
sudo touch /var/log/mysql/slow_query.log
# set global による slow query log 設定のクリアのためにリスタート
sudo service mysql restart

check_message="start application w/ ${app_lang}..."

Expand Down
2 changes: 1 addition & 1 deletion scripts/run_alp.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -eux

sudo cat /var/log/nginx/access.log | alp ltsv --sort sum -o count,2xx,3xx,4xx,5xx,method,uri,avg,sum
rm -rf /var/log/nginx/access.log
sudo rm -rf /var/log/nginx/access.log
5 changes: 2 additions & 3 deletions scripts/run_pt-query.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash -eux

rm -rf sloq-query.log.analyzed
pt-query-digest --type slowlog /var/log/mysql/slow-query.log > slow-query.log.analyzed
rm -rf /var/log/mysql/slow-query.log
pt-query-digest --type slowlog /var/log/mysql/slow_query.log | tee "../digetst_$(date +%Y%m%d%H%M).log"
rm -rf /var/log/mysql/slow_query.log

0 comments on commit 868307b

Please sign in to comment.