欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 社会 > Doris 2.1.7 集群安装

Doris 2.1.7 集群安装

2024/11/29 14:23:23 来源:https://blog.csdn.net/alksjdfp32r/article/details/144114495  浏览:    关键词:Doris 2.1.7 集群安装


Download


https://doris.apache.org/download

cd /root/doris/wget https://apache-doris-releases.oss-accelerate.aliyuncs.com/apache-doris-2.1.7-bin-x64.tar.gztar -xvf apache-doris-2.1.7-bin-x64.tar.gz

准备镜像文件

参考:Doris 2.1.7镜像制作-CSDN博客

整理fe和be的配置文件


可参考


/root/doris/apache-doris-2.1.7-bin-x64/fe/conf/fe.conf
/root/doris/apache-doris-2.1.7-bin-x64/be/conf/be.conf

开启FQDN


enable_fqdn_mode = true


内存不够,可适当调小些


JAVA_OPTS

min_replication_num_per_tablet  表示be 副本数

fe.conf

# 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.
#####################################################################
## The uppercase properties are read and exported by bin/start_fe.sh.
## To see all Frontend configurations,
## see fe/src/org/apache/doris/common/Config.java
#####################################################################
CUR_DATE=`date +%Y%m%d-%H%M%S`
# the output dir of stderr and stdout
LOG_DIR = ${DORIS_HOME}/log
JAVA_OPTS="-server -Xmx10g -Xmn5g -Xms6g -XX:+UseMembar -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=15 -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=65 -XX:SoftRefLRUPolicyMSPerMB=0 -Xloggc:$DORIS_HOME/log/fe.gc.log.$DATE"
# For jdk 9+, this JAVA_OPTS will be used as default JVM options
JAVA_OPTS_FOR_JDK_9="-Xss4m -Xmx8192m -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=7 -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -Xlog:gc*:$DORIS_HOME/log/fe.gc.log.$CUR_DATE:time"
enable_fqdn_mode = true
##
## the lowercase properties are read by main program.
##
# INFO, WARN, ERROR, FATAL
sys_log_level = INFO
# NORMAL, BRIEF, ASYNC
sys_log_mode = NORMAL
# store metadata, must be created before start FE.
# Default value is ${DORIS_HOME}/doris-meta
# meta_dir = ${DORIS_HOME}/doris-meta
# Default dirs to put jdbc drivers,default value is ${DORIS_HOME}/jdbc_drivers
# jdbc_drivers_dir = ${DORIS_HOME}/jdbc_drivers
http_port = 8030
rpc_port = 9020
query_port = 9030
edit_log_port = 9010
min_replication_num_per_tablet = 1
# Choose one if there are more than one ip except loopback address.
# Note that there should at most one ip match this list.
# If no ip match this rule, will choose one randomly.
# use CIDR format, e.g. 10.10.10.0/24 or IP format, e.g. 10.10.10.1
# Default value is empty.
# priority_networks = 10.10.10.0/24;192.168.0.0/16
# Advanced configurations
# log_roll_size_mb = 1024
# sys_log_dir = ${DORIS_HOME}/log
# sys_log_roll_num = 10
# sys_log_verbose_modules = org.apache.doris
# audit_log_dir = ${DORIS_HOME}/log
# audit_log_modules = slow_query, query
# audit_log_roll_num = 10
# meta_delay_toleration_second = 10
# qe_max_connection = 1024
# qe_query_timeout_second = 300
# qe_slow_log_ms = 5000

be.conf

