doris当前最新版本为1.2.3,本安装文档在官网的介绍下做了一点自己的修改,保证可用。我使用的是虚拟机安装,要保证设置10G的内存。

1、docker与docker-compose安装

     docker安装:CentOS安装Docker

     docker-compose安装:docker-compose安装与使用

2、资料准备与下载

文件名 文件来源 备注
apache-doris-be-1.2.3-bin-x86_64.tar.xz 官网下载  
apache-doris-fe-1.2.3-bin-x86_64.tar.xz 官网下载  
apache-doris-dependencies-1.2.3-bin-x86_64.tar.xz 官网下载  
init_fe.sh 下载 windows复制粘贴时要保证文件格式为unix,
init_be.sh 下载 windows复制粘贴时要保证文件格式为unix,首行#!/bin/env bash改为#!/bin/bash
docker-compose.yaml 参考文档下面说明  
Dockerfile 参考文档下面说明 FE节点Dockerfile
Dockerfile 参考文档下面说明 BE节点Dockerfile
java-udf-jar-with-dependencies.jar apache-doris-dependencies-1.2.3-bin-x86_64.tar.xz解压获取  

3、修改系统配置(设置完成后最好重启一下)

1)修改/etc/security/limits.conf,设置系统最大打开文件句柄数

vi /etc/security/limits.conf

添加如下信息:

* soft nofile 65536
* hard nofile 65536

执行下面命令查看配置是否生效

ulimit -Hn
ulimit -Sn

2)修改/etc/sysctl.conf文件

vi /etc/sysctl.conf

添加如下信息

vm.max_map_count=2000000

执行下面命令使配置生效

sysctl -p

3)关闭交换区

swapoff -a

4、构建Docker镜像并启动服务

1)将上面的文件拷贝到centos中,目录结构如下

└── home/doris-build                                            // 构建根目录 
    ├── fe                                                      // FE 构建目录
        ├── Dockerfile                                          // dockerfile 脚本
        └── resource                                            // 资源目录
            ├── init_fe.sh                                      // 启动及注册脚本
            └── apache-doris-fe-1.2.3-bin-x86_64.tar.xz 
    ├── be                                                      // FE 构建目录
        ├── Dockerfile                                          // dockerfile 脚本
        └── resource                                            // 资源目录
            ├── init_be.sh                                      // 启动及注册脚本
            ├── apache-doris-be-1.2.3-bin-x86_64.tar.xz 
            └── java-udf-jar-with-dependencies.jar
    └── docker-compose.yaml

2)创建Dockerfile和docker-compose.yaml文件

FE节点Dockerfile文件

FROM openjdk:8u342-jdk

ENV JAVA_HOME="/usr/local/openjdk-8/" \
    PATH="/opt/apache-doris/fe/bin:$PATH"

RUN sed -i "1ideb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" /etc/apt/sources.list
RUN sed -i "2ideb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" /etc/apt/sources.list
RUN sed -i "3ideb https://mirrors.aliyun.com/debian-security/ bullseye-security main" /etc/apt/sources.list
RUN sed -i "4ideb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main" /etc/apt/sources.list
RUN sed -i "5ideb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib" /etc/apt/sources.list
RUN sed -i "6ideb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib" /etc/apt/sources.list
RUN sed -i "7ideb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib" /etc/apt/sources.list
RUN sed -i "8ideb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib" /etc/apt/sources.list

RUN apt-get update
RUN apt-get install -y default-mysql-client
RUN apt-get clean

RUN mkdir /opt/apache-doris
ADD ./resource/apache-doris-fe-1.2.3-bin-x86_64.tar.xz /
RUN mv /apache-doris-fe-1.2.3-bin-x86_64 /opt/apache-doris/fe
ADD ./resource/init_fe.sh /opt/apache-doris/fe/bin

RUN chmod 755 /opt/apache-doris/fe/bin/init_fe.sh

ENTRYPOINT ["/opt/apache-doris/fe/bin/init_fe.sh"]

BE节点Dockerfile文件

