Apache Doris安装过程

0.系统与版本要求

Linux 操作系统版本需求

Linux 系统 版本
CentOS 7.1 及以上
Ubuntu 16.04 及以上

虽然要求centos7以上,但是实测在centos8安装会出现某些依赖一直安装不上的问题,因此建议安装在centos7上

软件需求

软件 版本
Java 1.8 及以上
GCC 4.8.2 及以上

开发测试环境

模块 CPU 内存 磁盘 网络 实例数量
Frontend 8核+ 8GB+ SSD 或 SATA,10GB+ * 千兆网卡 1
Backend 8核+ 16GB+ SSD 或 SATA,50GB+ * 千兆网卡 1-3 *

生产环境

模块 CPU 内存 磁盘 网络 实例数量(最低要求)
Frontend 16核+ 64GB+ SSD 或 RAID 卡,100GB+ * 万兆网卡 1-5 *
Backend 16核+ 64GB+ SSD 或 SATA,100G+ * 万兆网卡 10-100 *

注1:

FE 的磁盘空间主要用于存储元数据,包括日志和 image。通常从几百 MB 到几个 GB 不等。
BE 的磁盘空间主要用于存放用户数据,总磁盘空间按用户总数据量 * 3(3副本)计算,然后再预留额外 40% 的空间用作后台 compaction 以及一些中间数据的存放。
一台机器上可以部署多个 BE 实例,但是只能部署一个 FE。如果需要 3 副本数据,那么至少需要 3 台机器各部署一个 BE 实例(而不是1台机器部署3个BE实例)。多个FE所在服务器的时钟必须保持一致(允许最多5秒的时钟偏差

测试环境也可以仅适用一个 BE 进行测试。实际生产环境,BE 实例数量直接决定了整体查询延迟。
所有部署节点关闭 Swap。

注2:FE 节点的数量

FE 角色分为 Follower 和 Observer,(Leader 为 Follower 组中选举出来的一种角色,以下统称 Follower,具体含义见 元数据设计文档)。
FE 节点数据至少为1(1 个 Follower)。当部署 1 个 Follower 和 1 个 Observer 时,可以实现读高可用。当部署 3 个 Follower 时,可以实现读写高可用(HA)。
Follower 的数量必须为奇数,Observer 数量随意。
根据以往经验,当集群可用性要求很高是(比如提供在线业务),可以部署 3 个 Follower 和 1-3 个 Observer。如果是离线业务,建议部署 1 个 Follower 和 1-3 个 Observer。

1. 创建用户(非必要选项)

useradd sudouser

设置密码

passwd sudouser

赋予超级用户权限

# 修改 /etc/sudoers 文件,找到root一行,在root下面添加一行,如下所示:
## Allow root to run any commands anywhere
vi /etc/sudoers
root    ALL=(ALL)     ALL
sudouser   ALL=(ALL)     ALL
# 修改完毕,现在可以用sudouser帐号登录,然后用命令 sudo su - ,即可获得root权限进行操作。

# 修改用户的sftp权限,首先找到下面文件的位置(一般都在/usr/libexec/openssh/sftp-server)
find / -name sftp-server -print
# 编辑/etc/sudoers 文件
# 在刚刚加入的一行下面再加一句
visudo
sudouser ALL=NOPASSWD:/usr/libexec/openssh/sftp-server
# 同时,将文件中的如下一行注释掉(如果有的话):
Defaults    requiretty

2.创建执行环境&设置环境变量

更改句柄数:

vi /etc/security/limits.conf
# 修改下面参数的值
* soft nofile 655360      # open files  (-n)
* hard nofile 655360
 
* soft nproc 655650
* hard nproc 655650       # max user processes   (-u)
vi /etc/security/limits.d/20-nproc.conf
# 修改参数的值
*          soft    nproc     655350
root       soft    nproc     unlimited
# 修改 /etc/sysctl.conf, 加入
echo fs.file-max = 6553560 >> /etc/sysctl.conf
# 修改两个文件的值
/etc/systemd/system.conf   #modify hard limit
/etc/systemd/user.conf   #modify soft limit
# 在Manager下增加
[Manager]
DefaultLimitNOFILE=655350
DefaultLimitNPROC=655350

需要重新登录,或者重新打开ssh客户端连接,永久生效

设置yum源

cd /etc/yum.repos.d/
# 备份
mkdir repo_bak
mv *.repo repo_bak/
wget http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
# 清除系统yum缓存并生成新的yum缓存
yum clean all	
yum makecache
# 安装epel
yum install -y epel-release
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
# 查看目前系统的yum源
yum repolist all

创建执行环境

sudo yum groupinstall 'Development Tools' && sudo yum install cmake3 byacc flex automake libtool bison binutils-devel zip unzip ncurses-devel curl git wget python2 glibc-static libstdc++-static npm

设置环境变量

java
# 最新的官网地址:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
# 把jdk-8u171-linux-x64.tar.gz下载到本地
cd /usr/lib
mkdir java
# 创建/usr/lib/java目录
cd java
# 进入java目录
# 用Xftp把jdk-8u311-linux-x64.tar.gz上传到此目录
# 解压
tar -xzvf jdk-8u311-linux-x64.tar.gz
vim /etc/profile
# 配置系统环境变量

vi /etc/profile
export JAVA_HOME=/usr/lib/java/jdk1.8.0_311
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin

chmod 755 -R /usr/lib/java/jdk1.8.0_311
Maven
wget https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz --no-check-certificate
tar -xzvf apache-maven-3.8.4-bin.tar.gz
mv apache-maven-3.8.4 /usr/lib/

# 环境变量
vi /etc/profile

# maven
export MAVEN_HOME=/usr/lib/apache-maven-3.8.4/
export PATH=$PATH:$MAVEN_HOME/bin

source /etc/profile

# 配置maven镜像源


cd /usr/lib/apache-maven-3.8.4/conf
vi settings.xml
# 增加源

# 阿里云Maven镜像:

<mirror>  
    <id>nexus-aliyun</id>  
    <mirrorOf>central</mirrorOf>    
    <name>Nexus aliyun</name>  
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>  
</mirror>  

#或开源中国maven镜像
<mirror>  
  <id>nexus-osc</id>  
  <mirrorOf>*</mirrorOf>  
  <name>Nexus osc</name>  
  <url>http://maven.oschina.net/content/groups/public/</url>  
</mirror>  

chmod 755 -R /usr/lib/apache-maven-3.8.4/
cmake

要用cmake3

ln -s /usr/bin/cmake3 /usr/bin/cmake
# 验证
cmake --version 
python

要用python2

npm

1).安装gcc

