Apache Doris BE 开发环境搭建

作者: 张家锋

前期准备工作

本教程是在Ubuntu 20.04下进行的

  1. 下载doris源代码 下载地址为:apache/incubator-doris: Apache Doris (Incubating) (github.com)
  2. 安装GCC 8.3.1+,Oracle JDK 1.8+,Python 2.7+,确认 gcc, java, python 命令指向正确版本, 设置 JAVA_HOME 环境变量
  3. 安装其他依赖包
    sudo apt install build-essential openjdk-8-jdk maven cmake byacc flex automake libtool-bin bison binutils-dev libiberty-dev zip unzip libncurses5-dev curl git ninja-build python brotli
    sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
    sudo apt update
    sudo apt install gcc-10 g++-10 
    sudo apt-get install autoconf automake libtool autopoint
    

安装openssl-devel:

sudo apt install -y openssl-devel

编译

以下操作步骤在/home/zhangfeng目录下进行

  1. 下载源码
    git clone https://github.com/apache/incubator-doris.git 
    
  2. 编译第三方依赖包
    cd /home/zhangfeng/incubator-doris/thirdparty
    ./build-thirdparty.sh
    
  3. 编译doris产品代码
    cd /home/zhangfeng/incubator-doris
    ./build.sh
    

注意:这个编译有以下几条指令:

./build.sh  ##同时编译be 和fe
./build.sh  --be ##只编译be
./build.sh  --fe ##只编译fe
./build.sh  --fe --be##同时编译be fe
./build.sh  --fe --be --clean##删除并同时编译be fe
./build.sh  --fe  --clean##删除并编译fe
./build.sh  --be  --clean##删除并编译be
./build.sh  --be --fe  --clean##删除并同时编译be fe

如果不出意外,应该会编译成功,最终的部署文件将产出到 /home/zhangfeng/incubator-doris/output/ 目录下。如果还遇到其他问题,可以参照doris的安装文档http://doris.apache.org。

部署调试

  1. 给be编译结果文件授权
    chmod  /home/zhangfeng/incubator-doris/output/be/lib/palo_be
    

注意: /home/zhangfeng/incubator-doris/output/be/lib/palo_be为be的执行文件。

  1. 创建数据存放目录

通过查看/home/zhangfeng/incubator-doris/output/be/conf/be.conf

## INFO, WARNING, ERROR, FATAL
sys_log_level = INFO
be_port = 9060
be_rpc_port = 9070
webserver_port = 8040
heartbeat_service_port = 9050
brpc_port = 8060

## 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/

## Default value is empty.
priority_networks = 192.168.59.0/24 ## data root path, seperate by ';'
storage_root_path = /soft/be/storage 

## sys_log_dir = $/log

## sys_log_roll_mode = SIZE-MB-

## sys_log_roll_num =

## sys_log_verbose_modules =

## log_buffer_level = -

## palo_cgroups 

需要创建这两个文件夹,这是be数据存放的地方

mkdir -p /soft/be/storage
  1. 打开vscode,并打开be源码所在目录,在本案例中打开目录为/home/workspace/incubator-doris/
  2. 安装vscode ms c++调试插件

img

  1. 创建launch.json文件,文件内容如下:
    {
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/workspace/incubator-doris/output/be/lib/palo_be",
            "args": [],
            "stopAtEntry": false,
            "cwd": "/home/workspace/incubator-doris/",
            "environment": [{"name":"PALO_HOME","value":"/home/zhangfeng/incubator-doris/output/be/"},
                            {"name":"UDF_RUNTIME_DIR","value":"/home/zhangfeng/incubator-doris/output/be/lib/udf-runtime"},
                            {"name":"LOG_DIR","value":"/home/zhangfeng/incubator-doris/output/be/log"},
                            {"name":"PID_DIR","value":"/home/zhangfeng/incubator-doris/output/be/bin"}
                           ],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
    }
    

其中,environment定义了几个环境变量DORIS_HOME UDF_RUNTIME_DIR LOG_DIR PID_DIR,这是palo_be运行时需要的环境变量,如果没有设置,启动会失败。 注意:如果希望是attach(附加进程)调试,配置代码如下:

