在 Mac OS 上编译最新版本 Doris
Doris 是基于 MPP 架构的 OLAP 数据库,可以用做企业级的实时数仓。本文主要讲解了如何在 Mac OS 上编译 Doris 源码,一是用于本地的测试环境,二是方便自己了解和学习 Doris 的源码
系统环境:
操作系统:Mac OS 13.5.2
芯片:M2
Java:11,推荐用 11,Java 1.8 亲测编译时会出现堆内存溢出的问题
Python:3.11
1. 下载工程
1 | git clone https://github.com/apache/doris.git |
2. 安装依赖
使用
brew
安装依赖包1
brew install automake autoconf libtool pkg-config texinfo coreutils gnu-getopt cmake ninja ccache bison byacc gettext wget pcre maven llvm@16 npm
如果没有事先安装
Java
和Python
环境,还需要执行下面语句安装1
2
3
4
5
6brew install python@3 openjdk@11
# 设置 Java 11 的软链接
sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk ~/Library/Java/JavaVirtualMachines/openjdk-11.jdk
# 在当前会话中启用 Java 11
export JAVA_HOME="~/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home"安装第三方依赖
1
2
3
4
5
6
7
8
9
10cd thirdparty
rm -rf installed
# 下载依赖
curl -L https://github.com/apache/doris-thirdparty/releases/download/automation/doris-thirdparty-prebuilt-darwin-arm64.tar.xz -o - | tar -Jxf -
# 保证protoc和thrift能够正常运行
cd installed/bin
./protoc --version
./thrift --version
# 回到 doris 根目录
cd ../../../
3. 编译
编译时间比较长,需要耐心等待
1 | bash build.sh |
4. 启动服务
设置
file descriptors
1
echo 'ulimit -n 65536' >> ~/.zshrc
使配置生效,并检查输出是否为
65536
1
2source ~/.zshrc
ulimit -n启动
BE
1
2cd output/be
bin/start_be.sh --daemon如果出现
bin/start_be.sh: line 86: swapon: command not found
的报错,可以不用管,BE
进程也会正常启动启动
FE
1
2cd ../fe
bin/start_fe.sh --daemon检查
BE
,FE
进程是否正常启动1
jps
如果输出包含
DorisBE
和DorisFE
进程,说明启动成功将
BE
节点添加到集群,如果本地没有MySQL
客户端,需要先安装brew install mysql
1
2
3
4
5
6
7mysql -h127.0.0.1 -P9030 -uroot -p
mysql> alter system add backend "127.0.0.1:9050";
检查 be 和 fe 节点,如果两者的 Alive 字段均为 true,说明两个节点都能正常工作
mysql> show frontends;
mysql> show backends;
5. 参考
- 官方文档:https://doris.apache.org/zh-CN/docs/dev/install/source-install/compilation-mac