Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions container/trino/hms_trino.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ services:
container_name: hms
environment:
# S3_ENDPOINT the CEPH/RGW end-point-url
- S3_ENDPOINT=http://10.0.209.201:80
- S3_ACCESS_KEY=abc1
- S3_SECRET_KEY=abc1
- S3_ENDPOINT=192.168.122.1:8000
- S3_ACCESS_KEY=b2345678901234567890
- S3_SECRET_KEY=b234567890123456789012345678901234567890
# the container starts with booting the hive metastore
command: sh -c '. ~/.bashrc; start_hive_metastore'
ports:
Expand All @@ -16,11 +16,11 @@ services:
- trino_hms

trino:
image: trinodb/trino
image: trinodb/trino:405
container_name: trino
volumes:
# the trino directory contains the necessary configuration
- ./trino:/etc/trino
- ./trino:/etc/trino:Z
ports:
- 8080:8080
networks:
Expand Down
15 changes: 10 additions & 5 deletions container/trino/run_trino_on_ceph.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

CNTR_SYSTEM=${1:-podman}
[ $CNTR_SYSTEM == "docker" ] && CNTR_COMPOSE_SYSTEM="sudo docker compose" && CNTR_SYSTEM="sudo docker"
[ $CNTR_SYSTEM == "podman" ] && CNTR_COMPOSE_SYSTEM="podman-compose"

root_dir()
{
cd $(git rev-parse --show-toplevel)
Expand All @@ -24,7 +28,7 @@ return;
trino_exec_command()
{
## run SQL statement on trino
sudo docker exec -it trino /bin/bash -c "time trino --catalog hive --schema cephs3 --execute \"$@\""
${CNTR_SYSTEM} exec -it trino /bin/bash -c "time trino --catalog hive --schema cephs3 --execute \"$@\""
}

boot_trino_hms()
Expand All @@ -50,14 +54,15 @@ boot_trino_hms()
awk -v x=${S3_SECRET_KEY:-NO_SET} '{if(/hive.s3.aws-secret-key/){print "hive.s3.aws-secret-key="x;} else {print $0;}}' > /tmp/hive.properties
cp /tmp/hive.properties ./container/trino/trino/catalog/hive.properties

sudo docker compose -f ./container/trino/hms_trino.yaml up -d
#sudo docker compose -f ./container/trino/hms_trino.yaml up -d
${CNTR_COMPOSE_SYSTEM} -f ${PWD}/container/trino/hms_trino.yaml up -d
cd -
}

shutdown_trino_hms()
{
root_dir
sudo docker compose -f ./container/trino/hms_trino.yaml down
${CNTR_COMPOSE_SYSTEM} -f ${PWD}/container/trino/hms_trino.yaml down
cd -
}

Expand All @@ -66,13 +71,13 @@ trino_create_table()
table_name=$1
create_table_comm="create table hive.cephs3.${table_name}(c1 varchar,c2 varchar,c3 varchar,c4 varchar, c5 varchar,c6 varchar,c7 varchar,c8 varchar,c9 varchar,c10 varchar)
WITH ( external_location = 's3a://hive/warehouse/cephs3/${table_name}/',format = 'TEXTFILE',textfile_field_separator = ',');"
sudo docker exec -it trino /bin/bash -c "trino --catalog hive --schema cephs3 --execute \"${create_table_comm}\""
${CNTR_SYSTEM} exec -it trino /bin/bash -c "trino --catalog hive --schema cephs3 --execute \"${create_table_comm}\""
}

tpcds_cli()
{
## a CLI example for generating TPCDS data
sudo docker run --env S3_ENDPOINT=172.17.0.1:8000 --env S3_ACCESS_KEY=b2345678901234567890 --env S3_SECRET_KEY=b234567890123456789012345678901234567890 --env BUCKET_NAME=hive --env SCALE=2 -it galsl/hadoop:tpcds bash -c '/root/run_tpcds_with_scale'
${CNTR_SYSTEM} run --env S3_ENDPOINT=172.17.0.1:8000 --env S3_ACCESS_KEY=b2345678901234567890 --env S3_SECRET_KEY=b234567890123456789012345678901234567890 --env BUCKET_NAME=hive --env SCALE=2 -it galsl/hadoop:tpcds bash -c '/root/run_tpcds_with_scale'
}

update_table_external_location()
Expand Down