feat: added starrocks

This commit is contained in:
2025-02-01 00:28:53 +01:00
parent d27096896b
commit aa1cec9986
2 changed files with 413 additions and 95 deletions

View File

@@ -1,4 +1,6 @@
services:
# Ingest
redpanda:
image: redpandadata/redpanda:v24.3.4
container_name: redpanda
@@ -129,6 +131,7 @@ services:
- redpanda
- connect
# Buckets
minio:
image: minio/minio
hostname: minio
@@ -159,6 +162,7 @@ services:
depends_on:
- minio
# Batch & Iceberg manipulation
spark-iceberg:
image: tabulario/spark-iceberg
hostname: spark-iceberg
@@ -196,6 +200,7 @@ services:
- ./notebooks:/home/iceberg/notebooks/notebooks
command: ["echo \"$$SPARK_DEFAULTS\" > /opt/spark/conf/spark-defaults.conf && spark-submit /home/iceberg/scripts/create_table.py && notebook"]
# Catalog
rest:
image: tabulario/iceberg-rest
hostname: rest
@@ -210,3 +215,99 @@ services:
- CATALOG_IO__IMPL=org.apache.iceberg.aws.s3.S3FileIO
- CATALOG_S3_ENDPOINT=http://minio:9000
- CATALOG_S3_PATH__STYLE__ACCESS=True
# Query layer
starrocks-fe:
image: starrocks/fe-ubuntu:3.3.5
hostname: starrocks-fe
container_name: starrocks-fe
restart: unless-stopped
user: root
command: |
bash /opt/starrocks/fe/bin/start_fe.sh --host_type FQDN
ports:
- 8030:8030
- 9020:9020
- 9030:9030
environment:
- AWS_ACCESS_KEY_ID=minioadmin
- AWS_SECRET_ACCESS_KEY=minioadmin
- AWS_REGION=eu-west-1
healthcheck:
test: 'mysql -u root -h starrocks-fe -P 9030 -e "SHOW FRONTENDS\G" |grep "Alive: true"'
interval: 10s
timeout: 5s
retries: 3
starrocks-init-tables:
image: starrocks/fe-ubuntu:3.3.5
hostname: starrocks-init-tables
container_name: starrocks-init-tables
user: root
restart: no
environment:
SETUP_SQL: |
CREATE EXTERNAL CATALOG 'iceberg'
COMMENT "Iceberg table"
PROPERTIES
(
"type"="iceberg",
"iceberg.catalog.type"="rest",
"iceberg.catalog.uri"="http://rest:8181",
"iceberg.catalog.warehouse"="warehouse",
"aws.s3.access_key"="minioadmin",
"aws.s3.secret_key"="minioadmin",
"aws.s3.endpoint"="http://minio:9000",
"aws.s3.enable_path_style_access"="true",
"client.factory"="com.starrocks.connector.iceberg.IcebergAwsClientFactory"
);
depends_on:
starrocks-fe:
condition: service_healthy
command: |
bash -c '
until mysql -P 9030 -h starrocks-fe -u root -e "SELECT 1" >/dev/null 2>&1; do
echo "Waiting for StarRocks FE to be ready..."
sleep 5
done
if ! mysql -P 9030 -h starrocks-fe -u root -e "SHOW CATALOGS" | grep -q iceberg; then
echo "Creating Iceberg catalog..."
mysql -P 9030 -h starrocks-fe -u root -e "$$SETUP_SQL"
echo "Iceberg catalog created successfully"
else
echo "Iceberg catalog already exists"
fi
'
starrocks-be:
image: starrocks/be-ubuntu:3.3.5
command:
- /bin/bash
- -c
- |
ulimit -u 65535;
ulimit -n 65535;
echo "# Enable data cache" >> /opt/starrocks/be/conf/be.conf
echo "block_cache_enable = true" >> /opt/starrocks/be/conf/be.conf
echo "block_cache_mem_size = 536870912" >> /opt/starrocks/be/conf/be.conf
echo "block_cache_disk_size = 1073741824" >> /opt/starrocks/be/conf/be.conf
sleep 15s
mysql --connect-timeout 2 -h starrocks-fe -P 9030 -u root -e "ALTER SYSTEM ADD BACKEND \"starrocks-be:9050\";"
bash /opt/starrocks/be/bin/start_be.sh
ports:
- 8040:8040
hostname: starrocks-be
container_name: starrocks-be
user: root
restart: unless-stopped
depends_on:
- starrocks-fe
healthcheck:
test: 'mysql -u root -h starrocks-fe -P 9030 -e "SHOW BACKENDS\G" |grep "Alive: true"'
interval: 10s
timeout: 5s
retries: 3
environment:
- HOST_TYPE=FQDN