用Oracle Enterprise Manager来监控MySQL还是不错的。Oracle网站有个demo的虚拟机,有兴趣的可以点击下载。
模拟MySQL压力的脚本
#!/bin/bash
FREQUENCY_SECS=30
DURATION_MINS=3
TOTAL_TIMES=$(((60*DURATION_MINS)/FREQUENCY_SECS))
ROUNDS=6
SLEEP_BETWEEN_ROUND=150
for i in `seq 1 $ROUNDS`;
do
echo "round $i/$ROUNDS"
echo "stressing db every $FREQUENCY_SECS seconds... (for $DURATION_MINS minutes)."
for j in `seq 1 $TOTAL_TIMES`;
do
echo "stress $j/$TOTAL_TIMES"
mysqlslap --concurrency=35 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --protocol=tcp --host=localhost --port=3306 --user=root --password=welcome1
echo "sleeping... $FREQUENCY_SECS seconds"
sleep $FREQUENCY_SECS
done
echo "finished round $i, sleeping... $SLEEP_BETWEEN_ROUND seconds"
sleep $SLEEP_BETWEEN_ROUND
done
echo "finished."
https://dev.mysql.com/doc/mysql-em-plugin/en/
http://www.oracle.com/technetwork/community/developer-vm/mysql-oem-vm-2355166.html
http://www.oracle.com/technetwork/cn/community/developer-vm/mysql-oem-vm-2355166-zhs.html
