安装 Docker 和 Docker Compose(已经安装可以跳过)
首先,确保你的 Ubuntu 系统是更新过的,可以使用以下命令更新软件包列表:
sudo apt-get update
安装 Docker,运行以下命令:
sudo apt-get install -y docker.io
安装完成后,将当前用户添加到docker
用户组,以便能够以非sudo
权限运行docker
命令(需要注销并重新登录才能生效):
sudo usermod -aG docker $USER
安装 Docker Compose。可以从官方 GitHub 仓库下载适合 Ubuntu 的二进制文件,也可以使用以下命令通过 Python 软件包管理器pip
安装(确保已经安装了pip
):
sudo pip install docker-compose
搭建过程
下载源码包 apache-dolphinscheduler-2.0.5-src.tar.gz,下载地址: 下载,解压:
$ tar -zxvf apache-dolphinscheduler-2.0.5-src.tar.gz$ cd apache-dolphinscheduler-2.0.5-src/docker/docker-swarm
拉取镜像:
$ docker pull dolphinscheduler.docker.scarf.sh/apache/dolphinscheduler:2.0.5
启动容器:
$ docker-compose up -d
出现问题:
解决:
因为原来的配置文件里的ZooKeeper那个版本已经下架了,需要修改apache-dolphinscheduler-2.0.5-src/docker/docker-swarm
目录下的docker-compose.yml
:
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.version: "3.1"services:dolphinscheduler-postgresql:image: bitnami/postgresql:11.11.0environment:TZ: Asia/ShanghaiPOSTGRESQL_USERNAME: rootPOSTGRESQL_PASSWORD: rootPOSTGRESQL_DATABASE: dolphinschedulervolumes:- dolphinscheduler-postgresql:/bitnami/postgresqlrestart: unless-stoppednetworks:- dolphinschedulerdolphinscheduler-zookeeper:image: bitnami/zookeeper:3.8.4environment:TZ: Asia/ShanghaiALLOW_ANONYMOUS_LOGIN: "yes"ZOO_4LW_COMMANDS_WHITELIST: srvr,ruok,wchs,consvolumes:- dolphinscheduler-zookeeper:/bitnami/zookeeperrestart: unless-stoppednetworks:- dolphinschedulerdolphinscheduler-api:image: apache/dolphinscheduler:2.0.4command: api-serverports:- 12345:12345environment:TZ: Asia/Shanghaienv_file: config.env.shhealthcheck:test: ["CMD", "/root/checkpoint.sh", "ApiApplicationServer"]interval: 30stimeout: 5sretries: 3depends_on:- dolphinscheduler-postgresql- dolphinscheduler-zookeepervolumes:- dolphinscheduler-logs:/opt/dolphinscheduler/logs- dolphinscheduler-shared-local:/opt/soft- dolphinscheduler-resource-local:/dolphinschedulerrestart: unless-stoppednetworks:- dolphinschedulerdolphinscheduler-alert:image: apache/dolphinscheduler:2.0.4command: alert-serverenvironment:TZ: Asia/Shanghaienv_file: config.env.shhealthcheck:test: ["CMD", "/root/checkpoint.sh", "AlertServer"]interval: 30stimeout: 5sretries: 3depends_on:- dolphinscheduler-postgresqlvolumes:- dolphinscheduler-logs:/opt/dolphinscheduler/logsrestart: unless-stoppednetworks:- dolphinschedulerdolphinscheduler-master:image: apache/dolphinscheduler:2.0.4command: master-serverenvironment:TZ: Asia/Shanghaienv_file: config.env.shhealthcheck:test: ["CMD", "/root/checkpoint.sh", "MasterServer"]interval: 30stimeout: 5sretries: 3depends_on:- dolphinscheduler-postgresql- dolphinscheduler-zookeepervolumes:- dolphinscheduler-logs:/opt/dolphinscheduler/logs- dolphinscheduler-shared-local:/opt/softrestart: unless-stoppednetworks:- dolphinschedulerdolphinscheduler-worker:image: apache/dolphinscheduler:2.0.5command: worker-serverenvironment:TZ: Asia/Shanghaienv_file: config.env.shhealthcheck:test: ["CMD", "/root/checkpoint.sh", "WorkerServer"]interval: 30stimeout: 5sretries: 3depends_on:- dolphinscheduler-postgresql- dolphinscheduler-zookeepervolumes:- dolphinscheduler-worker-data:/tmp/dolphinscheduler- dolphinscheduler-logs:/opt/dolphinscheduler/logs- dolphinscheduler-shared-local:/opt/soft- dolphinscheduler-resource-local:/dolphinschedulerrestart: unless-stoppednetworks:- dolphinschedulernetworks:dolphinscheduler:driver: bridgevolumes:dolphinscheduler-postgresql:dolphinscheduler-zookeeper:dolphinscheduler-worker-data:dolphinscheduler-logs:dolphinscheduler-shared-local:dolphinscheduler-resource-local:
启动成功:
访问前端页面:http://localhost:12345/dolphinscheduler,默认的用户是admin
,默认的密码是dolphinscheduler123
。
停止服务:
$ docker stop $(docker ps -q)$ sudo systemctl stop docker