Reference document: doris docker deployment version 1.2.4.1 (ngui.cc)
Build Docker Image - Apache Doris
mirror compilation
Preparation
1. Create a directory
└── docker-build // build root directory
└── fe // FE build directory
├── dockerfile // dockerfile script
└── resource // resource directory
├── init_fe.sh // startup and registration script
└─ ─ apache-doris-xxx-bin-fe.tar.gz // binary package
mkdir -p /opt/dockerfile/doris/docker-build/be/resource
mkdir -p /opt/dockerfile/doris/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
Download init_fe.sh
doris/docker/runtime/fe/resource/init_fe.sh
Download init_be.sh
doris/docker/runtime/be/resource/init_be.sh
#Set environment variables
FROM openjdk:8u342-jdk
# Download the software to the mirror, and replace
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
Execute under /opt/dockerfile/doris/docker-build/fe directory
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
Pack:
docker save -o apache-doris-1.2.4.1-fe.tar apache-doris:1.2.4.1-fe
load image:
docker load -i apache-doris-1.2.4.1-fe.tar
start up:
Pre-environment preparation
The following command needs to be executed on the host machine
sysctl -w vm.max_map_count=2000000
View after modification:
sysctl -a|grep vm.max_map_count
1 FE:
docker run -itd \
--name=fe \
--env FE_SERVERS="fe1:${intranet IP of current machine}: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 found that it did not start successfully
docker logs fe view container logs
docker rm fe delete container
docker rmi 4fa6fb409922 delete image
repackage
Found that SELinux is not disabled
6. Disable SELinux
# temporarily close
setenforce 0
# permanently disable
sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config
1 BE:
FROM openjdk:8u342-jdk
# Set the environment variable
ENV JAVA_HOME="/usr/local/openjdk-8/" \
PATH="/opt/apache-doris/be/bin:$PATH"
# Download the software to the mirror, you can replace
ADD as needed ./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"]
Execute under /opt/dockerfile/doris/docker-build/be directory
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
Pack:
docker save -o apache-doris-1.2.4.1-be.tar apache-doris:1.2.4.1-be
load image:
docker load -i apache-doris-1.2.4.1-be.tar
docker run -itd \
--name=be \
--env FE_SERVERS="fe1:${intranet IP of the current machine}:9010" \
--env BE_ADDR="${intranet IP of the current machine}: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:${intranet IP of the current machine}:9010" --env BE_ADDR="${intranet IP of the current machine}: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 nodes need to modify 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
login container
docker exec -it acb5a528184b bash
View FE-Config: cat /opt/apache-doris/be/conf/be.conf
Modify the priority_networks parameter. For example, if the IP address of the current node is 10.10.2.21, it needs to be changed to 10.10.2.0/24 to fill in. What needs to be filled in here is the address of the IP subnet, not the IP address.
sed -i 's/priority_networks = /priority_networks = 192.168.1.0\/24/g' /opt/apache-doris/be/conf/be.conf
Replace it with the IP subnet address of the current node
Execute the start command inside the container
/opt/apache-doris/be/bin/start_be.sh --daemon
View logs:
tail -500f /opt/apache-doris/be/log/be.out
Exit the container exit
Add BE configuration in Doris database
mysql -uroot -P9030 -h192.168.1.244
ALTER SYSTEM ADD BACKEND "192.168.1.244:9050";
Use mysql-client to connect to FE, and execute show proc '/backends'\G; to check the running status of BE. If all is well, the isAlive column should be true