yum install gcc gcc-c++

2).下载node国内镜像(推荐)

wget https://npm.taobao.org/mirrors/node/v10.14.1/node-v10.14.1-linux-x64.tar.gz

3).解压并重命名文件夹

tar -xvf  node-v10.14.1-linux-x64.tar.gz
mv node-v10.14.1-linux-x64 /usr/local/node

4).添加环境变量

vi /etc/profile

在文件最后添加以下配置:

# npm
export NODE_HOME=/usr/local/node  
export PATH=$NODE_HOME/bin:$PATH

5).刷新配置

source /etc/profile

6).验证结果:

node -v
npm -v
升级到gcc 7.3
yum -y install centos-release-scl 
yum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils 
scl enable devtoolset-7 bash

需要注意的是scl命令启用只是临时的,退出shell或重启就会恢复原系统gcc版本。
如果要长期使用gcc 7.3的话:

echo "source /opt/rh/devtoolset-7/enable" >>/etc/profile

3.拉取源码(如果已经有编译好的output/目录可以直接进行第5步的分发)

下载源码

wget https://archive.apache.org/dist/incubator/doris/0.14.0-incubating/apache-doris-0.14.0-incubating-src.tar.gz
tar -xzvf apache-doris-0.14.0-incubating-src.tar.gz

4.安装第三方依赖

cd ~/apache-doris-0.14.0-incubating-src/thirdparty

第三方依赖下载连接错误、失效等问题
Doris 所依赖的第三方库的下载连接都在 thirdparty/vars.sh 文件内。随着时间推移,一些下载连接可能会失效。如果遇到这种情况。可以使用如下两种方式解决:

1) 手动修改 thirdparty/vars.sh 文件

手动修改有问题的下载连接和对应的 MD5 值。

2) 使用第三方下载仓库(推荐):

export REPOSITORY_URL=https://doris-thirdparty-repo.bj.bcebos.com/thirdparty
sh build-thirdparty.sh

REPOSITORY_URL 中包含所有第三方库源码包和他们的历史版本。

5.编译

sh build.sh
# 此步骤会把FE与BE都编译完毕
# 此步骤会根据网速不同,速度不同,但是大约需要一小时左右

编译之后输出至output目录,有3个子目录:be、fe、udf,只需要拷贝output目录到其他服务器即可

分发至其他服务器

例如:

scp -R ./serve [email protected]:~/

分发完毕之后更改一下目录所属权限,顺便把fe/doris-meta/与be/storage/目录删除,否则会影响后续启动。

# 更改目录或文件所属用户
sudo chown -R sudouser /home/sudouser/serve/doris-0.14.0/
# 更改目录或文件所属用户组
sudo chgrp -R sudouser /home/sudouser/serve/doris-0.14.0/
# 更改权限
sudo chmod -R 775 /home/sudouser/serve/doris-0.14.0/

注意:FOLLOWER角色的数量要为奇数

6.集群部署

因为是测试环境,所以此次部署1个FE,3个BE。

机器01 机器02 机器03
FE、BE BE BE

在机器01上创建目标目录

mkdir /data/serve/doris
6.1 配置 FE

将编译完的output/ 下的fe目录拷贝至该目录下。

配置文件为 fe/conf/fe.conf。其中注意:meta_dir:元数据存放位置。默认在 fe/doris-meta/下。需手动创建该目录。
注意:生产环境强烈建议单独指定目录不要放在Doris安装目录下,最好是单独的磁盘(如果有SSD最好),测试开发环境可以使用默认配置
fe.confJAVA_OPTS默认 java 最大堆内存为 4GB,建议生产环境调整至 8G 以上。

cd /data/softcware/doris/fe
# 首先需要创建doris-meta
mkdir doris-meta
- 配置priority_network

参考下面这个文档:https://blog.csdn.net/qq_37865420/article/details/114253083

这个非必选项

- 启动FE–master
sh bin/start_fe.sh --daemon

FE进程启动进入后台执行。日志默认存放在 fe/log/ 目录下。如启动失败,可以通过查看 fe/log/fe.log或者 fe/log/fe.out 查看错误信息。

有可能的错误一:

edit_log_port 9010端口被占用,重新更换edit_log_port端口

vi conf/fe.conf

有可能的错误二 :

单节点FE迁移启动失败

vi conf/fe.conf
# 增加一行配置后重新启动
metadata_failure_recovery=true
- 连接FE

可以用查看本机的hostname来进行连接,也可以使用本机的私有IP进行连接

mysql -uroot -hkbox101 -P9030

能连上说明master启动成功

- 验证:查看是否成功
SHOW PROC '/frontends'\G

FE 分为 Leader,Follower 和 Observer 三种角色。 默认一个集群,只能有一个 Leader,可以有多个 Follower 和 Observer。其中 Leader 和 Follower 组成一个 Paxos 选择组,如果 Leader 宕机,则剩下的 Follower 会自动选出新的 Leader,保证写入高可用。Observer 同步 Leader 的数据,但是不参加选举。如果只部署一个 FE,则 FE 默认就是 Leader。

第一个启动的 FE 自动成为 Leader,上面输出可以看到IsMaster: true。在此基础上,可以添加若干 Follower 和 Observer。

启动FE–Follower、Observer

在node4,node5,node6上第一次启动fe需要执行以下命令

./bin/start_fe.sh --helper host:port --daemon

例如下面

./bin/start_fe.sh --helper node1:9010 --daemon

切记
第一次启动fe一定要用–helper启动,否则启动不成功,无法加入集群,必须借助已经启动的FE节点(master或者follower)来扩容新的节点,helper 不能指向 新FE节点 自身
当新的fe第一次启动失败,或无法加入集群时。修改配置后,一定要先清空fe的doris-meta/路径,然后再重启fe

之后就可以添加节点
ALTER SYSTEM ADD FOLLOWER "10.32.21.9:9010";
ALTER SYSTEM ADD OBSERVER "10.32.21.9:9010";

其中 host 为 Follower 或 Observer 所在节点 ip,port 为其配置文件 fe.conf 中的 edit_log_port。

删除 FE 节点

使用以下命令删除对应的 FE 节点:

ALTER SYSTEM DROP FOLLOWER[OBSERVER] "fe_host:edit_log_port";

