使用MYSQL benchmark - DBT2 Benchmark Tool遇到的问题

MYSQL Server是5.6版本

下载DBT2 Benchmark,编译安装,按照README-MYSQL中的步骤来操作。需要由aclocal、autoheader、autoconf、automake,以及mysql、mysql-libs、mysql-devel。

$ ./congigure --with-mysql

$ make

$ sudo make install 

安装好datagen,然后生成数据,需要先创建对应的目录如/tmp/dbt2-w3。

$ datagen -w 3 -d  /tmp/dbt2-w3 --mysql

warehouses = 3
first warehouse = 1
districts = 10
customers = 3000
items = 100000
orders = 3000
stock = 100000
new_orders = 900

生成完数据后就可以执行scripts/mysql/mysql_load_db.sh脚本将数据导入到数据库中。

$ ./scripts/mysql/mysql_load_db.sh --path /home/ec2-user/myspace/tmp/dbt2-w3 --host yourdbhost --mysql-path /usr/bin/mysql --user yourname--password yourpassword

这里可能遇到几个问题:

1)提示输密码问题:
修改mysql_load_db.sh里面的
if [ "$DB_PASSWORD" != "" ]; then
  #MYSQL_ARGS="-p $DB_PASSWORD"
  MYSQL_ARGS="-p$DB_PASSWORD"

脚本中的port参数也可能需要修改成-P。

2)权限不足问题:

登录mysql修改权限

mysql> grant all privileges on dbt2.* to 'yourname'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

3)LOAD DATA INFILE报Access denied

mysql_load_db.sh中LOAD DATA这个命令引用了变量$LOCAL,但是这个变量并没有值,据http://stackoverflow.com/questions/2221335/access-denied-for-load-data-infile-in-mysql 直接使用LOAD DATA LOCAL INFILE即可。

#command_exec "$MYSQL $DB_NAME -e \"LOAD DATA $LOCAL INFILE \\\"$DB_PATH/$FN.data\\\" \
    command_exec "$MYSQL $DB_NAME -e \"LOAD DATA LOCAL INFILE \\\"$DB_PATH/$FN.data\\\" \
              INTO TABLE $TABLE FIELDS TERMINATED BY '\t' ${COLUMN_NAMES} \""

重新执行mysql_load_db.sh即可。

Creating table STOCK in INNODB
Creating table ITEM in INNODB
Creating table ORDER_LINE in INNODB
Creating table ORDERS in INNODB
Creating table NEW_ORDER in INNODB
Creating table HISTORY in INNODB
Creating table CUSTOMER in INNODB
Creating table DISTRICT in INNODB
Creating table WAREHOUSE in INNODB

Loading table customer

Loading table district

。。。


运行benchmark,注意自己的mysql lib库的位置设置--lib-client-path才能运行:

./run_mysql.sh --connections 20 --time 60 --warehouses 3 --host mydb1.cb837jmipnaa.ap-northeast-1.rds.amazonaws.com --user username--password password--lib-client-path /usr/lib64/mysql --output-base /home/ec2-user/myspace/dbt2-0.37.50.6


你可能感兴趣的:(mysql,Benchmark,DBT2)