mysql-benchでデータベース負荷テスト
mysql-benchをインストール
% sudo yum list --enablerepo=remi | grep mysql-bench mysql-bench.i386 5.1.49-1.el5.remi % sudo yum install --enablerepo=remi install mysql-bench
どこに行ったのかを調べます。
% rpm -ql mysql-bench ... /usr/share/sql-bench/run-all-tests ...
移動
% cd /usr/share/sql-bench/
README読む
% cat /usr/share/sql-bench/README
のっけからこんなことを言われるが大丈夫かな
These tests require a MySQL version of at least 3.20.28 or 3.21.10.
このディレクトリにはベンチ用のクエリとデータファイルが存在しているのです。
The benchmark directory contains the query files and raw data files used to populate the MySQL benchmark tables.
で、次のように使うべし
run-all-tests --server=mysql --cmp=mysql,pg,solid --user=test --password=test --log
やってみる
testデータベース消してたのでもう一回つくる。あれは不必要なdbではなかったのね
% sudo mysql_install_db
おお、いろいろwarningsがでてきた。今度パラメータを直しておこう。/usr/mysql-testというディレクトリは無いけど気にしないでおこう。
Installing MySQL system tables... 100801 10:57:25 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead. 100801 10:57:25 [Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use ''--slow_query_log'/'--slow_query_log_file'' instead. OK Filling help tables... 100801 10:57:25 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead. 100801 10:57:25 [Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use ''--slow_query_log'/'--slow_query_log_file'' instead. OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h xxxxx password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script!
実行
% sudo perl run-all-tests --user=root --password=XXXX
ディレクトリがないらしい
alter-table: sh: output/alter-table-mysql-Linux_2.6.34_linode27_i686: そのようなファイルやディレクトリはありません
つくる
%sudo mkdir /usr/share/sql-bench/output
再度実行
% sudo perl run-all-tests --user=root --password=XXXX Benchmark DBD suite: 2.15 Date of test: 2010-08-01 11:01:16 Running tests on: Linux 2.6.34-linode27 i686 Arguments: Comments: Limits from: Server version: MySQL 5.1.49 log Optimization: None Hardware: 以下実行結果がでてくる
結構時間がかかる。
今度からサーバー構築したら必ずこういうデータを残す習慣をつけよう。