{
    "version": "0.2.0",
    "configurations": [
        {
          "name": "(gdb) Launch",
          "type": "cppdbg",
          "request": "attach",
          "program": "/home/zhangfeng/incubator-doris/output/lib/palo_be",
          "processId":,
          "MIMode": "gdb",
          "internalConsoleOptions":"openOnSessionStart",
          "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

配置中 “request”: “attach”, “processId”:17016,这两个配置节是重点: 分别设置gdb的调试模式为attach,附加进程的processId,否则会失败。如何查找进程id,可以在命令行中输入以下命令:

ps -ef | grep palo*

如图:

其中的15200即为当前运行的be的进程id.

一个完整的lainch.json的例子如下:

 {
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Attach",
            "type": "cppdbg",
            "request": "attach",
            "program": "/home/zhangfeng/incubator-doris/output/be/lib/palo_be",
            "processId": 17016,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/zhangfeng/incubator-doris/output/be/lib/palo_be",
            "args": [],
            "stopAtEntry": false,
            "cwd": "/home/zhangfeng/incubator-doris/output/be",
            "environment": [
                {
                    "name": "DORIS_HOME",
                    "value": "/home/zhangfeng/incubator-doris/output/be"
                },
                {
                    "name": "UDF_RUNTIME_DIR",
                    "value": "/home/zhangfeng/incubator-doris/output/be/lib/udf-runtime"
                },
                {
                    "name": "LOG_DIR",
                    "value": "/home/zhangfeng/incubator-doris/output/be/log"
                },
                {
                    "name": "PID_DIR",
                    "value": "/home/zhangfeng/incubator-doris/output/be/bin"
                }
            ],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

6.点击调试即可

img

文章列表

更多推荐

更多
  • Pulsar消息队列-一套高可用实时消息系统实现 实时消息【即时通信】系统,有群聊和单聊两种方式,其形态异于消息队列:1 大量的 group 信息变动,群聊形式的即时通信系统在正常服务形态下,瞬时可能有大量用户登入登出。2 ...
  • Pulsar消息队列-Pulsar对比Kafka笔记 很多人查看 Pulsar 之前可能对 Kafka 很熟悉,参照上图可见二者内部结构的区别,Pulsar 和 Kafka 都是以 Topic 描述一个基本的数据集合,Topic 数据又分为若干 Partition,即对数据进行逻辑上的 ...
  • Pulsar消息队列-对 2017 年一套 IM 系统的反思 信系统的开发,前前后后参与或者主导了六七个 IM 系统的研发。上一次开发的 IM 系统的时间点还是 2018 年,关于该系统的详细描述见 [一套高可用实时消息系统实现][1] ...
  • Apache APISIX文档-快速入门指南-如何构建 Apache APISIX 如何构建 Apache APISIX,步骤1:安装 Apache APISIX,步骤2:安装 etcd,步骤3:管理 Apache APISIX 服务,步骤4:运行测试案例,步骤5:修改 Admin API key,步骤6:为 Apac
  • Apache APISIX文档-快速入门指南-快速入门指南 快速入门指南,概述,前提条件,第一步:安装 Apache APISIX,第二步:创建路由,第三步:验证,进阶操作,工作原理,创建上游服务Upstream,绑定路由与上游服务,添加身份验证,为路由添加前缀,APISIX Dashboard
  • Apache APISIX文档-架构设计-APISIX APISIX,软件架构,插件加载流程,插件内部结构,配置 APISIX,插件加载流程,比如指定 APISIX 默认监听端口为 8000,并且设置 etcd 地址为 http://foo:2379, 其他配置保持默认。在 ...
  • Apache APISIX文档-架构设计-Service Service 是某类 API 的抽象(也可以理解为一组 Route 的抽象)。它通常与上游服务抽象是一一对应的,Route 与 Service 之间,通常是 N:1 的关系,参看下图。不同 Route 规则同时绑定到一个 Service ...
  • Apache APISIX文档-架构设计-Plugin Config 如果你想要复用一组通用的插件配置,你可以把它们提取成一个 Plugin config,并绑定到对应的路由上。举个例子,你可以这么做:创建 Plugin config,如果这个路由已经配置了 plugins,那么 Plugin config ...
  • Apache APISIX文档-架构设计-Debug Mode 注意:在 APISIX 2.10 之前,开启基本调试模式曾经是设置 conf/config.yaml 中的 apisix.enable_debug 为 true。设置 conf/debug.yaml 中的选项,开启高级调试模式。由于 ...
  • Apache APISIX文档-架构设计-Consumer 如上图所示,作为 API 网关,需要知道 API Consumer(消费方)具体是谁,这样就可以对不同 API Consumer 配置不同规则。授权认证:比如有 [key-auth] 等。获取 consumer_...
  • 近期文章

    更多
    文章目录

      推荐作者

      更多