This tutorial uses the docker method to deploy StreamPark via Docker.

Prepare

  1. Docker 1.13.1+
  2. Docker Compose 1.28.0+

1. Install docker

To start the service with docker, you need to install docker first

2. Install docker-compose

To start the service with docker-compose, you need to install docker-compose first

Apache StreamPark™ Deployment

1. Apache StreamPark™ deployment based on h2 and docker-compose

This method is suitable for beginners to learn and become familiar with the features. The configuration will reset after the container is restarted. Below, you can configure Mysql or Pgsql for persistence.

2. Deployment

  1. wget https://raw.githubusercontent.com/apache/incubator-streampark/dev/deploy/docker/docker-compose.yaml
  2. wget https://raw.githubusercontent.com/apache/incubator-streampark/dev/deploy/docker/.env
  3. docker-compose up -d

Once the service is started, StreamPark can be accessed through http://localhost:10000 and also through http://localhost:8081 to access Flink. Accessing the StreamPark link will redirect you to the login page, where the default user and password for StreamPark are admin and streampark respectively. To learn more about the operation, please refer to the user manual for a quick start.

Docker Tutorial - 图1

Docker Tutorial - 图2

Note:When configuring the flink-sessin cluster address, the ip address is not localhost, but the host network ip, which can be obtained through ifconfig

Docker Tutorial - 图3

Use existing Mysql services

This approach is suitable for enterprise production, where you can quickly deploy StreamPark based on docker and associate it with an online database Note: The diversity of deployment support is maintained through the .env configuration file, make sure there is one and only one .env file in the directory

  1. wget https://raw.githubusercontent.com/apache/incubator-streampark/dev/deploy/docker/docker-compose.yaml
  2. wget https://raw.githubusercontent.com/apache/incubator-streampark/dev/deploy/docker/mysql/.env
  3. vim .env

First, you need to create the “streampark” database in MySQL, and then manually execute the corresponding SQL found in the schema and data for the relevant data source.

After that, modify the corresponding connection information.

  1. SPRING_PROFILES_ACTIVE=mysql
  2. SPRING_DATASOURCE_URL=jdbc:mysql://localhost:3306/streampark?useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8
  3. SPRING_DATASOURCE_USERNAME=root
  4. SPRING_DATASOURCE_PASSWORD=streampark
  1. docker-compose up -d

Use existing Pgsql services

  1. wget https://raw.githubusercontent.com/apache/incubator-streampark/dev/deploy/docker/docker-compose.yaml
  2. wget https://raw.githubusercontent.com/apache/incubator-streampark/dev/deploy/docker/pgsql/.env
  3. vim .env

Modify the corresponding connection information

  1. SPRING_PROFILES_ACTIVE=pgsql
  2. SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/streampark?stringtype=unspecified
  3. SPRING_DATASOURCE_USERNAME=postgres
  4. SPRING_DATASOURCE_PASSWORD=streampark
  1. docker-compose up -d

Build images based on source code for Apache StreamPark™ deployment

  1. git clone https://github.com/apache/incubator-streampark.git
  2. cd incubator-streampark/deploy/docker
  3. vim docker-compose
  1. build:
  2. context: ../..
  3. dockerfile: deploy/docker/console/Dockerfile
  4. # image: ${HUB}:${TAG}

Docker Tutorial - 图4

  1. docker-compose up -d

Docker-Compse Configuration

The docker-compose.yaml file will reference the configuration from the env file, and the modified configuration is as follows:

  1. version: '3.8'
  2. services:
  3. ## streampark-console container
  4. streampark-console:
  5. ## streampark image
  6. image: apache/streampark:latest
  7. ## streampark image startup command
  8. command: ${
  9. RUN_COMMAND}
  10. ports:
  11. - 10000:10000
  12. ## Environment configuration file
  13. env_file: .env
  14. environment:
  15. ## Declare environment variable
  16. HADOOP_HOME: ${
  17. HADOOP_HOME}
  18. volumes:
  19. - flink:/streampark/flink/${
  20. FLINK}
  21. - /var/run/docker.sock:/var/run/docker.sock
  22. - /etc/hosts:/etc/hosts:ro
  23. - ~/.kube:/root/.kube:ro
  24. privileged: true
  25. restart: unless-stopped
  26. networks:
  27. - streampark
  28. ## flink-jobmanager container
  29. flink-jobmanager:
  30. image: ${
  31. FLINK_IMAGE}
  32. ports:
  33. - "8081:8081"
  34. command: jobmanager
  35. volumes:
  36. - flink:/opt/flink
  37. env_file: .env
  38. restart: unless-stopped
  39. privileged: true
  40. networks:
  41. - streampark
  42. ## streampark-taskmanager container
  43. flink-taskmanager:
  44. image: ${
  45. FLINK_IMAGE}
  46. depends_on:
  47. - flink-jobmanager
  48. command: taskmanager
  49. deploy:
  50. replicas: 1
  51. env_file: .env
  52. restart: unless-stopped
  53. privileged: true
  54. networks:
  55. - streampark
  56. networks:
  57. streampark:
  58. driver: bridge
  59. volumes:
  60. flink:

Finally, execute the start command:

  1. cd deploy/docker
  2. docker-compose up -d

You can use docker ps to check if the installation was successful. If the following information is displayed, it indicates a successful installation:

Docker Tutorial - 图5

Uploading Configuration to the Container

In the previous env file, HADOOP_HOME was declared, with the corresponding directory being “/streampark/hadoop”. Therefore, you need to upload the /etc/hadoop from the Hadoop installation package to the /streampark/hadoop directory. The commands are as follows:

  1. ## Upload Hadoop resources
  2. docker cp entire etc directory streampark-docker_streampark-console_1:/streampark/hadoop
  3. ## Enter the container
  4. docker exec -it streampark-docker_streampark-console_1 bash
  5. ## Check
  6. ls

Docker Tutorial - 图6

In addition, other configuration files, such as Maven’s settings.xml file, are uploaded in the same manner.