此文阅读需要有Linux和服务器硬件基础!某些内容写的不是特别细,如果常见的linux基础命令tar、uzip、mv、mkdir、系统包的安装等等,以文字带过了,这样可以减少文章篇幅。
官方的安装部署方式一定要好好看一下,最好是尝试着做一下,再看本教程最好!
https://doris.apache.org/zh-CN/docs/dev/install/standard-deployment

本文章基于Doris 1.2.4 relase更新:更新日志请看 Release 1.2.4

一.部署方式选择

Doris安装部署分为两种方式:

  1. 下载Apache Doris源码进行编译:https://github.com/apache/doris/
  2. 下载预编译版本,不需要编译源码,直接安装就行**【推荐】**

这里我们采用的是第2种,主要是安装省时、门槛低,更多SelectDB和Doris的区别可以看下方的注意内容。这里不再建议采用官方源码进行编译。如果能自己更改源码进行新功能的尝试,可以选择较新的分支进行编译,以体验最新功能。

注意:

  1. SelectDB版本为 Apache Doris快速迭代版本。包含全部 Apache Doris 的功能,并能快速迭代。因Apache发版过程较长,对于某些功能BUG影响到自己使用时,可以联系SelectDB侧渠道,获取最新的补丁包并尝鲜。
  2. Apache 官方 Release 版本请前往 Apache Doris 官方网站下载。

其他简单想说的:

我是从0.13版本开始跟Doris的,但未决定要上生产。直到1.2.3 release的发布,定下来把生产Hive数仓完整迁移到生产Doris上,so刚好也更新下该部署文章。
**一是:**Doris现在功能强大,特别在联邦查询、高性能计算、运维成本、先期投入、学习成本等方面都是较优的选择。
**二是:**Doris现在的Catalog用的很爽,我们可以通过Doris直接连上Hive、SAP HANA、Mysql、SQLServer、Oracle、ClickHouse等等,然后通过insert into select的方式,把数据load到Doris。也可以通过insert into select的方式把Doris数据insert到外部数据源中。
**三是:**Hive数仓1200多个job,目前我们的调度需要跑5-6个小时。可以预想到今后在现有资源的基础上,整个调度周期会再加长,当任务跑批失败故障处理完后,再跑,这个时间跨度慢慢不能被业务侧所接受。所以我们用Doris和hive跑批做了个对比。原先用Hive跑批需要15分钟完成的调度,用Doris只需要1.5分钟,效率提升9+倍有余。
最后:虽然Doirs性能很好,但还在成长,到现在为止也算较为稳定了,但是还达不到非常稳定,也会有一些小问题存在,不过现在看来也还好,毕竟瑕不掩瑜

镇楼,不支持动图 - -!

二.部署前准备工作

1. 服务器硬件准备

建议调研环境、测试环境可以用低配或者虚拟机。生产环境建议物理机,3台FE+7台BE组成。具体服务器配置相关问题,可以留言交流,或者浏览 Apache Doris安装与部署 章节.
推荐生产环境如下:

序号角色CPU内存系统盘数据盘网络
1FE-MasterIntel Gold 6326 * 1,16C64GBSSD 480*2,RAIDNvme SSD 960GB*3,读写速率 2.5G/s 7GB /s,RAID万兆光纤
2FE-followerIntel Gold 6326 * 1,16C64GBSSD 480*2,RAIDNvme SSD 960GB*3,读写速率 2.5G/s 7GB /s,RAID万兆光纤
3FE-followerIntel Gold 6326 * 1,16C64GBSSD 480*2,RAIDNvme SSD 960GB*3,读写速率 2.5G/s 7GB /s,RAID万兆光纤
4BEIntel Gold 6326 * 2,32C256GBSSD 480*2,RAIDNvme SSD 1.92TB*5,读写速率 2.5G/s 7GB /s万兆光纤
5BEIntel Gold 6326 * 2,32C256GBSSD 480*2,RAIDNvme SSD 1.92TB*5,读写速率 2.5G/s 7GB /s万兆光纤
6BEIntel Gold 6326 * 2,32C256GBSSD 480*2,RAIDNvme SSD 1.92TB*5,读写速率 2.5G/s 7GB /s万兆光纤
7BEIntel Gold 6326 * 2,32C256GBSSD 480*2,RAIDNvme SSD 1.92TB*5,读写速率 2.5G/s 7GB /s万兆光纤
8BEIntel Gold 6326 * 2,32C256GBSSD 480*2,RAIDNvme SSD 1.92TB*5,读写速率 2.5G/s 7GB /s万兆光纤
9BEIntel Gold 6326 * 2,32C256GBSSD 480*2,RAIDNvme SSD 1.92TB*5,读写速率 2.5G/s 7GB /s万兆光纤
10BEIntel Gold 6326 * 2,32C256GBSSD 480*2,RAIDNvme SSD 1.92TB*5,读写速率 2.5G/s 7GB /s万兆光纤

