Skip to content

Commit 4835396

Browse files
authored
add :Z to volume(mount point with host), required for SELinux relabel, upon using podman. (#168)
modify the container script to use both systems podman and docker Signed-off-by: Gal Salomon <gal.salomon@gmail.com>
1 parent 5e7484b commit 4835396

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

container/trino/hms_trino.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ services:
55
container_name: hms
66
environment:
77
# S3_ENDPOINT the CEPH/RGW end-point-url
8-
- S3_ENDPOINT=http://10.0.209.201:80
9-
- S3_ACCESS_KEY=abc1
10-
- S3_SECRET_KEY=abc1
8+
- S3_ENDPOINT=192.168.122.1:8000
9+
- S3_ACCESS_KEY=b2345678901234567890
10+
- S3_SECRET_KEY=b234567890123456789012345678901234567890
1111
# the container starts with booting the hive metastore
1212
command: sh -c '. ~/.bashrc; start_hive_metastore'
1313
ports:
@@ -16,11 +16,11 @@ services:
1616
- trino_hms
1717

1818
trino:
19-
image: trinodb/trino
19+
image: trinodb/trino:405
2020
container_name: trino
2121
volumes:
2222
# the trino directory contains the necessary configuration
23-
- ./trino:/etc/trino
23+
- ./trino:/etc/trino:Z
2424
ports:
2525
- 8080:8080
2626
networks:

container/trino/run_trino_on_ceph.bash

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
CNTR_SYSTEM=${1:-podman}
4+
[ $CNTR_SYSTEM == "docker" ] && CNTR_COMPOSE_SYSTEM="sudo docker compose" && CNTR_SYSTEM="sudo docker"
5+
[ $CNTR_SYSTEM == "podman" ] && CNTR_COMPOSE_SYSTEM="podman-compose"
6+
37
root_dir()
48
{
59
cd $(git rev-parse --show-toplevel)
@@ -24,7 +28,7 @@ return;
2428
trino_exec_command()
2529
{
2630
## run SQL statement on trino
27-
sudo docker exec -it trino /bin/bash -c "time trino --catalog hive --schema cephs3 --execute \"$@\""
31+
${CNTR_SYSTEM} exec -it trino /bin/bash -c "time trino --catalog hive --schema cephs3 --execute \"$@\""
2832
}
2933

3034
boot_trino_hms()
@@ -50,14 +54,15 @@ boot_trino_hms()
5054
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
5155
cp /tmp/hive.properties ./container/trino/trino/catalog/hive.properties
5256

53-
sudo docker compose -f ./container/trino/hms_trino.yaml up -d
57+
#sudo docker compose -f ./container/trino/hms_trino.yaml up -d
58+
${CNTR_COMPOSE_SYSTEM} -f ${PWD}/container/trino/hms_trino.yaml up -d
5459
cd -
5560
}
5661

5762
shutdown_trino_hms()
5863
{
5964
root_dir
60-
sudo docker compose -f ./container/trino/hms_trino.yaml down
65+
${CNTR_COMPOSE_SYSTEM} -f ${PWD}/container/trino/hms_trino.yaml down
6166
cd -
6267
}
6368

@@ -66,13 +71,13 @@ trino_create_table()
6671
table_name=$1
6772
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)
6873
WITH ( external_location = 's3a://hive/warehouse/cephs3/${table_name}/',format = 'TEXTFILE',textfile_field_separator = ',');"
69-
sudo docker exec -it trino /bin/bash -c "trino --catalog hive --schema cephs3 --execute \"${create_table_comm}\""
74+
${CNTR_SYSTEM} exec -it trino /bin/bash -c "trino --catalog hive --schema cephs3 --execute \"${create_table_comm}\""
7075
}
7176

7277
tpcds_cli()
7378
{
7479
## a CLI example for generating TPCDS data
75-
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'
80+
${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'
7681
}
7782

7883
update_table_external_location()

0 commit comments

Comments
 (0)