Overview
- Deploy Object Storage, Apache Spark, Hudi, and the database using Docker compose
- Load a tiny dataset into Hudi with Apache Spark
- Configure the database to access the Hive Metastore using an external catalog
- Query the data with the database where the data sits

Prerequisites
The database demo repository
Clone the StarRocks demo repository to your local machine.
All the steps in this guide will be run from the demo/documentation-samples/hudi/ directory in the directory where you cloned the demo GitHub repo.
MinIO AIStor license
MinIO AIStor requires a license to run. You can use an existing license, or you can request a new MinIO AIStor Free Tier license. To request a new MinIO AIStor Free Tier license, go to the MinIO AIStor pricing page and select Get Started under the Free tier to obtain a free license. The free tier license allows you to run MinIO AIStor on a single compute resource with one or more drives. Save the license file asminio.license in the same directory as the docker-compose.yml file. The Docker Compose file mounts minio.license into the MinIO AIStor container. Without a valid license, MinIO AIStor starts but denies all S3 operations.
For this guide, that is the demo/documentation-samples/hudi/ directory.
Docker
- Docker Setup: For Mac, Please follow the steps as defined in Install Docker Desktop on Mac. For running Spark-SQL queries, please ensure at least 5 GB memory and 4 CPUs are allocated to Docker (See Docker → Preferences → Advanced). Otherwise, spark-SQL queries could be killed because of memory issues.
- 20 GB free disk space assigned to Docker
SQL client
You can use the SQL client provided in the Docker environment, or use one on your system. Many MySQL compatible clients will work.Configuration
Change directory intodemo/documentation-samples/hudi and look at the files. This is not a tutorial on Hudi, so not every configuration file will be described; but it is important for the reader to know where to look to see how things are configured. In the hudi/ directory you will find the docker-compose.yml file which is used to launch and configure the services in Docker. Here is a list of those services and a brief description:
Docker services
Configuration files
In thehudi/conf/ directory you will find configuration files that get mounted in the spark-hudi
container.
core-site.xml
This file contains the object storage related settings. Links for this and other items in More information at the end of this document.
spark-defaults.conf
Settings for Hive, MinIO, and Spark SQL.
hudi-defaults.conf
Default file used to silence warnings in the spark-shell.
hadoop-metrics2-hbase.properties
Empty file used to silence warnings in the spark-shell.
hadoop-metrics2-s3a-file-system.properties
Empty file used to silence warnings in the spark-shell.
Bringing up Demo Cluster
This demo system consists of the database, Hudi, MinIO, and Spark services. Run Docker compose to bring up the cluster:docker compose ps output is easier to read if you pipe it to jq:
Configure MinIO
When you run the Spark commands you will set the basepath for the table being created to ans3a URI:
huditest in MinIO. The MinIO console is running on port 9000.
Authenticate to MinIO
Open a browser to http://localhost:9000/ and authenticate. The username and password are specified indocker-compose.yml; they are admin and password.
Create a bucket
In the left navigation select Buckets, and then Create Bucket +. Name the buckethuditest and select Create Bucket

Create and populate a table, then sync it to Hive
Tip Run this command, and any otherdocker compose commands, from the directory containing the docker-compose.yml file.
Open spark-shell in the spark-hudi service
spark-shell starts about illegal reflective access. You can ignore these warnings.
Run these commands at the scala> prompt to:
- Configure this Spark session to load, process, and write data
- Create a dataframe and write that to a Hudi table
- Sync to the Hive Metastore
spark-shell session.
There will also be a warning:
Configure the database
Connect to the database
Connect to the database with the provided MySQL client provided by thestarrocks-fe service, or use your favorite SQL client and configure it to connect using the MySQL protocol on localhost:9030.
Create the linkage between the database and Hudi
There is a link at the end of this guide with more information on external catalogs. The external catalog created in this step acts as the linkage to the Hive Metastore (HMS) running in Docker.Use the new catalog
Navigate to the data inserted with Spark
Query the data in Hudi with the database
Run this query twice, the first time may take around five seconds to complete as data is not yet cached in the database. The second query will be very quick.\G instead
of a semicolon. The \G causes the mysql CLI to render the query results vertically.
Many SQL clients do not interpret vertical formatting output, so you should replace \G with ; if you are not using the mysql CLI.
Summary
This tutorial exposed you to the use of a database external catalog to show you that you can query your data where it sits using the Hudi external catalog. Many other integrations are available using Iceberg, Delta Lake, and JDBC catalogs. In this tutorial you:- Deployed the database and a Hudi/Spark/MinIO environment in Docker
- Loaded a tiny dataset into Hudi with Apache Spark
- Configured a database external catalog to provide access to the Hudi catalog
- Queried the data with SQL in the database without copying the data from the data lake