FE建议3台组成HA,后续如果发现BE计算能力不足,扩展BE即可,不需要在折腾FE了。
FE 的部署推荐,在 安装与部署文档 中有介绍,这里再做一些补充。

  • 如果你并不十分了解 FE 元数据的运行逻辑,或者没有足够 FE 元数据的运维经验,我们强烈建议在实际使用中,只部署一个 FOLLOWER 类型的 FE 作为 MASTER,其余 FE 都是 OBSERVER,这样可以减少很多复杂的运维问题! 不用过于担心 MASTER 单点故障导致无法进行元数据写操作。首先,如果你配置合理,FE 作为 java 进程很难挂掉。其次,如果 MASTER 磁盘损坏(概率非常低),我们也可以用 OBSERVER 上的元数据,通过 故障恢复 的方式手动恢复。
  • FE 进程的 JVM 一定要保证足够的内存。我们强烈建议 FE 的 JVM 内存至少在 10GB 以上,推荐 32GB 至 64GB。并且部署监控来监控 JVM 的内存使用情况。因为如果FE出现OOM,可能导致元数据写入失败,造成一些无法恢复的故障!
  • FE 所在节点要有足够的磁盘空间,以防止元数据过大导致磁盘空间不足。同时 FE 日志也会占用十几G 的磁盘空间。
    关于硬件最后一点想说的,BE节点的CPU、内存、硬盘、网络请尽量上高配。目前我们生产BE节点,CPU:32物理核心、内存:256GB 3200MT/s、硬盘:读5GB+/s 写2.5GB+/s、网络:万兆光纤,共大家参考
2.系统软件准备

所有服务器都需要做。【必须】的内容一定要做,【按需】的 内容可以不用做
(1)【必须】 Linux CentOS 7.9 安装所有最新补丁,在安装操作系统的时候,推荐选择ext4文件系统。
(2)【必须】 时钟同步:https://www.cnblogs.com/jhxxb/p/11526098.html
(3)【必须】关闭交换分区(swap):https://www.cnblogs.com/whm-blog/p/10920881.html
(4)
【必须】把limits调到最大:https://www.jianshu.com/p/816911a8f90e
(5)
【必须】 安装gcc 10.2.0+:https://www.cnblogs.com/sakela/p/14652712.html
(6)
【必须】安装JDK1.8:https://blog.csdn.net/weixin_36365168/article/details/114194870,1.2.4版本也不需要了,安装自带JDK8
(7)~~
【必须】
在所有BE节点上安装ODBC:https://www.jianshu.com/p/093f89723c8c~~ 不需要了,请大家移步 多源数据目录 Multi-Catalog
(8)【按需】如果有新建root账号的需求,可以参照:https://www.jianshu.com/p/b9537e714399
(9)【按需】关于broker,因我们并没有用到涉及需使用broker接入内容,所以文章中并没有写broker的接入过程,可参照:https://doris.apache.org/zh-CN/docs/dev/install/standard-deployment

三.部署Doris

部署Doris时,用的都是root用户!

1.安装FE(集群)

(1)先确认待安装的服务器的CPU是否支持avx2指令,这个过程所有服务器都需要确定。