FE 缩容注意事项:

  1. 删除 Follower FE 时,确保最终剩余的 Follower(包括 Leader)节点为奇数。

配置&启动BE

启动BE之前,一定要把句柄设置的大一些:使用以下命令:

ulimit -n 655360

拷贝 BE 部署文件到所有要部署 BE 的节点
将源码编译生成的 output 下的 be 文件夹拷贝到 BE 的节点的指定部署路径下。

修改所有 BE 的配置

修改 be/conf/be.conf。主要是配置 storage_root_path:数据存放目录。默认在be/storage下,需要手动创建该目录。多个路径之间使用英文状态的分号 ; 分隔(最后一个目录后不要加 ;)。可以通过路径区别存储目录的介质,HDD或SSD。可以添加容量限制在每个路径的末尾,通过英文状态逗号,隔开。
注意:如果是SSD磁盘要在目录后面加上.SSD,HDD磁盘在目录后面加.HDD

*** 错误信息可以在be.info中查看***

错误一:

Check failed: s.ok() Internal error: tcp listen failed, errno=98, errmsg=Address already in use

BE webserver_port端口配置:

如果 be 部署在 hadoop 集群中,注意调整 be.conf 中的 webserver_port = 8040 ,以免造成端口冲突

启动BE
sh bin/start_be.sh --daemon
添加BE
ALTER SYSTEM ADD BACKEND "kbox101:9050";
查看BE运行情况
SHOW PROC '/backends'\G

显示结果:

*************************** 1. row ***************************
            BackendId: 12002
              Cluster: default_cluster
                   IP: xx.xx.xx.xx
             HostName: kbox101
        HeartbeatPort: 9050
               BePort: 9060
             HttpPort: 8085
             BrpcPort: 8060
        LastStartTime: 2021-11-23 15:14:09
        LastHeartbeat: 2021-11-23 15:24:50
                Alive: true
 SystemDecommissioned: false
ClusterDecommissioned: false
            TabletNum: 0
     DataUsedCapacity: .000 
        AvailCapacity: 1.000 B
        TotalCapacity: .000 
              UsedPct: 0.00 %
       MaxDiskUsedPct: 0.00 %
               ErrMsg: 
              Version: 0.14.0-release-Unknown
               Status: {"lastSuccessReportTabletsTime":"N/A"}
1 row in set (0.03 sec)

Alive的值为true,说明连接成功。

7.相关文档(不用看,略过就行)

doris安装部署及各种load方式

安装部署
1.下载Doris的安装包
cd /opt
wget https://dist.apache.org/repos/dist/dev/incubator/doris/0.12.0-rc03/apache-doris-0.12.
0-incubating-src.tar.gz
解压安装
tar -zxvf apache-doris-0.12.0-incubating-src.tar.gz
cd apache-doris-0.12.0-incubating-src
sh build.sh

2.配置该节点的FE(Leader)
cd output/fe
mkdir doris-meta
mkdir log
sh bin/start_fe.sh --daemon
运行之后检查一下,是否有doris的进行,监听的端口,日志信息等等
vi log/fe.log

3.配置BE
cd output/be
mkdir storage
mkdir log

4.分发到所有需要安装的BE节点 scp -r output/be root@主机名:/

5.安装mysql客户端
1,从官网下载安装包(在Centos7上要下载 RH Linux 7 的安装包)
https://dev.mysql.com/downloads/mysql/
mysql-8.0.17-1.el7.x86_64.rpm-bundle.tar
2,清理环境
2.1 查看系统是否已经安装了mysql数据库
rpm -qa | grep mysql
2.2 将查询出的文件逐个删除,如
yum remove mysql-community-common-5.7.20-1.el6.x86_64
2.3 删除mysql的配置文件
find / -name mysql
2.4 删除配置文件
rm -rf /var/lib/mysql
2.5删除MariaDB文件
rpm -pa | grep mariadb
删除查找出的相关文件和目录,如
yum -y remove mariadb-libs.x86_64
3,安装
3.1解压
tar -xf mysql-8.0.17-1.el7.x86_64.rpm-bundle.tar
3.2安装
yum install mysql-community-{client,common,devel,embedded,libs,server}-*
等待安装成功!
4,配置
4.1 启动mysqld服务,并设为开机自动启动。命令:
systemctl start mysqld.service/sudo service mysqld start  //这是centos7的命令
systemctl enable mysqld.service
4.2 通过如下命令可以在日志文件中找出密码:
grep "password" /var/log/mysqld.log
4.3按照日志文件中的密码,进入数据库
mysql -uroot -p
4.4设置密码(注意Mysql8密码设置规则必须是大小写字母+特殊符号+数字的类型)
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

6.远程连接doris服务
mysql -uroot -h 172.22.197.72 -P 9030

7.添加所有BE
ALTER SYSTEM ADD BACKEND "172.22.197.73:9050";
ALTER SYSTEM ADD BACKEND "172.22.197.74:9050";
ALTER SYSTEM ADD BACKEND "172.22.197.75:9050";
ALTER SYSTEM ADD BACKEND "172.22.197.76:9050";
ALTER SYSTEM ADD BACKEND "172.22.197.77:9050";
ALTER SYSTEM ADD BACKEND "172.22.197.78:9050";
ALTER SYSTEM ADD BACKEND "172.22.197.79:9050";
ALTER SYSTEM ADD BACKEND "172.22.197.80:9050";
ALTER SYSTEM ADD BACKEND "172.22.197.81:9050";
#删除BE节点,数据会同步到其他节点
ALTER SYSTEM DECOMMISSION BACKEND "172.22.197.73:9050";
#删除BE节点,该节点数据直接删除
ALTER SYSTEM DECOMMISSION BACKEND "172.22.197.73:9050";

8.启动BE节点
sh bin/start-be.sh --daemon

9.ui界面查看是否添加进来
http://172.22.197.72:8030/system?path=//backends

10.添加brokername
ALTER SYSTEM ADD BROKER broker_name01 "test-pro-doris-01:8000";
#删除
ALTER SYSTEM DROP BROKER broker_name "test-pro-doris-01:8000";
11.ui界面查看是否添加成功
http://172.22.197.72:8030/system?path=//brokers
doris ODBC load
1).在线安装MYSQL ODBC驱动
 yum -y install unixODBC
 yum -y install mysql-connector-odbc
 
 遇到问题:yum -y install mysql-connector-odbc 安装不成功
 
 解决方法:下载jar mysql-connector-odbc-8.0.11-1.el7.x86_64.rpm进行本地安装
 
 yum localinstall mysql-connector-odbc-8.0.11-1.el7.x86_64.rpm