FROM openjdk:8u342-jdk

ENV JAVA_HOME="/usr/local/openjdk-8/" \
    PATH="/opt/apache-doris/be/bin:$PATH"

RUN sed -i "1ideb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" /etc/apt/sources.list
RUN sed -i "2ideb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" /etc/apt/sources.list
RUN sed -i "3ideb https://mirrors.aliyun.com/debian-security/ bullseye-security main" /etc/apt/sources.list
RUN sed -i "4ideb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main" /etc/apt/sources.list
RUN sed -i "5ideb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib" /etc/apt/sources.list
RUN sed -i "6ideb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib" /etc/apt/sources.list
RUN sed -i "7ideb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib" /etc/apt/sources.list
RUN sed -i "8ideb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib" /etc/apt/sources.list

RUN apt-get update
RUN apt-get install -y default-mysql-client
RUN apt-get clean

RUN mkdir /opt/apache-doris
ADD ./resource/apache-doris-be-1.2.3-bin-x86_64.tar.xz /
RUN mv /apache-doris-be-1.2.3-bin-x86_64 /opt/apache-doris/be
ADD ./resource/java-udf-jar-with-dependencies.jar /opt/apache-doris/be/lib
ADD ./resource/init_be.sh /opt/apache-doris/be/bin

RUN chmod 755 /opt/apache-doris/be/bin/init_be.sh

ENTRYPOINT ["/opt/apache-doris/be/bin/init_be.sh"]

docker-compose.yaml

version: '3'
services:
  docker-fe:
    image: "apache-doris-fe:1.2.3"
    container_name: "doris-fe"
    hostname: "fe"
    environment:
      - FE_SERVERS=fe1:172.20.80.2:9010
      - FE_ID=1
    ports:
      - 8030:8030
      - 9030:9030
    volumes:
      - /data/fe/doris-meta:/opt/apache-doris/fe/doris-meta
      - /data/fe/conf:/opt/apache-doris/fe/conf
      - /data/fe/log:/opt/apache-doris/fe/log
    networks:
      doris_net:
        ipv4_address: 172.20.80.2
  docker-be:
    image: "apache-doris-be:1.2.3"
    container_name: "doris-be"
    hostname: "be"
    depends_on:
      - docker-fe
    environment:
      - FE_SERVERS=fe1:172.20.80.2:9010
      - BE_ADDR=172.20.80.3:9050
    ports:
      - 8040:8040
    volumes:
      - /data/be/storage:/opt/apache-doris/be/storage
      - /data/be/conf:/opt/apache-doris/be/conf
      - /data/be/script:/docker-entrypoint-initdb.d
      - /data/be/log:/opt/apache-doris/be/log
    networks:
      doris_net:
        ipv4_address: 172.20.80.3
networks:
  doris_net:
    ipam:
      config:
        - subnet: 172.20.80.0/16

3)构建镜像

cd /home/doris-build/fe
docker build . -t apache-doris-be:1.2.3

cd /home/doris-build/be
docker build . -t apache-doris-be:1.2.3

4)启动服务

cd /home/doris-build
docker-compose up -d

5)开放防火墙端口

firewall-cmd --zone=public --add-port=8030/tcp --permanent     # 开放8030端口
firewall-cmd --zone=public --add-port=9030/tcp --permanent     # 开放9030端口
firewall-cmd --reload                                          # 重新载入配置,让开放或关闭的端口配置生效

 

安装过程中的问题:

1、exec /init_fe.sh: no such file or directory。原因:1)init_be.sh格式为doc,而不是unix,参考:https://www.cnblogs.com/zhi-leaf/p/17274049.html

2、exec /init_be.sh: no such file or directory。原因:1)init_be.sh格式为doc,而不是unix;2)文件内容首行要改成#!/bin/bash,不知道为啥。

3、be节点无法启动。原因有:1)内存不足;2)文件句柄数量未修改,max_map_count未修改;

posted on 2023-04-12 20:36  玄同太子  阅读(979)  评论(0编辑  收藏  举报