赞
踩
sudo yum install -y docker
sudo usermod -a -G docker sudouser
sudo service docker start
docker -v
Docker version 20.10.17, build 100c701
设置镜像源:
sudo vim /etc/docker/daemon.json
{
"registry-mirrors": [
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn",
"https://registry.docker-cn.com"
]
}
部署计划:
1、 将dolphinscheduler解压
2、 把master-server放到/opt/software/dolphinscheduler/master/路径下
3、把worker-server放到/opt/software/dolphinscheduler/worker/路径下
4、把api-server放到/opt/software/dolphinscheduler/api/路径下
5、把alert-server放到/opt/software/dolphinscheduler/alert/路径下
目的:
这样做的目的是把docker起来后,将以上的路径统一挂载到docker的/opt/dolphinscheduler路径下(运行镜像的 -v参数)
统一使用CMD [ “/bin/bash”, “/opt/dolphinscheduler/bin/start.sh” ] 这个命令运行
vim dockerfile
FROM openjdk:8-jre-slim-buster
ENV DOCKER true
ENV TZ Asia/Shanghai
ENV DOLPHINSCHEDULER_HOME /opt/dolphinscheduler
WORKDIR $DOLPHINSCHEDULER_HOME
EXPOSE 12345
RUN apt update ; \
apt install -y curl sudo ; \
rm -rf /var/lib/apt/lists/*
CMD [ "/bin/bash", "/opt/dolphinscheduler/bin/start.sh" ]
docker build -t dolphinscheduler-master:v1 .
vim dockerfile
FROM openjdk:8-jre-slim-buster
ENV DOCKER true
ENV TZ Asia/Shanghai
ENV DOLPHINSCHEDULER_HOME /opt/dolphinscheduler
RUN apt update ; \
apt-get update ; \
apt install -y curl sudo ssh vim telnet net-tools; \
rm -rf /var/lib/apt/lists/*
WORKDIR $DOLPHINSCHEDULER_HOME
EXPOSE 1235
CMD [ "/bin/bash", "/opt/dolphinscheduler/bin/start.sh" ]
docker build -t dolphinscheduler-worker:v1 .
--worker需要带有curl sudo ssh vim telnet net-tools,其他节点不需要
vim dockerfile
FROM openjdk:8-jre-slim-buster
ENV DOCKER true
ENV TZ Asia/Shanghai
ENV DOLPHINSCHEDULER_HOME /opt/dolphinscheduler
RUN apt update ; \
apt install -y curl ; \
rm -rf /var/lib/apt/lists/*
WORKDIR $DOLPHINSCHEDULER_HOME
EXPOSE 12345 25333
CMD [ "/bin/bash", "/opt/dolphinscheduler/bin/start.sh" ]
docker build -t dolphinscheduler-api-server:v1 .
vim dockerfile
FROM openjdk:8-jre-slim-buster
ENV DOCKER true
ENV TZ Asia/Shanghai
ENV DOLPHINSCHEDULER_HOME /opt/dolphinscheduler
RUN apt update ; \
apt install -y curl ; \
rm -rf /var/lib/apt/lists/*
WORKDIR $DOLPHINSCHEDULER_HOME
EXPOSE 50052 50053
CMD [ "/bin/bash", "/opt/dolphinscheduler/bin/start.sh" ]
docker build -t dolphinscheduler-alert-server:v1 .
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.7.1/apache-zookeeper-3.7.1-bin.tar.gz
tar -zxvf apache-zookeeper-3.7.1-bin.tar.gz
mv apache-zookeeper-3.7.1-bin ../software/zookeeper
mv zoo_sample.cfg zoo.cfg
vim zoo.cfg
修改zk数据目录 /opt/software/zookeeper/data
docker run -d --name dolphinscheduler-master \
-e DATABASE="mysql" \
-e SPRING_DATASOURCE_URL="jdbc:mysql://x.x.x.x:3306/dolphinscheduler?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true" \
-e SPRING_DATASOURCE_USERNAME="x.x.x.x" \
-e SPRING_DATASOURCE_PASSWORD="x.x.x.x" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
-v /opt/software/dolphinscheduler/master/:/opt/dolphinscheduler/ \
--net host \
-d dolphinscheduler-master:v1
docker run -d --name dolphinscheduler-worker \
-e DATABASE="mysql" \
-e SPRING_DATASOURCE_URL="jdbc:mysql://x.x.x.x:3306/dolphinscheduler?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true" \
-e SPRING_DATASOURCE_USERNAME="x.x.x.x" \
-e SPRING_DATASOURCE_PASSWORD="x.x.x.x" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
-v /opt/software/dolphinscheduler/worker/:/opt/dolphinscheduler/ \
--hostname x.x.x.x \
--network=docker-mynet \
--ip x.x.x.x \
-d dolphinscheduler-worker:v1
docker run -d --name dolphinscheduler-api \
-e DATABASE="mysql" \
-e SPRING_DATASOURCE_URL="jdbc:mysql://x.x.x.x:3306/dolphinscheduler?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true" \
-e SPRING_DATASOURCE_USERNAME="x.x.x.x" \
-e SPRING_DATASOURCE_PASSWORD="x.x.x.x" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
-v /opt/software/dolphinscheduler/api/:/opt/dolphinscheduler/ \
--net host \
-d dolphinscheduler-api-server:v1
docker run -d --name dolphinscheduler-alert-server \
-e DATABASE="mysql" \
-e SPRING_DATASOURCE_URL="jdbc:mysql://x.x.x.x:3306/dolphinscheduler?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true" \
-e SPRING_DATASOURCE_USERNAME="x.x.x.x" \
-e SPRING_DATASOURCE_PASSWORD="x.x.x.x" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
-v /opt/software/dolphinscheduler/alert/:/opt/dolphinscheduler/ \
--net host \
-d dolphinscheduler-alert-server:v1
docker ps -aq
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images -q)
docker logs -f -t --since="20187-7-30" --tail=10 docker_container_name
--since : 此参数指定了输出日志开始日期,即只输出指定日期之后的日志。
-f : 查看实时日志
-t : 查看日志产生的日期
-tail=10 : 查看最后的10条日志。
docker_container_name : 容器名称
docker exec -it 5b1304e1159e /bin/bash
CMD ["tail","-f","/dev/null"]
docker commit -m "save images" fb044b8fc877 dolphinscheduler-worker:v2.0
docker network create --subnet=172.172.0.0/24 docker-mynet
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。