doris集群部署
Apache Doris 是一个基于 MPP 架构的高性能、实时的分析型数据库,以极速易用的特点被人们所熟知,仅需亚秒级响应时间即可返回海量数据下的查询结果,不仅可以支持高并发的点查询场景,也能支持高吞吐的复杂分析场景。基于此,Apache Doris 能够较好的满足报表分析、即时查询、统一数仓构建、数据湖联邦查询加速等使用场景,用户可以在此之上构建用户行为分析、AB 实验平台、日志检索分析、用户画像分析、订单分析等应用
- 下载
doris官网下载:https://doris.apache.org/download/
从doris官网下载的1.1.5版本
- 安装
2.1 解压、设置环境变量
下载完之后是两个压缩包(be 和 fe)
将其上传到服务器,解压到目标路径。这里部署的是一主三从,所以是dev01节点(fe & be) ,dev02节点(be), dev03节点(be) 。
mv apache-doris-fe-1.1.5-bin fe |
mv apache-doris-be-1.1.5-bin-x86_64 be |
chown -R root:root be/ |
chown -R root:root fe/ |
配置环境变量
vim /etc/profile |
#DORIS_HOME export DORIS_HOME=/opt/doris/fe/ export DORIS_HOME=/opt/doris/be/ export PATH=$PATH:$DORIS_HOME/bin |
source /etc/profile |
2.2 修改fe配置文件
修改fe配置文件
cd /opt/doris/fe/conf/ |
vim 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 ##################################################################### # the output dir of stderr and stdout LOG_DIR = ${DORIS_HOME}/log DATE = `date +%Y%m%d-%H%M%S` JAVA_OPTS="-Xmx8192m -XX:+UseMembar -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=7 -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=80 -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="-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.$DATE:time" ## ## the lowercase properties are read by main program. ## # INFO, WARN, ERROR, FATAL sys_log_level = INFO # store metadata, must be created before start FE. # Default value is ${DORIS_HOME}/doris-meta meta_dir = ${DORIS_HOME}/doris-meta http_port = 8030 rpc_port = 9020 query_port = 9030 edit_log_port = 9010 mysql_service_nio_enabled = true enable_http_server_v2 = true # 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 # Default value is empty. # priority_networks = 10.10.10.0/24;192.168.0.0/16 priority_networks = *.*.*.71/24 # 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 # max_conn_per_user = 100 # qe_query_timeout_second = 300 # qe_slow_log_ms = 5000 dynamic_partition_enable = true |
2.3 修改be配置文件
cd /opt/doris/be/conf/ |
vim 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. PPROF_TMPDIR="$DORIS_HOME/log/" # 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 priority_networks = *.*.*.71/24 # 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 # 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, seperate 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>', seperate 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 # 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 |
将be的配置同步到其他节点
cd /opt/doris/ |
scp -r be/ *.*.*.72:/opt/doris/ |
scp -r be/ *.*.*.73:/opt/doris/ |
配置文件为 conf/fe.conf。其中注意:meta_dir是元数据存放位置。默认值为 ${DORIS_HOME}/doris-meta。需手动创建该目录。
我这里解压过后是自己生成的
- 启动
3.1 启动fe
cd /opt/doris/fe/bin |
./start_fe.sh |
报错端口占用: |
根据两次报错修改配置文件: cd /opt/doris/fe/conf vim fe.conf |
再次启动 ./start_fe.sh --daemon 启动命令带有参数--daemon表示以守护进程方式启动 |
FE进程启动进入后台执行。日志默认存放在 log/ 目录下。如启动失败,可以通过查看 log/fe.log 或者 log/fe.out 查看错误信息。 |
|
然后可以打开网页访问 *.*.*.71:8050 ,第一次登录,用户名是root,没有密码。 |
3.2启动be
由于 be 部署在 hadoop 集群中,注意调整 be.conf 中的 webserver_port = 8040 ,以免造成端口冲突 |
vim /opt/doris/be/conf/be.conf |
webserver_port = 8040 修改为webserver_port = 8070 |
由于fe.conf里面由于端口冲突的问题,当时把edit_log_port修改为9050,所以需要把be.conf配置里面的heartbeat_service_port = 9050修改为heartbeat_service_port = 9070 |
同步改配置到其他be节点 |
BE 节点需要先在 FE 中添加,才可加入集群。可以使用 mysql-client(下载MySQL 5.7) 连接到 FE: ./mysql-client -h fe_host -P query_port -uroot mysql -h *.*.*.71 -P9030 -uroot |
ALTER SYSTEM ADD BACKEND "*.*.*.71:9070"; |
启动71节点be cd /opt/doris/be bin/start_be.sh --daemon |
解决报错: sysctl -w vm.max_map_count=2000000 |
BE 进程将启动并进入后台执行。日志默认存放在 be/log/ 目录下。如启动失败,可以通过查看 be/log/be.log 或者 be/log/be.out 查看错误信息。 |
查看BE状态 使用 mysql-client 连接到 FE,并执行 SHOW PROC '/backends'; 查看 BE 运行情况。如一切正常,isAlive 列应为 true。 mysql -h *.*.*.71 -P9030 -uroot SHOW PROC '/backends'; 71节点be启动成功 |
启动72、73节点be ALTER SYSTEM ADD BACKEND "*.*.*.72:9070"; ALTER SYSTEM ADD BACKEND "*.*.*.73:9070"; 72、73节点分别执行: sysctl -w vm.max_map_count=2000000 cd /opt/doris/be bin/start_be.sh --daemon |
73节点报错:fail to open storageEngine,res=file descriptors limit is too small 首先通过ulimit -a查看系统的一些参数设置 设置open files参数 ####临时的修改 ulimit -n 65535 (命令行直接运行即可) ####如下是永久的修改 vim /etc/profile 在文件末尾加入ulimit –n 65535 (或者大小为204800均可) source /etc/profile 我这里选择的是临时修改 cd /opt/doris/be bin/start_be.sh --daemon 启动成功 |