This article introduces how to build a Flink environment using docker-compose. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
docker-compose Introduction
docker-compose is a tool used to automate docker. With docker-compose, you can automate all complex docker operations with just one command.
In layman's terms, our usual operation of docker is still a very primitive series of actions. Your actions of manually using docker can be split into:
找到一个系统镜像 // docker search 安装好 vm 或者 virtual box // apt-get install docker 在 vm 中安装镜像 // docker run -d -it 你的镜像
This is the smallest action. If You have to map the hard disk, set up a NAT network or a bridged network, etc... You have to do more docker operations, which is obviously very inefficient.
But it’s fine if we write it in docker-compose.yaml. You only need to run docker-compose up -d after writing it to start.
Install docker-compse
Download the latest version of docker-compose file:
sudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
Add executable permissions
sudo chmod +x /usr/local/bin/docker-compose
Test Installation results
docker-compose --version
Installation flink
In the specified directory, create a new docker-compose.yml file as follows:
version: "3" services: jobmanager: image: flink:latest expose: - "6123" ports: - "8081:8081" command: jobmanager environment: - JOB_MANAGER_RPC_ADDRESS=jobmanager taskmanager: image: flink:latest expose: - "6121" - "6122" depends_on: - jobmanager command: taskmanager links: - "jobmanager:jobmanager" environment: - JOB_MANAGER_RPC_ADDRESS=jobmanager
The meaning of the file is, first Based on the latest flink image, start a jobmanager, and then start a taskmanager based on the jobmanager and flink image.
After the new creation is completed, docker-compose up in the current directory. Then visit localhost:8081 to view the results. Here 8081 is the port opened by jobmanager.
If the taskmanager page has configuration data, it means that flink has been deployed successfully.
Related recommendations: "docker usage tutorial"
The above is the detailed content of An article explaining how docker-compose creates a Flink environment. For more information, please follow other related articles on the PHP Chinese website!