0.14.13.1 及之后的版本需要运行环境的 CPU 支持 avx2 指令,你可以通过 cat /proc/cpuinfo 查看是否支持。如果不支持,请使用带 no-avx2 后缀的版本。avx2 指令会显著提升 bloomfilter 等数据结构的计算效率,从而影响索引过滤、runtime filter 等功能的效率。
使用以下命令查看:

[root@DORIS-FE-PRD01 ~]# cat /proc/cpuinfo 

cpuinfo flags标签信息
可以看到cpu是支持avx2指令的,那就可以下载支持avx2指令的已编译版本。如果cpu不支持avx2指令,需要下载不支持avx2指令的已编译版本。

先去下载已编译好的版本,以下是下载地址,点击图片中的Link下载适合的版本。X64(avx2)下的是支持avx2指令,X64(no avx2)下的是不支持avx2指令:
官方:Doris预编译版本下载地址
SelectDB:Doris预编译版本下载地址
(2)下载完后得到apache-doris-fe-1.2.4-bin-x86_64.tar.xz``````apache-doris-be-1.2.4-bin-x86_64.tar.xz``````apache-doris-dependencies-1.2.4-bin-x86_64.tar.xz
(3)apache-doris-fe-1.2.4-bin-x86_64.tar.xz上传至所有fe节点服务器/opt/software目录,每台服务器都需要上传。apache-doris-be-1.2.4-bin-x86_64.tar.xz``````apache-doris-dependencies-1.2.4-bin-x86_64.tar.xz上传至所有be节点服务器。
(4)解压apache-doris-fe-1.2.4-bin-x86_64.tar.xz得到apache-doris-fe-1.2.4-bin-x86_64目录,目录结构如下:
apache-doris-fe-1.2.4-bin-x86_64 目录结构
(5)把fe挪到/home/doris/目录下去,前提需要创建该目录。
(6)进入/home/doris/fe/conf, vim be.conf,有以下几项需要增加或修改:

以下配置中不会详述每个配置的含义,可以访问Doris文档查看具体释义和更多配置:
https://doris.apache.org/zh-CN/docs/dev/admin-manual/config/fe-config

  • JAVA_OPTS-Xmx调到32768m,即32GB
JAVA_OPTS="-Xmx32768m -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 -Xlogg
c:$DORIS_HOME/log/fe.gc.log.$DATE"
  • meta_dir中配置fe元数据的存放路径需要修改为/doris-meta
meta_dir = /doris-meta1

这里需要注意,fe的源程序包是放在/home/doris/下,是系统盘位置为480G RAID所在盘符目录。fe元数据的存放硬盘为/doris-meta,fe节点的3块960G的硬盘做了RAID5阵列,整体大小由960G*3的数量大小,变为960G*21.8TB左右的大小,并挂载到/doris-meta目录下。

  • ③ 增加enable_http_server_v2 = true配置,支持https,这样可以打开新的前端UI界面。
http_port = 8030
rpc_port = 9020
query_port = 9030
edit_log_port = 9010
mysql_service_nio_enabled = true
enable_http_server_v2 = true   # 在这里加该配置就行
  • priority_networks需要设置fe所在的服务器IP,这里我的服务器只用了单网口只有一个IP。
priority_networks = 192.168.16.44/24
  • dynamic_partition_enable = true增加动态分区配置,后续使用中动态分区用的比较多,先把它配置上。在文件末尾加上就行。
dynamic_partition_enable = true

这里贴上我的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="-Xmx32768m -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="-Xmx32768m -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
meta_dir = /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 = 192.168.16.44/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

(7)启动fe。启动和关闭fe的命令是sh start_fe.sh --daemonsh stop_fe.sh --daemon

[root@DORIS-FE-PRD01 bin]# cd /home/doris/fe/bin
[root@DORIS-FE-PRD01 bin]# sh start_fe.sh --daemon

注意:
Doris启动过程中如果发生问题,可以进入/home/doris/fe/log目录下查看日志,找到异常寻求解决方案
官方运维常见问题
(7)下面需要通过mysql客户端连接fe节点

  • ① 下载mysql-5.7.36,上传至/opt/software/,并解压,解压后不用安装,只用它来连接doris。
    mysql-5.7.36官方下载链接
  • ② 使用以下命令连接doris,能进入到doris表示连接成功,说明fe启动正常
