镜像编译
准备工作
1、创建目录
└── docker-build // 构建根目录
└── fe // FE 构建目录
├── dockerfile // dockerfile 脚本
└── resource // 资源目录
├── init_fe.sh // 启动及注册脚本
└── apache-doris-x.x.x-bin-fe.tar.gz // 二进制程序包
mkdir -p /opt/dockerfile/doris2/docker-build/be/resource
mkdir -p /opt/dockerfile/doris2/docker-build/fe/resource
-----------------
目录结构不一样 改动较大
-------------------
cp ~/soft/apache-doris-fe-1.2.4.1-bin-x86_64.tar.xz /opt/dockerfile/doris/docker-build/fe/resource
cp ~/soft/apache-doris-be-1.2.4.1-bin-x86_64.tar.xz /opt/dockerfile/doris/docker-build/be/resource
下载 init_fe.sh
doris/docker/runtime/fe/resource/init_fe.sh
下载 init_be.sh
doris/docker/runtime/be/resource/init_be.sh
#设置环境变量
FROM openjdk:8u342-jdk
# 下载软件至镜像内,可根据需要替换
ENV JAVA_HOME="/usr/local/openjdk-8/" \
PATH="/opt/apache-doris/fe/bin:$PATH"
ADD ./resource/apache-doris-fe-1.2.4.1-bin-x86_64.tar.xz /opt/
USER root
RUN apt-get update && \
apt-get install -y default-mysql-client && \
apt-get clean && \
mkdir /opt/apache-doris && \
cd /opt && \
mv apache-doris-fe-1.2.4.1-bin-x86_64 /opt/apache-doris/fe
ADD ./resource/init_fe.sh /opt/apache-doris/fe/bin
COPY ./resource/fe.conf /opt/apache-doris/fe/conf
RUN chmod 755 /opt/apache-doris/fe/bin/init_fe.sh && \
chmod 755 /opt/apache-doris/fe/bin/start_fe.sh && \
chmod 755 /opt/apache-doris/fe/bin/stop_fe.sh
# ENTRYPOINT ["/opt/apache-doris/fe/bin/init_fe.sh"]
CMD ./opt/apache-doris/fe/bin/init_fe.sh && tail -f /dev/null
/opt/dockerfile/doris/docker-build/fe 目录下执行
docker build . -t apache-doris:1.2.4.1-fe
docker tag apache-doris:1.2.4.1-fe 192.168.1.249:16443/bigdata/apache-doris:1.2.4.1-fe
docker push 192.168.1.249:16443/bigdata/apache-doris:1.2.4.1-fe
打包:
docker save -o apache-doris-1.2.4.1-fe.tar apache-doris:1.2.4.1-fe
load镜像:
docker load -i apache-doris-1.2.4.1-fe.tar
启动:
前期环境准备
需在宿主机执行如下命令
sysctl -w vm.max_map_count=2000000
修改后查看:
sysctl -a|grep vm.max_map_count
1 FE:
docker run -itd \
--name=fe \
--env FE_SERVERS="fe1:${当前机器的内网IP}:9010" \
--env FE_ID=1 \
-p 8030:8030 \
-p 9030:9030 \
-v /data/fe/doris-meta:/opt/apache-doris/fe/doris-meta \
-v /data/fe/log:/opt/apache-doris/fe/log \
--net=host \
apache/doris:2.0.0_alpha-fe-x86_64
docker run -itd --name=fe --env FE_SERVERS="fe1:192.168.1.244:9010" --env FE_ID=1 -p 8030:8030 -p 9030:9030 -v /data/fe/doris-meta:/opt/apache-doris/fe/doris-meta -v /data/fe/log:/opt/apache-doris/fe/log --net=host apache-doris:1.2.4.1-fe
docker ps -a 发现没有启动成功
docker logs fe 查看容器日志
docker rm fe 删除容器
docker rmi 4fa6fb409922 删除镜像
重新打包
发现是 SELinux 没有禁用
6、禁用 SELinux
# 临时关闭
setenforce 0
# 永久禁用
sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config
1 BE:
FROM openjdk:8u342-jdk
# 设置环境变量
ENV JAVA_HOME="/usr/local/openjdk-8/" \
PATH="/opt/apache-doris/be/bin:$PATH"
# 下载软件至镜像内,可根据需要替换
ADD ./resource/apache-doris-be-1.2.4.1-bin-x86_64.tar.xz /opt/
COPY ./resource/apache-doris-dependencies-1.2.4.1-bin-x86_64/java-udf-jar-with-dependencies.jar /opt/
RUN apt-get update && \
apt-get install -y default-mysql-client && \
apt-get clean && \
mkdir /opt/apache-doris && \
cd /opt && \
mv apache-doris-be-1.2.4.1-bin-x86_64 /opt/apache-doris/be && \
mv /opt/java-udf-jar-with-dependencies.jar /opt/apache-doris/be/lib
ADD ./resource/init_be.sh /opt/apache-doris/be/bin
COPY ./resource/be.conf /opt/apache-doris/be/conf
RUN chmod 755 /opt/apache-doris/be/bin/init_be.sh && \
chmod 755 /opt/apache-doris/be/bin/start_be.sh && \
chmod 755 /opt/apache-doris/be/bin/stop_be.sh
ENTRYPOINT ["/opt/apache-doris/be/bin/init_be.sh"]
/opt/dockerfile/doris/docker-build/be 目录下执行
docker build . -t apache-doris:1.2.4.1-be
docker tag apache-doris:1.2.4.1-be 192.168.1.249:16443/bigdata/apache-doris:1.2.4.1-be
docker push 192.168.1.249:16443/bigdata/apache-doris:1.2.4.1-be
打包:
docker save -o apache-doris-1.2.4.1-be.tar apache-doris:1.2.4.1-be
load镜像:
docker load -i apache-doris-1.2.4.1-be.tar
docker run -itd \
--name=be \
--env FE_SERVERS="fe1:${当前机器的内网IP}:9010" \
--env BE_ADDR="${当前机器的内网IP}:9050" \
-p 8040:8040 \
-v /data/be/storage:/opt/apache-doris/be/storage \
-v /data/be/log:/opt/apache-doris/be/log \
--net=host \
apache/doris:2.0.0_alpha-be-x86_64
docker run -itd --name=be --env FE_SERVERS="fe1:${当前机器的内网IP}:9010" --env BE_ADDR="${当前机器的内网IP}:9050" -p 8040:8040 -v /data/be/storage:/opt/apache-doris/be/storage -v /data/be/log:/opt/apache-doris/be/log --net=host apache/doris:2.0.0_alpha-be-x86_64
3台节点 需修改 BE_ADDR
docker run -itd --name=be --env FE_SERVERS="fe1:192.168.1.244:9010" --env BE_ADDR="192.168.1.244:9050" -p 8040:8040 -v /data/be/storage:/opt/apache-doris/be/storage -v /data/be/log:/opt/apache-doris/be/log --net=host apache-doris:1.2.4.1-be
docker run -itd --name=be --env FE_SERVERS="fe1:192.168.1.244:9010" --env BE_ADDR="192.168.1.243:9050" -p 8040:8040 -v /data/be/storage:/opt/apache-doris/be/storage -v /data/be/log:/opt/apache-doris/be/log --net=host apache-doris:1.2.4.1-be
docker run -itd --name=be --env FE_SERVERS="fe1:192.168.1.244:9010" --env BE_ADDR="192.168.1.249:9050" -p 8040:8040 -v /data/be/storage:/opt/apache-doris/be/storage -v /data/be/log:/opt/apache-doris/be/log --net=host apache-doris:1.2.4.1-be
登录容器
docker exec -it acb5a528184b bash
查看FE-Config: cat /opt/apache-doris/be/conf/be.conf
修改priority_networks参数,例如当前节点的 IP 地址为 10.10.2.21,则需要更改为 10.10.2.0/24 填入,这里需要填入的是 IP 子网网段地址,并非 IP 地址
sed -i 's/priority_networks = /priority_networks = 192.168.1.0\/24/g' /opt/apache-doris/be/conf/be.conf
更换为当前节点的IP子网网段地址
在容器内执行启动命令
/opt/apache-doris/be/bin/start_be.sh --daemon
查看日志:
tail -500f /opt/apache-doris/be/log/be.out
退出容器 exit
在Doris数据库中添加BE配置
mysql -uroot -P9030 -h192.168.1.244
ALTER SYSTEM ADD BACKEND "192.168.1.244:9050";
文章来源:https://uudwc.com/A/DNkdW
使用 mysql-client 连接到 FE,并执行show proc '/backends'\G; 查看 BE 运行情况。如一切正常,isAlive 列应为 true文章来源地址https://uudwc.com/A/DNkdW