blob: c17724d59ed6b1613762f587beeae56a33c990b6 [file] [log] [blame]
Yulia Portnova0f991192015-04-24 16:56:52 +03001#!/bin/bash
Yulia Portnova2b4af7b2015-05-07 15:49:33 +03002
3while [[ $# > 1 ]]
4do
5key="$1"
6
7case $key in
8 warehouses)
9 WAREHOUSES="$2"
10 shift
11 ;;
12 *)
13 echo "Unknown option $key"
14 exit 1
15 ;;
16esac
17shift
18done
19
Yulia Portnova0f991192015-04-24 16:56:52 +030020# install and configure mysql
Yulia Portnovab1a15072015-05-06 14:59:25 +030021
Yulia Portnova0f991192015-04-24 16:56:52 +030022DATABASE_PASSWORD=wally
23DATBASE_USER=root
24DB_NAME=tpcc
25
26# not prompting db password
27debconf-set-selections <<MYSQL_PRESEED
28mysql-server mysql-server/root_password password $DATABASE_PASSWORD
29mysql-server mysql-server/root_password_again password $DATABASE_PASSWORD
30mysql-server mysql-server/start_on_boot boolean true
31MYSQL_PRESEED
32
33apt-get install -y mysql-server
34apt-get install -y libmysqld-dev
35apt-get install -y make
36
37# disable mysql profile in apparmor
Yulia Portnovab1a15072015-05-06 14:59:25 +030038#sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
39#sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
Yulia Portnova0f991192015-04-24 16:56:52 +030040
41# allows us not to access mysql without specifying password
42cat <<EOF >$HOME/.my.cnf
43[client]
44user=$DATABASE_USER
45password=$DATABASE_PASSWORD
46host=$DATABASE_HOST
47EOF
48
49cd ~
Yulia Portnovab1a15072015-05-06 14:59:25 +030050apt-get -y install bzr
Yulia Portnova0f991192015-04-24 16:56:52 +030051bzr branch lp:~percona-dev/perconatools/tpcc-mysql
52cd tpcc-mysql/src
53make
54
55cd ..
56mysql -e "CREATE DATABASE $DB_NAME;"
57mysql "$DB_NAME" < create_table.sql
58mysql "$DB_NAME" < add_fkey_idx.sql
59
Yulia Portnova2b4af7b2015-05-07 15:49:33 +030060./tpcc_load localhost "$DB_NAME" "$DATBASE_USER" "$DATABASE_PASSWORD" "$WAREHOUSES"