Installation (Docker)
1. Environment Preparation
To install StreamPark using Docker, you need to prepare the following environment:
Item | Version | Required | Other |
Docker | 1.13.1+ | Docker version must be at least 1.13.1 | |
Docker Compose | 1.28.0+ | Docker Compose version must be at least 1.28.0 |
This guide assumes that Docker
and Docker Compose
are already installed.
2. Packaging Image
This section explains how to manually package the image. First, follow the steps below to download the StreamPark source code. After switching branches, place the packaged installation files into the dist
directory:
## Clone the source code to your local machine
git clone https://github.com/apache/streampark.git
## Navigate to the docker directory
cd streampark/docker
## Switch to the desired branch, in this case, the release-2.1.5 branch
git checkout release-2.1.5
## Create the dist directory
mkdir dist
After creating the dist
directory, you can place the packaged or downloaded installation files into the dist
directory. For demonstration purposes, we directly use the installation package downloaded from the official website.
Download link: https://streampark.apache.org/download
Now you can begin building the image:
## Note: Ensure the installation package is placed in the dist directory
# cp path/to/apache-streampark_2.12-2.1.5-incubating-bin.tar.gz dist
## Build the image, note that the image name format is: <apache/streampark>:<version>, ensure to include the "."
docker build -t apache/streampark:2.1.5 .
## After the build, use this command to check if the image has been built successfully
docker images|grep streampark
Use the docker
command to verify that the image was built successfully, as shown below:
3. Start Service
In the current StreamPark source's docker
directory, you can start the service using the docker-compose
command:
docker-compose up -d
After starting, use the following command to check if the StreamPark service is running correctly:
docker ps -a|grep streampark
From the image below, you can see that the StreamPark service has started successfully:
To access StreamPark, visit: http://127.0.0.1:10000
Login credentials: admin / streampark
You should see successful login!
4. Configuration
As seen above, StreamPark is started using the docker-compose
command. The docker-compose.yaml
file is a configuration file used to define and manage multi-container Docker applications. Its contents and explanation are as follows:
version: '3.8'
services:
streampark:
image: apache/streampark:2.1.5 # Use the previously built image
ports:
- "10000:10000" # Map port 10000 of the container to port 10000 of the host to allow access to the service on that port
environment:
- TZ=Asia/Shanghai # Container's timezone
- DATASOURCE_DIALECT=h2 # Set the datasource dialect, supports h2, mysql, pgsql, currently set to h2
# If using MySQL or PostgreSQL, set the following parameters:
# - DATASOURCE_URL=jdbc:mysql://localhost:3306/streampark?useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8
# - DATASOURCE_URL=jdbc:postgresql://localhost:5432/streampark?stringtype=unspecified
# - DATASOURCE_USERNAME=root # Database username
# - DATASOURCE_PASSWORD=streampark # Database password
volumes:
- /var/run/docker.sock:/var/run/docker.sock # Mount the host's Docker socket inside the container to allow interaction with Docker
- /etc/hosts:/etc/hosts:ro # Mount the host's /etc/hosts file inside the container, read-only access
- ~/.kube:/root/.kube:ro # Mount the host's kube configuration directory inside the container to access the Kubernetes cluster
privileged: true # Grant the container higher privileges, typically for scenarios requiring interaction with host resources
restart: always # Ensure the container always restarts after crashes or host reboots
networks:
- streampark # Use a custom network named streampark
healthcheck: # Set a health check
test: [ "CMD", "curl", "http://streampark:10000" ] # Use curl to check if port 10000 of the container is accessible
interval: 5s # Health check interval is 5 seconds
timeout: 5s # Timeout for each health check is 5 seconds
retries: 120 # The container will be considered unhealthy after 120 failed health checks
networks:
streampark:
driver: bridge # Use the bridge network driver