# 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.
CUR_DATE=`date +%Y%m%d-%H%M%S`
PPROF_TMPDIR="$DORIS_HOME/log/"
JAVA_OPTS="-Xmx1024m -DlogPath=$DORIS_HOME/log/jni.log -Xloggc:$DORIS_HOME/log/be.gc.log.$CUR_DATE -Dsun.java.command=DorisBE -XX:-CriticalJNINatives -DJDBC_MIN_POOL=1 -DJDBC_MAX_POOL=100 -DJDBC_MAX_IDLE_TIME=300000 -DJDBC_MAX_WAIT_TIME=5000"
# For jdk 9+, this JAVA_OPTS will be used as default JVM options
JAVA_OPTS_FOR_JDK_9="-Xmx1024m -DlogPath=$DORIS_HOME/log/jni.log -Xlog:gc:$DORIS_HOME/log/be.gc.log.$CUR_DATE -Dsun.java.command=DorisBE -XX:-CriticalJNINatives -DJDBC_MIN_POOL=1 -DJDBC_MAX_POOL=100 -DJDBC_MAX_IDLE_TIME=300000 -DJDBC_MAX_WAIT_TIME=5000"
# since 1.2, the JAVA_HOME need to be set to run BE process.
# JAVA_HOME=/path/to/jdk/
# https://github.com/apache/doris/blob/master/docs/zh-CN/community/developer-guide/debug-tool.md#jemalloc-heap-profile
# https://jemalloc.net/jemalloc.3.html
JEMALLOC_CONF="percpu_arena:percpu,background_thread:true,metadata_thp:auto,muzzy_decay_ms:15000,dirty_decay_ms:15000,oversize_threshold:0,lg_tcache_max:20,prof:false,lg_prof_interval:32,lg_prof_sample:19,prof_gdump:false,prof_accum:false,prof_leak:false,prof_final:false"
JEMALLOC_PROF_PRFIX=""
enable_fqdn_mode = true
# INFO, WARNING, ERROR, FATAL
sys_log_level = INFO
# ports for admin, web, heartbeat service
be_port = 9060
webserver_port = 8040
heartbeat_service_port = 9050
brpc_port = 8060
# HTTPS configures
enable_https = false
# path of certificate in PEM format.
ssl_certificate_path = "$DORIS_HOME/conf/cert.pem"
# path of private key in PEM format.
ssl_private_key_path = "$DORIS_HOME/conf/key.pem"
# enable auth check
enable_auth = false
# Choose one if there are more than one ip except loopback address.
# Note that there should at most one ip match this list.
# If no ip match this rule, will choose one randomly.
# use CIDR format, e.g. 10.10.10.0/24 or IP format, e.g. 10.10.10.1
# Default value is empty.
# priority_networks = 10.10.10.0/24;192.168.0.0/16
# data root path, separate by ';'
# you can specify the storage medium of each root path, HDD or SSD
# you can add capacity limit at the end of each root path, separate by ','
# eg:
# storage_root_path = /home/disk1/doris.HDD,50;/home/disk2/doris.SSD,1;/home/disk2/doris
# /home/disk1/doris.HDD, capacity limit is 50GB, HDD;
# /home/disk2/doris.SSD, capacity limit is 1GB, SSD;
# /home/disk2/doris, capacity limit is disk capacity, HDD(default)
#
# you also can specify the properties by setting '<property>:<value>', separate by ','
# property 'medium' has a higher priority than the extension of path
#
# Default value is ${DORIS_HOME}/storage, you should create it by hand.
# storage_root_path = ${DORIS_HOME}/storage
# Default dirs to put jdbc drivers,default value is ${DORIS_HOME}/jdbc_drivers
# jdbc_drivers_dir = ${DORIS_HOME}/jdbc_drivers
# Advanced configurations
# sys_log_dir = ${DORIS_HOME}/log
# sys_log_roll_mode = SIZE-MB-1024
# sys_log_roll_num = 10
# sys_log_verbose_modules = *
# log_buffer_level = -1
# palo_cgroups
string_type_length_soft_limit_bytes = 104857600
disable_storage_page_cache = false


集群整体规划

三个FE,三个BE。

NFS


准备三台机器,分别挂载一个NFS,如何挂载可参考:
https://www.cnblogs.com/zengqinglei/p/17131046.html

https://blog.csdn.net/qq_43239389/article/details/141187232

创建挂载目录

mkdir /yournfs/data/doris/0/fe -p
mkdir /yournfs/data/doris/0/fe/conf -p
mkdir /yournfs/data/doris/0/be/conf -p
mkdir /yournfs/data/doris/0/be/storage -p
mkdir /yournfs/data/doris/1/fe -p
mkdir /yournfs/data/doris/1/fe/conf -p
mkdir /yournfs/data/doris/1/be/conf -p
mkdir /yournfs/data/doris/1/be/storage -p
mkdir /yournfs/data/doris/2/fe -p
mkdir /yournfs/data/doris/2/fe/conf -p
mkdir /yournfs/data/doris/2/be/conf -p
mkdir /yournfs/data/doris/2/be/storage -p
chmod 777 /yournfs/data/doris/ -R

HOSTNAME


在三台机器的 /etc/hosts 文件中加上下面 yml 配置中的 hostname

echo "192.168.10.101 fe-01
192.168.10.101 be-01
192.168.10.102 fe-02
192.168.10.102 be-02
192.168.10.103 fe-03
192.168.10.103 be-03" >> /etc/hostscat /etc/hosts

不过最好是把这些机器别名放在/etc/hosts文件头部位置 ,避免因为该IP有其它别名时Doris优先识别其它的别名,导致启动问题。

docker-compose

安装docker-compose

wget https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-x86_64
cp docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version


编写 docker-compose.yml 文件

然后复制到每台机器上
主要修改内容(直接使用sed替换即可 sed -i 's/fe-01/fe-02/g' fe.conf)

fe-01
be-01
FE_SERVERS的内容
FE_ID=1
BE_ADDR=当前机器IP:9050


cat docker-compose.yml