2).配置Mysql驱动
 cat /etc/odbc.ini #添加如下信息
 /************************************************
 [mysql-hr]
 Driver = /usr/lib64/libmyodbc8a.so #注意驱动程序的选择
 Description = MyODBC 5 Driver 
 SERVER = 192.168.235.140    #要连接的数据库信息
 PORT = 3306
 USER = root
 Password = root
 Database = hr
 OPTION = 3
 charset=UTF8
3).测试连接
 # isql mysql-hr test root password -v ##语法:isql 数据源名称 用户名 密码 选项
 +---------------------------------------+
 | Connected! |
 | |password
 | sql-statement |
 | help [tablename] |
 | quit |
 | |
 +---------------------------------------+
 SQL>show database;
 测试成功
4).配置FE
 vim /doris-0.13.11/output/be/conf/fe.conf
 enable_odbc_table = true  必配项
5).配置BE(所有BE节点都需要配置)
 vim /doris-0.13.11/output/be/conf/odbcinst.ini 添加
 [MySQL Driver]
 Description     = ODBC for MySQL
 Driver          = /usr/lib/libmyodbc8a.so
 FileUsage       = 1
 说明:driver ODBC安装的目录
6).测试ODBC on doris
 推荐方式:
 
 ##### 1.通过ODBC_Resource来创建ODBC外表
 CREATE EXTERNAL RESOURCE `mysql_odbc_doris`
 PROPERTIES (
 "type" = "odbc_catalog",
 "host" = "172.22.193.65",
 "port" = "3306",
 "user" = "root",
 "password" = "password",
 "database" = "posresult",
 "odbc_type" = "mysql",
 "driver" = "MySQL Driver"
 );
 说明:
      host需要连接的数据库ip(映射库的ip)
      port端口
      user用户名
      password密码
      database数据库
      odbc_type:mysql(支持oracle, mysql, postgresql)
      driver:ODBC外表的Driver名,该名字需要和be/conf/odbcinst.ini中的Driver名一致
 #####2.创建DORIS外部表映射MYSQL表
 CREATE EXTERNAL TABLE `test_mysql` (
   `id` varchar(32) NOT NULL COMMENT 'ID',
   `table_bill_id` varchar(36) DEFAULT NULL COMMENT '菜单编号',
   `shop_id` varchar(32) DEFAULT NULL COMMENT '门店ID',
   `dish_type` int(11) DEFAULT NULL COMMENT '类型 : 1-菜品 2-火锅 3-底料',
   `dish_id` varchar(50) DEFAULT NULL COMMENT '菜品ID(此处为菜品ID,不是菜品关联ID)',
   `dish_name` varchar(100) DEFAULT NULL COMMENT '菜品名称',
   `standard_id` varchar(32) DEFAULT NULL COMMENT '规格编码',
   `standard_code` varchar(100) DEFAULT NULL COMMENT '规格ID',
   `dish_price` varchar(16) DEFAULT NULL COMMENT '菜品单价',
   `served_quantity` int(11) DEFAULT NULL COMMENT '已上数量',
   `order_time` varchar(50) DEFAULT NULL COMMENT '点菜时间',
   `dish_abnormal_status` varchar(20) DEFAULT NULL COMMENT '[A]菜品异常状态',
   `ts` varchar(20) DEFAULT NULL COMMENT 'POS订单创建时间',
   `taste_type_id` varchar(32) DEFAULT NULL,
   `taste_name` varchar(50) DEFAULT NULL
 ) ENGINE=ODBC
 COMMENT "ODBC"
 PROPERTIES (
 "odbc_catalog_resource" = "mysql_odbc_doris_test",
 "database" = "posresult",
 "table" = "t_pro_dish_list_detail"
 );
 说明:
 odbc_catalog_resource 创建的Resource名称
 database 外表数据库数据库名称
 table 外表数据库表名
 #####3.执行DDL操作是否插入成功
 selct * from test_mysql
7).常见错误
 1.出现错误:(10001 NOT ALIVE,10002 NOT ALIVE)
 原因:编译doris的时候没有带WITH_MYSQL,Mysql_Odbc需要8.x,如果采用5.x会出现上面错误,切换版本到8.X
      编译如果带WITH_MYSQL,可以采用5.x版本

8.使用supervisor实现Doris进程自动拉起

supervisor安装

1).使用yum命令安装(推荐)

yum install epel-release
yum install -y supervisor
# 开机自启动
# 启动supervisord服务
systemctl start supervisord 
# 查看supervisord服务状态
systemctl status supervisord 
# 查看是否存在supervisord进程
ps -ef|grep supervisord 

2).启动supervisor(可略过)

supervisord -c /etc/supervisord.conf

3).查看supervisor是否启动成功(可略过)

ps -ef|grep supervisord

4).将supervisor配置为开机自启动服务

vim /usr/lib/systemd/system/supervisord.service
[Unit]
Description=Supervisor daemon
[Service]
Type=forking
PIDFile=/var/run/supervisord.pid
ExecStart=/bin/supervisord -c /etc/supervisord.conf
ExecStop=/bin/supervisorctl shutdown
ExecReload=/bin/supervisorctl reload
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

5).启动服务

systemctl enable supervisord

6).查看是否启动

systemctl is-enabled supervisord
doris通过supervsor进行进程管理配置

1).配置palo be 进程管理

修改各个 start_be.sh 脚本,去掉最后的 & 符号

vim /home/sudouser/serve/doris-0.14.0/be/bin/start_be.sh
99nohup $LIMIT ${DORIS_HOME}/lib/palo_be "$@" >> $LOG_DIR/be.out 2>&1 </dev/null &
修改成nohup $LIMIT ${DORIS_HOME}/lib/palo_be "$@" >> $LOG_DIR/be.out 2>&1 </dev/null
wq保存退出

创建be supervisor进程管理配置文件

vim /etc/supervisord.d/palo_be.ini
[program:PaloBe]
environment = JAVA_HOME="/usr/java/jdk1.8.0_181-cloudera/"
process_name=PaloBe
directory=/home/sudouser/serve/doris-0.14.0/be
command=sh /home/sudouser/serve/doris-0.14.0/be/bin/start_be.sh  --daemon
autostart=true
autorestart=true
user=sudouser
numprocs=1
startretries=3
stopasgroup=true
killasgroup=true
startsecs=10
#redirect_stderr=true
#stdout_logfile_maxbytes=20MB
stdout_logfile_backups=10
stdout_logfile=/var/log/supervisor-PaloBe.log

2).配置fe进程管理

修改各个 start_fe.sh 脚本,去掉最后的 & 符号

vim /home/sudouser/serve/doris-0.14.0/fe/bin/start_fe.sh
147行nohup $LIMIT $JAVA $final_java_opt org.apache.doris.PaloFe ${HELPER} "$@" >> $LOG_DIR/fe.out 2>&1 </dev/null &
修改为nohup $LIMIT $JAVA $final_java_opt org.apache.doris.PaloFe ${HELPER} "$@" >> $LOG_DIR/fe.out 2>&1 </dev/null

创建fe supervisor进程管理配置文件

vim /etc/supervisord.d/palo_fe.ini
[program:PaloFe]
environment = JAVA_HOME="/usr/java/jdk1.8.0_181-cloudera/"
process_name=PaloFe
directory=/home/sudouser/serve/doris-0.14.0/fe
command=sh /home/sudouser/serve/doris-0.14.0/fe/bin/start_fe.sh
autostart=true
autorestart=true
user=sudouser
numprocs=1
startretries=3
stopasgroup=true
killasgroup=true
startsecs=10
#redirect_stderr=true
#stdout_logfile_maxbytes=20MB
#stdout_logfile_backups=10
#stdout_logfile=/var/log/supervisor-PaloFe.log

更新新的配置到supervisord

supervisorctl update

注意:这里只要在etc/supervisord.d/目录下的服务配置发生了改变,就需要执行这个更新命令

启动某个进程(program_name=你配置中写的程序名称)

supervisorctl start program_name

查看全部的进程状态

supervisorctl status

3).验证

先确保没有palo fe,be,broker进程在运行,如果有则使用kill -9 [processid]杀死掉

[sudouser@doris01 fe]$ jps
50258 DataNode
60387 Jps
59908 PaloFe
50109 NameNode
40318 BrokerBootstrap
[sudouser@doris01 soft]# kill -9 59908
[sudouser@doris01 soft]# kill -9 40318
说明: BrokerBootstrap为broker的进程名称,PaloFe为fe的进程名称

停止掉be

[sudouser@doris01 fe]$ ps -e | grep palo

启动supervisor,验证fe,be,broker是否启动

启动supervisor

supervisord -c /etc/supervisord.conf

查看状态:

[sudouser@doris01 soft]# supervisorctl status
BrokerBootstrap                  RUNNING   pid 64312, uptime 0:00:16
PaloFe                           RUNNING   pid 64314, uptime 0:00:16
palo_be                          RUNNING   pid 64313, uptime 0:00:16

验证fe,be,broker进程是否启动

[sudouser@doris01 soft]# jps
50258 DataNode
63846 Jps
61548 BrokerBootstrap
50109 NameNode
60734 PaloFe
[sudouser@doris01 soft]# ps -elf | grep palo
61118 ?        00:00:01 palo_be

通过supervisorctl stop后,进程是否停止

[sudouser@doris01 soft]# supervisorctl stop palo_be
palo_be: stopped
[sudouser@doris01 soft]# supervisorctl stop PaloFe
PaloFe: stopped
[sudouser@doris01 soft]# supervisorctl stop BrokerBootstrap
BrokerBootstrap: stopped

通过supervisorctl start可以开启进程

[sudouser@doris01 soft]# supervisorctl start all
palo_be: started
PaloFe: started
BrokerBootstrap: started
[sudouser@doris01 soft]# supervisorctl status
BrokerBootstrap                  RUNNING   pid 65421, uptime 0:00:21
PaloFe                           RUNNING   pid 498, uptime 0:00:21
palo_be                          RUNNING   pid 65422, uptime 0:00:21

结果显示启动控制成功。

验证在fe,be,broker崩溃后supervisor能够自动重启进程
输入命令ps xuf查看进程间的父子关系

ps xuf
sudouser     13617  0.0  0.0 243272 13056 ?        Ss   12月21   0:15 /usr/bin/python /bin/supervisord -c /etc/supervisord.conf
sudouser     13618  0.0  0.0 113304  1572 ?        S    12月21   0:00  \_ sh /soft/apache_hdfs_broker/bin/start_broker.sh
sudouser     13907  0.0  0.0 5259032 235864 ?      Sl   12月21   0:34  |   \_ /usr/local/java/bin/java -Xmx1024m -Dfile.encoding=UTF-8 org.apache.doris.broker.hdfs.BrokerBootstrap
sudouser     13619  0.0  0.0 113176  1512 ?        S    12月21   0:00  \_ sh /soft/doris-be/bin/start_be.sh
sudouser     14151  102  0.7 7065568 4194076 ?     Sl   12月21 836:43      \_ /soft/doris-be/lib/palo_be

执行命令kill -9 14151, 14151是supervisor启动be的pid
输入命令,看是否重启

ps xuf
sudouser     13617  0.0  0.0 243528 13388 ?        Ss   12月21   0:15 /usr/bin/python /bin/supervisord -c /etc/supervisord.conf
sudouser     13618  0.0  0.0 113304  1572 ?        S    12月21   0:00  \_ sh /soft/apache_hdfs_broker/bin/start_broker.sh
sudouser     13907  0.0  0.0 5259032 235864 ?      Sl   12月21   0:34  |   \_ /usr/local/java/bin/java -Xmx1024m -Dfile.encoding=UTF-8 org.apache.doris.broker.hdfs.BrokerBootstrap
sudouser     24209  0.5  0.0 113384  1624 ?        S    10:02   0:00  \_ sh /soft/doris-be/bin/start_be.sh
sudouser     24568  113  0.5 5640592 2756220 ?     Sl   10:02   0:27      \_ /soft/doris-be/lib/palo_be

重启后的pid是24568

查看be配置
http://172.22.197.73:8040/varz
查看FE配置
http://172.22.197.72:8030/variable

9.其他命令

# 更改目录或文件所属用户
sudo chown -R sudouser /home/sudouser/serve/doris-0.14.0/
# 更改目录或文件所属用户组
sudo chgrp -R sudouser /home/sudouser/serve/doris-0.14.0/
# 更改权限
sudo chmod -R 775 /home/sudouser/serve/doris-0.14.0/

10.遇到的问题

10.1 Failed to download DataTables.zip\s2n-0.10.0.tar.gz

except-md5 f7f18a9f39d692ec33b5536bff617232 
actual-md5 7698e7ae6c1d53d5e1f256b4fc8d5a44  /root/data/apache-doris-0.14.0-incubating-src/thirdparty/src/DataTables.zip
Archive DataTables.zip will be removed and download again.
Failed to download DataTables.zip
vi var.sh 
将DataTables.zip的MD5值进行替换

10.2 Failed to unzip DataTables.zip

需要在本地进行解压后上传到服务器对应位置,并进行更名

~/src/DataTables-1.10.25

vi var.sh # 将DataTables的名称由DataTables-1.10.23改为DataTables-1.10.25

vi var.sh # 将s2n的名称由s2n-0.10.0改为s2n-tls-0.10.0cd

10.3 CMake 3.1 or higher is required. You are running version xxxx

yum remove cmake
yum  install cmake3
#创建软连接
ln -s /usr/bin/cmake3  /usr/bin/cmake

10.4 有可能会报Bootstrap3.3.7/与jQuery3.3.1/目录无法找到的问题

Bootstrap3.3.7/与jQuery3.3.1/均在解压后的DataTable目录下

11.可参考的技术文档

Doris12版安装编译部署(docker编译)

记录apache doris使用过程中出现的问题

集群部署

Apache Doris 环境安装部署

Doris数据库压测

12.数据库压测

1) 首先下载ssb-poc工具包并编译

cd poc
wget http://dorisdb-public.oss-cn-zhangjiakou.aliyuncs.com/ssb-poc-0.9.zip
unzip ssb-poc-0.9.zip
cd ssb-poc
make && make install

2) 所有相关工具安装到output目录

进入output目录

cd poc/ssb-poc/output

–如果使用因子100,生成6亿条记录的初始文件,约59G,用时15分钟,本次未执行,仅供参考。

bin/gen-ssb.sh 100 data_dir

本次测试使用因子1000,生成60亿条记录的初始文件,约600G,用时4.5小时.

[root@doris1 output]# time bin/gen-ssb.sh 1000 data_dir
	> /poc/ssb-poc/output/bin
	> /poc/ssb-poc/output
	> Generating new data set of scale factor 1000

说明:尝试生成100亿条记录,但该工具超过10000GB的数据文件功能仍在测试中,生成的数据集可能不合规!

[root@doris1 output]# time bin/gen-ssb.sh 1700 data_dir
/poc/ssb-poc/output/bin
/poc/ssb-poc/output
Generating new data set of scale factor 1700
NOTE: Data generation for scale factors >  1000 GB is still in development,
  and is not yet supported.


Your resulting data set MAY NOT BE COMPLIANT!

建议可以使用小于1000G的数据测试,因子小于1400,可进行测试,本人未做验证。

3. 创建表结构

1) 确定测试目录

[root@doris1 output]# pwd
/root/ssb-poc/output

2) 修改配置文件conf/doris.conf

[root@doris1 output]# vim conf/doris.conf        #即/poc/ssb-poc/output/conf/doris.conf,指定脚本操作的Doris集群地址
[doris]
# for mysql cmd
mysql_host: doris1
mysql_port: 9030
mysql_user: root
mysql_password: demo_415
doris_db: ssb
# cluster ports
http_port: 8030
be_heartbeat_port: 9050
broker_port: 8000

参数说明:

[doris]
# for mysql cmd
mysql_host: doris1                    #FE节点主机名,IP地址也可以
mysql_port: 9030                      #FE端口号
mysql_user: root                      #DorisDB用户名root
mysql_password: poc_ssb                #root密码
doris_db: ssb                          #生成的测试数据库名为ssb(Star schema benchmark)

# cluster ports
http_port: 8030                        #BE端口
be_heartbeat_port: 9050                #BE心跳端口
broker_port: 8000                      #broker端口号

3) 执行建表语句

执行脚本建表,ddl_100表示6亿条记录规模,ddl_1000表示60亿条记录规模,ddl_1677约100亿条记录规模,生成数据在output/data_dir目录.

–生成6亿条记录规模空表,本次未执行,仅供参考。

[root@doris1 output]# time bin/create_db_table.sh ddl_100
sql: ssb_create success
sql: ssb_flat_create success


real  0m0.318s
user  0m0.110s
sys  0m0.015s

生成60亿条记录规模空表,本次测试规模。

[root@doris1 output]# time bin/create_db_table.sh ddl_1000
sql: ssb_create success
sql: ssb_flat_create success


real  0m0.423s
user  0m0.091s
sys  0m0.013s

4).查看生成的表

mysql> use ssb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A


Database changed
mysql> show tables;
+----------------+
| Tables_in_ssb  |
+----------------+
| customer       |
| dates          |
| lineorder      |
| lineorder_flat |
| part           |
| supplier       |
+----------------+
6 rows in set (0.00 sec)

4. 数据导入

1) 导入单表记录,用时41m5.584s

使用Stream load导入单表数据,用时41m5.584s,data_dir为前述数据生成目录,将数据导入DorisDB数据库中。

[root@doris1 output]# time bin/stream_load.sh data_dir
lineorder/customer/dates/part/supplier

real  41m5.584s
user  0m30.070s
sys  8m24.738s

其中lineorder导入记录60亿条。其它记录数详见1.2测试数据说明。

2) 插入数据到宽表lineorder_flat,用时60m0.412s

[root@doris1 output]# time bin/flat_insert.sh
sql: ssb_flat_insert start                                                                                                                                                                   
sql: ssb_flat_insert. flat insert error, msg: (1064, 'Cancelled')

real  60m0.412s
user  0m0.102s
sys  0m0.029s

60亿宽表插入报错,可能是SSB-POC工具问题,也可能是DorisDB问题,当前使用DorisDB1.15.2,原因待查。

实际只导入36亿条,36亿条记录可满足测试需求。

5. 设置查询并行度

首先在客户端执行命令,因只有8个core,此处设置Doris的并行度为8,类似clickhouse set max_threads= 8。

mysql> set global parallel_fragment_exec_instance_num  = 8;
Query OK, 0 rows affected (0.01 sec)
mysql> show variables like 'parallel_fragment_exec_instance_num';
+-------------------------------------+-------+
| Variable_name                       | Value |
+-------------------------------------+-------+
| parallel_fragment_exec_instance_num | 8     |
+-------------------------------------+-------+
1 row in set (0.00 sec)

此处只进行了并行度设置,未进行fe、be参数优化设置。

6. SSB测试

共执行了4类场景,13条查询语句,分别为单表查询和多表查询,结果为毫秒,并发为1。

1) 单表测试场景

执行语句:

[root@doris1 output]# time bin/benchmark.sh -p -d ssb
------ dataset: ssb, concurrency: 1 ------
sql\time(ms)\parallel_num  1
q1  14430.0
q2  4153.0
q3  3265.0
q4  29478.0
q5  19391.0
q6  14638.0
q7  83782.0
q8  21801.0
q9  17182.0
q10  5030.0
q11  68037.0
q12  31603.0
q13  39640.0

real  5m59.162s
user  0m0.154s
sys  0m0.113s

单表查询时间超过分钟的为查询q7、q11均是对宽表的查询。

执行截图:

Apache Doris安装过程_第1张图片

2) 多表jion测试场景

执行语句:

[root@doris1 output]# time bin/benchmark.sh -p -d ssb-flat
------ dataset: ssb-flat, concurrency: 1 ------
sql\time(ms)\parallel_num  1
q1  20464.0
q2  34725.0
q3  25810.0
q4  35177.0
q5  31152.0
q6  23387.0
q7  22354.0
q8  11362.0
q9  1970.0
q10  35.0
q11  36059.0
q12  63.0
q13  32.0

real  4m9.385s
user  0m0.167s
sys  0m0.099s

多表join查询时间未超过分钟级。

执行截图:

Apache Doris安装过程_第2张图片

7. 测试语句

1) 单表测试SQL

--Q1.1 
SELECT sum(lo_extendedprice * lo_discount) AS `revenue` 
FROM lineorder_flat 
WHERE lo_orderdate >= '1993-01-01' and lo_orderdate <= '1993-12-31' AND lo_discount BETWEEN 1 AND 3 AND lo_quantity < 25; 
 
--Q1.2 
SELECT sum(lo_extendedprice * lo_discount) AS revenue FROM lineorder_flat  
WHERE lo_orderdate >= '1994-01-01' and lo_orderdate <= '1994-01-31' AND lo_discount BETWEEN 4 AND 6 AND lo_quantity BETWEEN 26 AND 35; 
 
--Q1.3 
SELECT sum(lo_extendedprice * lo_discount) AS revenue 
FROM lineorder_flat 
WHERE weekofyear(lo_orderdate) = 6 AND lo_orderdate >= '1994-01-01' and lo_orderdate <= '1994-12-31' 
AND lo_discount BETWEEN 5 AND 7 AND lo_quantity BETWEEN 26 AND 35; 


--Q2.1 
SELECT sum(lo_revenue), year(lo_orderdate) AS year,  p_brand 
FROM lineorder_flat 
WHERE p_category = 'MFGR#12' AND s_region = 'AMERICA' 
GROUP BY year,  p_brand 
ORDER BY year, p_brand; 
 
--Q2.2 
SELECT 
sum(lo_revenue), year(lo_orderdate) AS year, p_brand 
FROM lineorder_flat 
WHERE p_brand >= 'MFGR#2221' AND p_brand <= 'MFGR#2228' AND s_region = 'ASIA' 
GROUP BY year,  p_brand 
ORDER BY year, p_brand; 
  
--Q2.3 
SELECT sum(lo_revenue),  year(lo_orderdate) AS year, p_brand 
FROM lineorder_flat 
WHERE p_brand = 'MFGR#2239' AND s_region = 'EUROPE' 
GROUP BY  year,  p_brand 
ORDER BY year, p_brand; 


--Q3.1 
SELECT c_nation, s_nation,  year(lo_orderdate) AS year, sum(lo_revenue) AS revenue FROM lineorder_flat 
WHERE c_region = 'ASIA' AND s_region = 'ASIA' AND lo_orderdate  >= '1992-01-01' AND lo_orderdate   <= '1997-12-31' 
GROUP BY c_nation, s_nation, year 
ORDER BY  year ASC, revenue DESC; 
 
--Q3.2 
SELECT  c_city, s_city, year(lo_orderdate) AS year, sum(lo_revenue) AS revenue
FROM lineorder_flat 
WHERE c_nation = 'UNITED STATES' AND s_nation = 'UNITED STATES' AND lo_orderdate  >= '1992-01-01' AND lo_orderdate <= '1997-12-31' 
GROUP BY c_city, s_city, year 
ORDER BY year ASC, revenue DESC; 


--Q3.3 
SELECT c_city, s_city, year(lo_orderdate) AS year, sum(lo_revenue) AS revenue 
FROM lineorder_flat 
WHERE c_city in ( 'UNITED KI1' ,'UNITED KI5') AND s_city in ( 'UNITED KI1' ,'UNITED KI5') AND lo_orderdate  >= '1992-01-01' AND lo_orderdate <= '1997-12-31' 
GROUP BY c_city, s_city, year 
ORDER BY year ASC, revenue DESC; 


--Q3.4 
SELECT c_city, s_city, year(lo_orderdate) AS year, sum(lo_revenue) AS revenue 
FROM lineorder_flat 
WHERE c_city in ('UNITED KI1', 'UNITED KI5') AND s_city in ( 'UNITED KI1',  'UNITED KI5') AND  lo_orderdate  >= '1997-12-01' AND lo_orderdate <= '1997-12-31' 
GROUP BY c_city,  s_city, year 
ORDER BY year ASC, revenue DESC; 


--Q4.1 
set vectorized_engine_enable = FALSE; 
SELECT year(lo_orderdate) AS year, c_nation,  sum(lo_revenue - lo_supplycost) AS profit FROM lineorder_flat 
WHERE c_region = 'AMERICA' AND s_region = 'AMERICA' AND p_mfgr in ( 'MFGR#1' , 'MFGR#2') 
GROUP BY year, c_nation 
ORDER BY year ASC, c_nation ASC; 


--Q4.2 
SELECT year(lo_orderdate) AS year, 
    s_nation, p_category, sum(lo_revenue - lo_supplycost) AS profit 
FROM lineorder_flat 
WHERE c_region = 'AMERICA' AND s_region = 'AMERICA' AND lo_orderdate >= '1997-01-01' and lo_orderdate <= '1998-12-31' AND  p_mfgr in ( 'MFGR#1' , 'MFGR#2') 
GROUP BY year, s_nation,  p_category 
ORDER BY  year ASC, s_nation ASC, p_category ASC; 


--Q4.3 
SELECT year(lo_orderdate) AS year, s_city, p_brand, 
    sum(lo_revenue - lo_supplycost) AS profit 
FROM lineorder_flat 
WHERE s_nation = 'UNITED STATES' AND lo_orderdate >= '1997-01-01' and lo_orderdate <= '1998-12-31' AND p_category = 'MFGR#14' 
GROUP BY  year,  s_city, p_brand 
ORDER BY year ASC,  s_city ASC,  p_brand ASC;

2) 多表jion测试SQL

--Q1.1 
select sum(lo_revenue) as revenue
from lineorder join dates on lo_orderdate = d_datekey
where d_year = 1993 and lo_discount between 1 and 3 and lo_quantity < 25;


--Q1.2
select sum(lo_revenue) as revenue
from lineorder
join dates on lo_orderdate = d_datekey
where d_yearmonthnum = 199401
and lo_discount between 4 and 6
and lo_quantity between 26 and 35;


--Q1.3
select sum(lo_revenue) as revenue
from lineorder
join dates on lo_orderdate = d_datekey
where d_weeknuminyear = 6 and d_year = 1994
and lo_discount between 5 and 7
and lo_quantity between 26 and 35;


--Q2.1
select sum(lo_revenue) as lo_revenue, d_year, p_brand
from lineorder
inner join dates on lo_orderdate = d_datekey
join part on lo_partkey = p_partkey
join supplier on lo_suppkey = s_suppkey
where p_category = 'MFGR#12' and s_region = 'AMERICA'
group by d_year, p_brand
order by d_year, p_brand;


--Q2.2
select sum(lo_revenue) as lo_revenue, d_year, p_brand
from lineorder
join dates on lo_orderdate = d_datekey
join part on lo_partkey = p_partkey
join supplier on lo_suppkey = s_suppkey
where p_brand between 'MFGR#2221' and 'MFGR#2228' and s_region = 'ASIA'
group by d_year, p_brand
order by d_year, p_brand;


--Q2.3
select sum(lo_revenue) as lo_revenue, d_year, p_brand
from lineorder
join dates on lo_orderdate = d_datekey
join part on lo_partkey = p_partkey
join supplier on lo_suppkey = s_suppkey
where p_brand = 'MFGR#2239' and s_region = 'EUROPE'
group by d_year, p_brand
order by d_year, p_brand;


--Q3.1
select c_nation, s_nation, d_year, sum(lo_revenue) as lo_revenue
from lineorder
join dates on lo_orderdate = d_datekey
join customer on lo_custkey = c_custkey
join supplier on lo_suppkey = s_suppkey
where c_region = 'ASIA' and s_region = 'ASIA'and d_year >= 1992 and d_year <= 1997
group by c_nation, s_nation, d_year
order by d_year asc, lo_revenue desc;


--Q3.2
select c_city, s_city, d_year, sum(lo_revenue) as lo_revenue
from lineorder
join dates on lo_orderdate = d_datekey
join customer on lo_custkey = c_custkey
join supplier on lo_suppkey = s_suppkey
where c_nation = 'UNITED STATES' and s_nation = 'UNITED STATES'
and d_year >= 1992 and d_year <= 1997
group by c_city, s_city, d_year
order by d_year asc, lo_revenue desc;


--Q3.3
select c_city, s_city, d_year, sum(lo_revenue) as lo_revenue
from lineorder
join dates on lo_orderdate = d_datekey
join customer on lo_custkey = c_custkey
join supplier on lo_suppkey = s_suppkey
where (c_city='UNITED KI1' or c_city='UNITED KI5')
and (s_city='UNITED KI1' or s_city='UNITED KI5')
and d_year >= 1992 and d_year <= 1997
group by c_city, s_city, d_year
order by d_year asc, lo_revenue desc;


--Q3.4
select c_city, s_city, d_year, sum(lo_revenue) as lo_revenue
from lineorder
join dates on lo_orderdate = d_datekey
join customer on lo_custkey = c_custkey
join supplier on lo_suppkey = s_suppkey
where (c_city='UNITED KI1' or c_city='UNITED KI5') and (s_city='UNITED KI1' or s_city='UNITED KI5') and d_yearmonth
 = 'Dec1997'
group by c_city, s_city, d_year
order by d_year asc, lo_revenue desc;


--Q4.1
select d_year, c_nation, sum(lo_revenue) - sum(lo_supplycost) as profit
from lineorder
join dates on lo_orderdate = d_datekey
join customer on lo_custkey = c_custkey
join supplier on lo_suppkey = s_suppkey
join part on lo_partkey = p_partkey
where 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;


--Q4.2
select d_year, s_nation, p_category, sum(lo_revenue) - sum(lo_supplycost) as profit
from lineorder
join dates on lo_orderdate = d_datekey
join customer on lo_custkey = c_custkey
join supplier on lo_suppkey = s_suppkey
join part on lo_partkey = p_partkey
where c_region = 'AMERICA'and s_region = 'AMERICA'
and (d_year = 1997 or d_year = 1998)
and (p_mfgr = 'MFGR#1' or p_mfgr = 'MFGR#2')
group by d_year, s_nation, p_category
order by d_year, s_nation, p_category;



--Q4.3
select d_year, s_city, p_brand, sum(lo_revenue) - sum(lo_supplycost) as profit
from lineorder
join dates on lo_orderdate = d_datekey
join customer on lo_custkey = c_custkey
join supplier on lo_suppkey = s_suppkey
join part on lo_partkey = p_partkey
where c_region = 'AMERICA'and s_nation = 'UNITED STATES'
and (d_year = 1997 or d_year = 1998)
and p_category = 'MFGR#14'
group by d_year, s_city, p_brand
order by d_year, s_city, p_brand;

在60亿条单表记录,36亿条宽表记录情况下,通过SSB测试,DorisDB单表查询时间超过分钟的为查询q7、q11,均是对宽表的查询,多表join查询时间未超过分钟级,性能还是较为给力。作为国产OLAP一哥,还是值得一试。

和同类竞品clickhouse、greenplum相比具有很大的优势,文中未做对比。

你可能感兴趣的:(学习笔记,数据库,big,data,Doris)