LoginSignup
2
3

More than 5 years have passed since last update.

【RDS】 sleepプロセス大虐殺。1分以上眠ってたら殺してやる。同情なんてしない。

Posted at

同情?
ボクはそんな心持ってないよ。
でもボク優しいから1分間だけ待つんだ。

でも1分待ったらワンライナーで殺してあ♪げ♪る♪

path/to/hoge
mysql {DB名} -h {host} -u {ユーザー名} -p{パスワード} -e "select concat('KILL ', id, ';') from information_schema.PROCESSLIST where USER='{ユーザー名}' and Command='Sleep' and TIME > 60;" > /tmp/kill.log;cat /tmp/kill.log|awk 'NR > 1 {print}' > /tmp/rds_kill.log |mysql {DB名} -h {host} -u {ユーザー名} -p{パスワード} -e "source /tmp/rds_kill.log"
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3