version: "3"
services:doris-fe-01:image: yourharbor/selectdb/doris_fe:2.1.7container_name: doris-fe-01hostname: fe-01ports:- "8030:8030"- "9030:9030"- "9010:9010"environment:- FE_SERVERS=fe1:192.168.10.101:9010,fe2:192.168.10.102:9010,fe3:192.168.10.103:9010- FE_ID=1#- TZ=Asia/Shanghaivolumes:- /nfs/data/doris/0/fe/doris-meta/:/opt/apache-doris/fe/doris-meta/- /nfs/data/doris/0/fe/log/:/opt/apache-doris/fe/log/- /nfs/data/doris/0/fe/conf/fe.conf:/opt/apache-doris/fe/conf/fe.confnetwork_mode: hostdeploy:resources:limits:cpus: '8'memory: 32Greservations:cpus: '4'memory: 16Gdoris-be-01:image: yourharbor/selectdb/doris_be:2.1.7container_name: doris-be-01hostname: be-01ports:- "9050:9050"- "8040:8040"environment:- FE_SERVERS=fe1:192.168.10.101:9010,fe2:192.168.10.102:9010,fe3:192.168.10.103:9010- BE_ADDR=192.168.10.101:9050#- TZ=Asia/Shanghaivolumes:- /nfs/data/doris/0/be/storage/:/opt/apache-doris/be/storage/- /nfs/data/doris/0/be/script/:/docker-entrypoint-initdb.d/- /nfs/data/doris/0/be/conf/be.conf:/opt/apache-doris/be/conf/be.confnetwork_mode: hostdepends_on:- doris-fe-01deploy:resources:limits:cpus: '8'memory: 32Greservations:cpus: '4'memory: 16G

启动服务

分别在三台机器上docker-compose启动服务

分别进入各机器的目录 0、1、2

cd /yournfs/data/doris/0...1...2

默认使用docker-compose.yml文件中的配置。


# 启动
docker-compose up -d
docker-compose ps
# 关闭
docker-compose down
docker-compose ps
# 查看日志
docker logs -f doris-fe-01
docker logs -f doris-be-01docker logs -f doris-fe-02
docker logs -f doris-be-02docker logs -f doris-fe-03
docker logs -f doris-be-03#如果需要,删除所有目录重新开始安装cd /yournfs/data/doris/0...1...2rm -rf fe/doris-meta/rm -rf fe/bdb/rm -rf fe/image/rm -rf fe/log/rm -rf fe/process.lockrm -rf be/script/rm -rf be/storage/

登录界面

http://yourServerIP:8030/System?path=/frontends
http://yourServerIP:8030/System?path=/backends


登录界面中查看(root/初始密码为空),如果两个follower注册提IP地址,则需要删除后重新添加。

处理FOLLOWER问题


进入容器

docker exec -it doris-fe-01 /bin/bash


连接mysql客户端

mysql -uroot -P9030 -h 127.0.0.1


删除follower

ALTER SYSTEM DROP FOLLOWER "192.168.10.102:9010";
ALTER SYSTEM DROP FOLLOWER "192.168.10.103:9010";ALTER SYSTEM DROP FOLLOWER "fe-02:9010";
ALTER SYSTEM DROP FOLLOWER "fe-03:9010";


重新添加follower

ALTER SYSTEM ADD FOLLOWER "fe-02:9010";
ALTER SYSTEM ADD FOLLOWER "fe-03:9010";

add后,通过日志你会观察到两个follower会自动重启
登录界面中查看,确定fe-01是主节点

fe日志中出现异常

RuntimeLogger 2024-11-01 08:23:10,427 WARN (InternalSchemaInitializer|171) [InternalSchemaInitializer.run():82] Statistics storage initiated failed, will try again later
org.apache.doris.common.DdlException: errCode = 2, detailMessage = System has no available disk capacity or no available BE nodes


不用管他,等它自己恢复过来即可

fe启动成功后,be才开始启动

等了好久,通过集群日志或者界面中的fe和be列表查看,集群正常了。


修改root密码

docker exec -it doris-be-01 /bin/bashmysql -uroot -P9030 -h 127.0.0.1SET PASSWORD FOR 'root' = PASSWORD('yourPassword');
CREATE USER 'admin'@'%' IDENTIFIED BY 'yourPassword';
GRANT ALL ON *.* TO 'admin'@'%';
set global max_allowed_packet = 200*1024*1024;
SET PROPERTY FOR 'root' 'max_user_connections' = '500';
SET PROPERTY FOR 'admin' 'max_user_connections' = '500';


MySQL客户端登录  9030 端口

查看操作系统信息

登录容器docker exec -it doris-be-01 /bin/bashroot@fe-01:/opt/apache-doris# cat /etc/issue
Ubuntu 22.04.4 LTS \n \lroot@fe-01:/opt/apache-doris# java -version
openjdk version "1.8.0_352-352"
OpenJDK Runtime Environment (build 1.8.0_352-352-b08)
OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)
root@fe-01:/opt/apache-doris#

参考:Docker 系列之 docker-compose 部署 Doris 集群(使用 Keepalived 实现主备集群)_doris docker-compose-CSDN博客

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com