[root@DORIS-FE-PRD01 bin]# cd /opt/software/mysql-5.7.36-linux-glibc2.12-x86_64/bin
[root@DORIS-FE-PRD01 bin]# ./mysql -h 192.168.16.44 -P 9030 -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5781
Server version: 5.1.0 Doris version 0.15.1-rc09-Unknown

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

(8)剩下两台fe节点需要做一下第(1)至第(5)个步骤,但是在 首次启动 其余两个fe节点时,需要注意用以下命令执行,后续启动采用第(6)中的命令执行即可:
第二个节点:

[root@DORIS-FE-PRD02 bin]# cd /home/doris/fe/bin
[root@DORIS-FE-PRD02 bin]# ./start_fe.sh --helper 192.168.16.44:9010 --daemon

第三个节点:

[root@DORIS-FE-PRD03 bin]# cd /home/doris/fe/bin
[root@DORIS-FE-PRD03 bin]# ./start_fe.sh --helper 192.168.16.44:9010 --daemon

192.168.16.44为第一个启动的fe节点,该节点为master节点。剩下两台为follower节点,3台fe节点组成读写HA。

(9)在192.168.16.44 master fe节点服务器上,用mysql连接master fe,并用sql添加其余两台follower节点:

[root@DORIS-FE-PRD01 conf]# cd /opt/software/mysql-5.7.36-linux-glibc2.12-x86_64/bin
[root@DORIS-FE-PRD01 bin]# ./mysql -h 192.168.16.44 -P 9030 -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5782
Server version: 5.1.0 Doris version 0.15.1-rc09-Unknown

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER SYSTEM ADD FOLLOWER "192.168.16.64:9010";
mysql> ALTER SYSTEM ADD FOLLOWER "192.168.16.53:9010";

添加完后,通过show proc '/frontends';查看fe节点的状态,主要关注Role角色、IsMaster是否主节点、alive节点存活状态 三列是否正常。

mysql> show proc '/frontends';
+----------------------------------+---------------+-------------+----------+-----------+---------+----------+----------+------------+------+-------+-------------------+---------------------+----------+--------+--------------------------+------------------+
| Name                             | IP            | EditLogPort | HttpPort | QueryPort | RpcPort | Role     | IsMaster | ClusterId  | Join | Alive | ReplayedJournalId | LastHeartbeat       | IsHelper | ErrMsg | Version                  | CurrentConnected |
+----------------------------------+---------------+-------------+----------+-----------+---------+----------+----------+------------+------+-------+-------------------+---------------------+----------+--------+--------------------------+------------------+
| 192.168.16.64_9010_1682469350180 | 192.168.16.64 | 9010        | 8030     | 9030      | 9020    | FOLLOWER | false    | 2079148326 | true | true  | 267346748         | 2023-05-04 19:12:59 | true     |        | doris-1.2.4-rc01-Unknown | No               |
| 192.168.16.44_9010_1651040787813 | 192.168.16.44 | 9010        | 8030     | 9030      | 9020    | FOLLOWER | true     | 2079148326 | true | true  | 267346749         | 2023-05-04 19:12:59 | true     |        | doris-1.2.4-rc01-Unknown | Yes              |
| 192.168.16.53_9010_1682469352336 | 192.168.16.53 | 9010        | 8030     | 9030      | 9020    | FOLLOWER | false    | 2079148326 | true | true  | 267346748         | 2023-05-04 19:12:59 | true     |        | doris-1.2.4-rc01-Unknown | No               |
+----------------------------------+---------------+-------------+----------+-----------+---------+----------+----------+------------+------+-------+-------------------+---------------------+----------+--------+--------------------------+------------------+
3 rows in set (0.06 sec)

(10)到此为止,如果一切顺利,fe集群就搭建完了。

2.安装BE(集群)

