Skip to content

Instantly share code, notes, and snippets.

@mbtamuli
Forked from BenMorel/dbt2.patch
Last active May 7, 2018 09:21
Show Gist options
  • Save mbtamuli/cdd26319c593c3b8f6c9cdf8d6cd90dc to your computer and use it in GitHub Desktop.
Save mbtamuli/cdd26319c593c3b8f6c9cdf8d6cd90dc to your computer and use it in GitHub Desktop.
Downloads and runs the DBT2 benchmark for MySQL.
#!/bin/sh
set -e
host='127.0.0.1'
user='root'
pass=''
# dbt2 version
version='0.37.50.15'
mysql_path=$(which mysql)
mysql_dir_path=$(dirname $mysql_path)
log() {
echo
echo -e "\e[37;42m$1\e[0m"
}
log 'Installing required packages...'
sudo apt-get install automake autoconf libmysqlclient-dev -y
log 'Downloading...'
wget -q -O - https://downloads.mysql.com/source/dbt2-$version.tar.gz | tar xvz -C /tmp
# Go to the directory extracted
cd /tmp/dbt2-$version
# Fix an extra space breaking the password functionality
sed -i 's/"-p $DB_PASSWORD"/"-p$DB_PASSWORD"/g' scripts/mysql/mysql_load_db.sh scripts/mysql/mysql_load_sp.sh scripts/run_mysql.sh
# Create the data directory
mkdir /tmp/dbt
log 'Configuring...'
./configure --with-mysql
log 'Compiling...'
make
log 'Generating the data files...'
src/datagen -w 30 -d /tmp/dbt --mysql
log 'Loading the data into the database...'
scripts/mysql/mysql_load_db.sh \
--path /tmp/dbt \
--local \
--mysql-path "$mysql_path" \
--host "$host" \
--user "$user" \
--password "$pass"
log 'Loading the stored procedures...'
scripts/mysql/mysql_load_sp.sh \
--client-path "$mysql_dir_path" \
--sp-path storedproc/mysql \
--host "$host" \
--user "$user" \
--password "$pass"
log 'Running the benchmark...'
scripts/run_mysql.sh \
--connections 20 \
--time 300 \
--warehouses 30 \
--zero-delay \
--host "$host" \
--user "$user" \
--password "$pass"
log 'Cleaning up...'
sudo apt-get purge automake autoconf libmysqlclient-dev -y
rm -rf /tmp/dbt2-$version
rm -rf /tmp/dbt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment