mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
45 lines
1.3 KiB
Bash
Executable File
45 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Install
|
|
|
|
sudo apt-get update
|
|
sudo apt-get install -y docker.io
|
|
|
|
export LICENSE_KEY="..."
|
|
export ROOT_PASSWORD="..."
|
|
|
|
sudo docker run -i --init \
|
|
--name memsql-ciab \
|
|
-e LICENSE_KEY="${LICENSE_KEY}" \
|
|
-e ROOT_PASSWORD="${ROOT_PASSWORD}" \
|
|
-p 3306:3306 -p 8080:8080 \
|
|
memsql/cluster-in-a-box
|
|
|
|
sudo docker start memsql-ciab
|
|
|
|
sudo docker exec -it memsql-ciab memsql -p"${ROOT_PASSWORD}"
|
|
|
|
# Load the data
|
|
|
|
wget --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz'
|
|
gzip -d hits.tsv.gz
|
|
sudo docker cp hits.tsv memsql-ciab:/
|
|
|
|
sudo docker exec -it memsql-ciab memsql -p"${ROOT_PASSWORD}" -e "CREATE DATABASE test"
|
|
sudo docker exec memsql-ciab memsql -p"${ROOT_PASSWORD}" --database=test -e "USE test; $(cat create.sql)"
|
|
time sudo docker exec -it memsql-ciab memsql -vvv -p"${ROOT_PASSWORD}" --database=test -e "LOAD DATA INFILE '/hits.tsv' INTO TABLE test.hits"
|
|
|
|
# Query OK, 99997497 rows affected (11 min 30.11 sec)
|
|
|
|
./run.sh 2>&1 | tee log.txt
|
|
|
|
sudo docker exec memsql-ciab du -bcs /var/lib/memsql
|
|
|
|
# 29836263469 bytes
|
|
|
|
cat log.txt |
|
|
grep -P 'rows? in set|^ERROR' |
|
|
sed -r -e 's/^ERROR.*$/null/; s/^.*?\((([0-9.]+) min )?([0-9.]+) sec\).*?$/\2 \3/' |
|
|
awk '{ if ($2) { print $1 * 60 + $2 } else { print $1 } }' |
|
|
awk '{ if (i % 3 == 0) { printf "[" }; printf $1; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }'
|