(1)进入be节点服务器上,解压apache-doris-be-1.2.4-bin-x86_64.tar.xz``````apache-doris-dependencies-1.2.4-bin-x86_64.tar.xz,得到以下两个目录:
apache-doris-be-1.2.4-bin-x86_64
apache-doris-dependencies-1.2.4-bin-x86_64
(2)把apache-doris-dependencies-1.2.4-bin-x86_64目录下的java-udf-jar-with-dependencies.jar挪到apache-doris-be-1.2.4-bin-x86_64/lib目录下
(3)把be目录挪到/home/doris/下,需要创建该目录。
(4)进入/home/doris/be/conf目录下,修改配置:

以下配置中不会详述每个配置的含义,可以访问Doris文档查看具体释义和更多配置:
https://doris.apache.org/zh-CN/docs/dev/admin-manual/config/be-config

  • ① 修改priority_networks
priority_networks = 192.168.16.65/24
  • ② 修改数据存放目录storage_root_path
storage_root_path = /doris-data1,medium:hdd,capacity:890;/doris-data2,medium:ssd,capacity:890;/doris-data3,medium:ssd,capacity:890

说明:
1.be节点与fe节点服务器配置是一样的,但是be节点的960G*3的SSD硬盘,没有做磁盘阵列,当做3块磁盘去用,分别挂载到/doris-data1 /doris-data2 /doris-data3 目录下。
2.配置中第一个磁盘目录/doris-data1,medium:hdd,capacity:890medium指定的是hdd。这里需要注意,虽然说3块硬盘都是SSD,但是如果在配置时把medium都配置ssd,会发现在建表的时候会报错。所以这里把第一个改成了hdd,剩下两个还是ssd。如果都是用的SSD可以这样配置/doris-data1,/doris-data2,/doris-data3,,不用指定硬盘那些参数。

  • ③ 增加如下配置,这几项配置是我们在使用过程中自己添加的,可能也不一定适合各位,各位可以按需添加。
max_tablet_version_num = 5000
max_compaction_threads = 16
compaction_task_num_per_disk = 8
cumulative_size_based_promotion_size_mbytes = 2048
row_step_for_compaction_merge_log = 1
total_permits_for_compaction_score = 50000

以下是我的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 = 192.168.16.66/24
storage_root_path = /doris-data1.hdd,890;/doris-data2.ssd,890;/doris-data3.ssd,890
max_tablet_version_num = 5000
max_compaction_threads = 16
compaction_task_num_per_disk = 8
cumulative_size_based_promotion_size_mbytes = 2048
row_step_for_compaction_merge_log = 1
total_permits_for_compaction_score = 50000
# 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 
  • ④ 还剩6台be节点,都按照以上内容进行配置,后者把be放到/home/doris/下后,同步一下be.conf改一下ip地址就行。
  • ⑤ 启动所有be节点
[root@DORIS-BE-PRD01 conf]# cd /home/doris/be/bin
[root@DORIS-BE-PRD01 bin]# sh start_be.sh --daemon

[root@DORIS-BE-PRD02 conf]# cd /home/doris/be/bin
[root@DORIS-BE-PRD02 bin]# sh start_be.sh --daemon

[root@DORIS-BE-PRD03 conf]# cd /home/doris/be/bin
[root@DORIS-BE-PRD03 bin]# sh start_be.sh --daemon

[root@DORIS-BE-PRD04 conf]# cd /home/doris/be/bin
[root@DORIS-BE-PRD04 bin]# sh start_be.sh --daemon

[root@DORIS-BE-PRD05 conf]# cd /home/doris/be/bin
[root@DORIS-BE-PRD05 bin]# sh start_be.sh --daemon

[root@DORIS-BE-PRD06 conf]# cd /home/doris/be/bin
[root@DORIS-BE-PRD06 bin]# sh start_be.sh --daemon

[root@DORIS-BE-PRD07 conf]# cd /home/doris/be/bin
[root@DORIS-BE-PRD07 bin]# sh start_be.sh --daemon
  • ⑥ 进入fe master节点,用mysql连接进入sql命令行模式,挨个添加be节点
[root@DORIS-FE-PRD01 bin]# cd /opt/software/mysql-5.7.36-linux-glibc2.12-x86_64/bin
[root@DORIS-FE-PRD01 bin]# ./mysql -h 192.168.16.44 -P 9030 -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5783
Server version: 5.1.0 Doris version doris-1.2.4-rc01-Unknown

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER SYSTEM ADD BACKEND "192.168.16.66:9050";
mysql> ALTER SYSTEM ADD BACKEND "192.168.16.59:9050";
mysql> ALTER SYSTEM ADD BACKEND "192.168.16.60:9050";
mysql> ALTER SYSTEM ADD BACKEND "192.168.16.51:9050";
mysql> ALTER SYSTEM ADD BACKEND "192.168.16.65:9050";
mysql> ALTER SYSTEM ADD BACKEND "192.168.16.63:9050";

添加完后,通过show proc '/backends';查看be节点的状态,主要关注alive节点存活状态 是否正常。

mysql> show proc '/backends';
+-----------+-----------------+----------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
| BackendId | Cluster         | IP             | HeartbeatPort | BePort | HttpPort | BrpcPort | LastStartTime       | LastHeartbeat       | Alive | SystemDecommissioned | ClusterDecommissioned | TabletNum | DataUsedCapacity | AvailCapacity | TotalCapacity | UsedPct | MaxDiskUsedPct | RemoteUsedCapacity | Tag                      | ErrMsg | Version                  | Status                                                                                                                        | HeartbeatFailureCounter | NodeRole |
+-----------+-----------------+----------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
| 82668153  | default_cluster | 192.168.16.xxx | 9050          | 9060   | 8040     | 8060     | 2023-04-25 18:28:53 | 2023-05-04 19:21:40 | true  | false                | false                 | 54406     | 16.239 GB        | 8.667 TB      | 8.729 TB      | 0.70 %  | 0.81 %         | 0.000              | {"location" : "default"} |        | doris-1.2.4-rc01-Unknown | {"lastSuccessReportTabletsTime":"2023-05-04 19:21:00","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0                       | mix      |
| 82668154  | default_cluster | 192.168.16.xxx | 9050          | 9060   | 8040     | 8060     | 2023-04-25 18:28:53 | 2023-05-04 19:21:40 | true  | false                | false                 | 53964     | 19.080 GB        | 8.665 TB      | 8.729 TB      | 0.73 %  | 0.84 %         | 0.000              | {"location" : "default"} |        | doris-1.2.4-rc01-Unknown | {"lastSuccessReportTabletsTime":"2023-05-04 19:21:11","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0                       | mix      |
| 82668155  | default_cluster | 192.168.16.xxx | 9050          | 9060   | 8040     | 8060     | 2023-04-25 18:28:53 | 2023-05-04 19:21:40 | true  | false                | false                 | 50290     | 17.190 GB        | 8.668 TB      | 8.729 TB      | 0.69 %  | 0.83 %         | 0.000              | {"location" : "default"} |        | doris-1.2.4-rc01-Unknown | {"lastSuccessReportTabletsTime":"2023-05-04 19:20:56","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0                       | mix      |
| 82668156  | default_cluster | 192.168.16.xxx | 9050          | 9060   | 8040     | 8060     | 2023-04-25 18:28:53 | 2023-05-04 19:21:40 | true  | false                | false                 | 54965     | 16.714 GB        | 8.668 TB      | 8.729 TB      | 0.70 %  | 0.88 %         | 0.000              | {"location" : "default"} |        | doris-1.2.4-rc01-Unknown | {"lastSuccessReportTabletsTime":"2023-05-04 19:20:53","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0                       | mix      |
| 82668157  | default_cluster | 192.168.16.xxx | 9050          | 9060   | 8040     | 8060     | 2023-04-25 18:28:53 | 2023-05-04 19:21:40 | true  | false                | false                 | 53024     | 19.122 GB        | 8.660 TB      | 8.729 TB      | 0.78 %  | 1.05 %         | 0.000              | {"location" : "default"} |        | doris-1.2.4-rc01-Unknown | {"lastSuccessReportTabletsTime":"2023-05-04 19:20:56","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0                       | mix      |
| 82668158  | default_cluster | 192.168.16.xxx | 9050          | 9060   | 8040     | 8060     | 2023-04-25 18:28:53 | 2023-05-04 19:21:40 | true  | false                | false                 | 52119     | 18.351 GB        | 8.661 TB      | 8.729 TB      | 0.77 %  | 0.98 %         | 0.000              | {"location" : "default"} |        | doris-1.2.4-rc01-Unknown | {"lastSuccessReportTabletsTime":"2023-05-04 19:21:32","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0                       | mix      |
| 82668159  | default_cluster | 192.168.16.xxx | 9050          | 9060   | 8040     | 8060     | 2023-04-25 18:28:53 | 2023-05-04 19:21:40 | true  | false                | false                 | 50999     | 14.106 GB        | 8.662 TB      | 8.729 TB      | 0.76 %  | 1.10 %         | 0.000              | {"location" : "default"} |        | doris-1.2.4-rc01-Unknown | {"lastSuccessReportTabletsTime":"2023-05-04 19:21:39","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0                       | mix      |
+-----------+-----------------+----------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
  • ⑦ 到此为止,如果顺利的话,整个doris集群搭建完毕。后面可以用DB工具用连接mysql的方式连接Doris了。

四.负载均衡

当部署多个 FE 节点时,用户可以在多个 FE 之上部署负载均衡层来实现 Doris 的高可用。
该步骤是建议在生产环境一定要做的!

目前负载均衡有两种方式:ProxySQL 及 Nginx,我觉得nginx简单,推荐Nginx方式。如采用ProxySQL,后面要增加doris数据库账号,还需要在ProxySQL代理层增加对应用户,比较麻烦。

主要步骤可以完全按照官网给的安装手册进行,写的很详细,完全参照即可:
https://doris.apache.org/zh-CN/docs/dev/admin-manual/cluster-management/load-balancing

五.连接Doris,进行查询

在第四步中我已经做好了ProxySQL的代理,下面将通过连接Proxy代理的IP和端口,连接Doris。
因为我们的doris安装的早,那会还只有ProxySQL,现在可以用nginx

我的ProxySQL地址端口:192.168.16.53:9033
我的FE地址端口:192.168.16.53:9030、192.168.16.64:9030、192.168.16.44:9030
(1)通过DBeaver连接Proxy,选择 mysql,点击下一步
选择mysql
(2)填写IP、端口、账号、密码
在这里插入图片描述

(3)点击“测试链接”,显示成功
在这里插入图片描述

(4)如图所示,test数据库是导入的测试数据集,大约6+亿条70+GB的数据,可以按照官方的教程,导入测试数据集,测试doris集群性能的初步表现:https://doris.apache.org/zh-CN/docs/dev/benchmark/ssb
在这里插入图片描述

(5)执行一条官方测试教程中sql,该条sql执行在400ms左右

-- 设置并发度为8
set parallel_fragment_exec_instance_num=8;
-- 设置runtime_filter为BLOOM_FILTER
set runtime_filter_type="BLOOM_FILTER";
-- 执行sql
SELECT d_year, c_nation,
SUM(lo_revenue - lo_supplycost) AS PROFIT
FROM date, customer, supplier, part, lineorder
WHERE lo_custkey = c_custkey
AND lo_suppkey = s_suppkey
AND lo_partkey = p_partkey
AND lo_orderdate = d_datekey
AND c_region = 'AMERICA'
AND s_region = 'AMERICA'
AND (p_mfgr = 'MFGR#1'
OR  p_mfgr = 'MFGR#2')
GROUP BY d_year, c_nation
ORDER BY d_year, c_nation;

在这里插入图片描述

用上面我推荐集群的配置,执行Doris官方测试查询sql,比官方执行效率更高!^_^

Query官方 1.2.0(ms)我方 1.2.4(ms)
Q1.1408
Q1.2309
Q1.3208
Q2.1350227
Q2.2320209
Q2.3300204
Q3.1650364
Q3.2260180
Q3.3220155
Q3.46080
Q4.1840294
Q4.2460246
Q4.3610309
Logo

大数据从业者之家,一起探索大数据的无限可能!

更多推荐