Ambari 3.0.0 + BigTop 3.3.0 源码编译与集群部署指南(Kylin V10 / aarch64)
环境说明
- 操作系统:Kylin V10 SP3(aarch64 / ARM64 架构)
- 集群规模:5 节点测试环境,完全内网隔离
- 组件版本:BigTop 3.3.0 + Ambari 3.0.0
- 网络限制:内网无互联网,需提前在外网环境下载所有依赖
一、版本矩阵
| 组件 | 版本 | 说明 |
|---|---|---|
| Ambari Server/Agent | 3.0.0 | 首个使用 BigTop 作为默认 Stack 的版本 |
| BigTop | 3.3.0 | 大数据组件打包框架 |
| Hadoop | 3.3.6 | HDFS + YARN |
| HBase | 2.4.17 | |
| Hive | 3.1.3 | |
| Spark | 3.3.4 | |
| Flink | 1.16.2 | |
| Kafka | 2.8.2 | |
| ZooKeeper | 3.7.2 | |
| Ranger | 2.4.0 | |
| Tez | 0.10.2 | |
| Zeppelin | 0.11.0 |
二、节点规划
| 主机名 | IP 地址 | 角色 | CPU | 内存 | 磁盘 |
|---|---|---|---|---|---|
| ambari | 10.0.0.10 | ambari-server、ambari-agent、PostgreSQL、Nginx(本地仓库) | 4C | 8G | 200G |
| hadoop01 | 10.0.0.11 | ambari-agent、NameNode、ResourceManager | 4C | 8G | 200G |
| hadoop02 | 10.0.0.12 | ambari-agent、SecondaryNameNode、DataNode | 4C | 8G | 200G |
| hadoop03 | 10.0.0.13 | ambari-agent、DataNode、NodeManager | 4C | 8G | 200G |
| hadoop04 | 10.0.0.14 | ambari-agent、DataNode、NodeManager | 4C | 8G | 200G |
注意:IP 地址请根据实际网络环境修改。
三、重要前置说明
3.1 ARM64 架构兼容性
Apache Ambari 官方仅支持 x86_64 架构,源码中包含 x86 特定的原生二进制文件。在 ARM64(aarch64)上部署需要以下适配:
- Ambari Agent 的部分 Python 检测脚本需要修改(识别 Kylin V10 为 CentOS 7)
- BigTop 3.3.0 官方支持 aarch64,可在 ARM 上原生编译
- Ambari Server(Java 应用)本身可跨架构运行,问题主要在 Agent 端
3.2 Kylin V10 与 CentOS 7 的关系
Kylin V10 SP3 基于 CentOS 7 内核(kernel 4.19,glibc 2.28),yum 源兼容 CentOS 7 的 RPM 包。但需要特别注意:
- Kylin V10 的 yum 源中缺少 bigtop-select 安装包,需要自行编译或跳过
- 时区需手动设置为
Asia/Shanghai,否则编译 Tez 时会因时间校验失败 - Python 版本为 2.7.18,Ambari 3.0.0 需要 Python 3.6+
3.3 Kylin V10 操作系统兼容性配置
Ambari 安装时会检测操作系统类型,Kylin V10 不被识别,需要创建 CentOS 兼容文件:
# 在所有节点执行(ambari-server 和 ambari-agent 节点)
# 创建 CentOS 兼容文件
echo "CentOS Linux release 7.9.2009 (Core)" > /etc/centos-release
echo "CentOS Linux release 7.9.2009 (Core)" > /etc/redhat-release
# 创建 os-release 兼容文件(备份原文件)
cp /etc/os-release /etc/os-release.bak
cat > /etc/os-release << 'EOF'
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
EOF
说明:
- 此配置解决 “Ambari repo file path not set for current OS” 错误
- 解决
_posixsubprocess模块警告(ARM64 架构已知问题,不影响使用) - 配置后 Ambari 可以正常识别操作系统并完成安装
四、外网环境准备(编译机)
所有源码编译工作在一台有外网访问权限的 Kylin V10 ARM 机器上完成,
编译产物(RPM 包)通过离线方式传输到内网环境。
4.1 编译机基础环境
# 确认系统信息
cat /etc/os-release
uname -m # 应输出 aarch64
python --version # Python 2.7.18
4.2 安装基础依赖
# 安装开发工具组
yum -y groupinstall "Development Tools"
yum -y groupinstall "Compatibility Libraries"
# 安装必要工具
yum -y install wget curl git vim lrzsz tree net-tools \
bind-utils telnet lsof ntpdate rpm-build createrepo \
gcc gcc-c++ make cmake autoconf automake libtool \
openssl-devel bzip2-devel libffi-devel zlib-devel \
readline-devel sqlite-devel xz-devel \
fuse-devel lzo-devel snappy-devel
# Kylin V10 特有依赖(必须安装)
yum -y install kylin-rpm-config
4.3 关闭防火墙和 SELinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
4.4 系统参数配置
# limits 配置
cat >> /etc/security/limits.conf << 'EOF'
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
EOF
# 时区设置
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock -w
# 关闭 THP
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
# 关闭 swap
swapoff -a
sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
五、编译环境安装
5.1 安装 JDK
# Ambari 3.0.0 需要 JDK 11+,BigTop 编译需要 JDK 8
yum -y install java-1.8.0-openjdk-devel
yum -y install java-11-openjdk-devel
# 设置 JAVA_HOME(默认使用 JDK 8 编译 BigTop)
cat >> /etc/profile << 'EOF'
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export PATH=$JAVA_HOME/bin:$PATH
EOF
source /etc/profile
# 验证
java -version
5.2 安装 Maven
cd /opt
# Maven 3.9.9 下载地址(Apache 归档站,旧版本国内镜像不保留)
wget https://archive.apache.org/dist/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz
tar -zxf apache-maven-3.9.9-bin.tar.gz
# 配置环境变量
cat >> /etc/profile << 'EOF'
export MAVEN_HOME=/opt/apache-maven-3.9.9
export PATH=$MAVEN_HOME/bin:$PATH
EOF
source /etc/profile
# 验证
mvn -v
5.3 配置 Maven 国内镜像
cat > /opt/apache-maven-3.9.9/conf/settings.xml << 'XMLEOF'
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<localRepository>/opt/maven-repo</localRepository>
<mirrors>
<mirror>
<id>aliyunmaven</id>
<name>Aliyun Maven</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>aliyun-spring</id>
<name>Aliyun Spring</name>
<url>https://maven.aliyun.com/repository/spring</url>
<mirrorOf>spring-milestones,spring-snapshots</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>default</id>
<repositories>
<repository>
<id>central</id>
<url>https://maven.aliyun.com/repository/central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>hortonworks</id>
<url>https://repo.hortonworks.com/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
</settings>
XMLEOF
5.4 安装 Node.js(Ambari 前端编译需要)
Kylin V10 修改了
/etc/os-release后,NodeSource 官方安装脚本可能无法正确识别系统类型。建议直接配置 Yum 源安装。
# 方式一:直接配置 NodeSource CentOS 7 Yum 源(推荐,最可靠)
cat > /etc/yum.repos.d/nodesource.repo << 'EOF'
[nodesource]
name=NodeSource
baseurl=https://rpm.nodesource.com/pub_16.x/el/7/$basearch
enabled=1
gpgcheck=1
gpgkey=https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL
EOF
yum -y install nodejs
# 方式二:官方安装脚本(如果方式一失败可尝试)
# curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -
# yum -y install nodejs
# 配置 npm 国内源
npm config set registry https://registry.npmmirror.com
# 验证
node -v # v16.x
npm -v
5.5 安装 Puppet(BigTop 编译需要)
Kylin V10 默认 Yum 源不包含
puppet-agent,需要先添加 PuppetLabs 官方仓库。最可靠的方式是使用 BigTop 自带的puppetize.sh脚本。
# 方式一:通过 BigTop 自带的 puppetize.sh(推荐,自动处理所有依赖)
cd /data/bigtop/bigtop-3.3.0
bash bigtop_toolchain/bin/puppetize.sh
# 方式二:手动添加 PuppetLabs 仓库再安装(如果方式一失败)
rpm -Uvh https://yum.puppet.com/puppet7-release-el-7.noarch.rpm
yum install -y puppet-agent
ln -sf /opt/puppetlabs/bin/puppet /usr/bin/puppet
# 必须安装 stdlib 模块(避免 'Unknown function: concat' 错误)
# 注意:必须安装到 BigTop 源码目录内,因为 gradlew toolchain 使用自己的 --modulepath
# 仅执行 `puppet module install puppetlabs-stdlib`(默认路径)是不够的
puppet module install puppetlabs-stdlib --modulepath /data/bigtop/bigtop-3.3.0
# 验证
puppet config print modulepath
puppet module list
六、下载源码
6.1 下载 BigTop 3.3.0 源码
重要说明:BigTop 3.3.0 已不是最新版本。Apache 主镜像站和国内镜像只保留最新版(当前 3.5.0),
archive.apache.org归档站国内访问不稳定。推荐使用 GitHub 方式获取源码。
mkdir -p /data/bigtop && cd /data/bigtop
# 唯一推荐方式:从 GitHub 克隆(国内可正常访问)
git clone https://github.com/apache/bigtop.git
cd bigtop
# 切换到 3.3.0 版本的分支(注意:不是 tag,是 branch-3.3)
git checkout branch-3.3
# 备选:如果能访问 archive.apache.org 且上述方式失败
# wget https://archive.apache.org/dist/bigtop/bigtop-3.3.0/bigtop-3.3.0-project.tar.gz
# 该 URL 来自官方下载页面,但国内访问可能超时或不存在,请优先用 GitHub
6.2 下载 Ambari 3.0.0 源码
mkdir -p /data/ambari && cd /data/ambari
# 从 Apache 下载站下载(国内可访问)
wget https://dlcdn.apache.org/ambari/ambari-3.0.0/apache-ambari-3.0.0-src.tar.gz
# 解压
tar -zxf apache-ambari-3.0.0-src.tar.gz
七、编译 BigTop 3.3.0 RPM 包
编译方式选择
- 方法一(推荐):使用官方 Docker 镜像编译,环境隔离,不污染宿主机,适合快速验证
- 方法二:在服务器直接编译,适合定制化需求或无 Docker 环境
方法一:官方 Docker 镜像编译(推荐)
优势:环境隔离、无需手动安装依赖、编译产物与官方一致
前提:服务器需安装 Docker,且能拉取bigtop/slaves镜像
7.1.1 拉取官方编译镜像
# 从 Docker Hub 拉取官方编译镜像(CentOS 7 + aarch64)
# 注意:国内网络可能需要配置镜像加速器
docker pull bigtop/slaves:3.3.0-centos-7
# 如果拉取失败,可尝试以下方案:
# 方案1:配置国内镜像加速器(2026年4月实测可用)
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://docker.xuanyuan.me",
"https://docker.1ms.run",
"https://docker.m.daocloud.io",
"https://ccr.ccs.tencentyun.com"
]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
# 验证镜像加速器配置
docker info | grep -A 5 "Registry Mirrors"
# 重新拉取镜像
docker pull bigtop/slaves:3.3.0-centos-7-aarch64
# 方案2:在有外网的机器上导出镜像,离线导入(最可靠)
# 外网机器执行:
docker pull bigtop/slaves:3.3.0-centos-7-aarch64
docker save bigtop/slaves:3.3.0-centos-7-aarch64 -o bigtop-slaves-3.3.0-aarch64.tar
# 传输到内网机器后执行:
docker load -i bigtop-slaves-3.3.0-aarch64.tar
7.1.2 准备源码和 Maven 缓存目录
# 创建 Maven 缓存目录(避免重复下载依赖)
mkdir -p /root/.m2/repository
# 从 GitHub 克隆源码(推荐,国内可访问)
cd /data/bigtop
git clone https://github.com/apache/bigtop.git
cd bigtop
git checkout branch-3.3
# 备选:如果能访问 archive.apache.org
# cd /data/bigtop
# wget https://archive.apache.org/dist/bigtop/bigtop-3.3.0/bigtop-3.3.0-project.tar.gz
# tar -zxf bigtop-3.3.0-project.tar.gz
# cd bigtop-3.3.0
7.1.3 配置 Maven 国内镜像(容器内)
# 创建 Maven 配置文件
cat > /data/bigtop/maven-settings.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<mirrors>
<mirror>
<id>aliyunmaven</id>
<name>Aliyun Maven</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>aliyun-apache</id>
<name>Aliyun Apache</name>
<url>https://maven.aliyun.com/repository/apache-snapshots</url>
<mirrorOf>apache snapshots</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>default</id>
<repositories>
<repository>
<id>central</id>
<url>https://maven.aliyun.com/repository/central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>apache-snapshots</id>
<url>https://maven.aliyun.com/repository/apache-snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
</settings>
EOF
7.1.4 启动编译容器并执行编译
# 启动编译容器(映射源码、Maven 缓存、Maven 配置)
cd /data/bigtop/bigtop-3.3.0
docker run -d -it --name bigtop-build \
--network host \
-v $(pwd):/ws \
-v /root/.m2/repository:/root/.m2/repository \
-v /data/bigtop/maven-settings.xml:/root/.m2/settings.xml \
--workdir /ws \
bigtop/slaves:3.3.0-centos-7-aarch64 \
sleep infinity
# 进入容器
docker exec -it bigtop-build bash
# ========== 容器内执行以下命令 ==========
# 1. 配置时区(重要,否则 Tez 编译会失败)
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock -w
# 环境变量生效
source /etc/profile.d/bigtop.sh
# 2. Bower 修复(解决 hadoop-yarn-ui 前端编译失败)
git config --global url."https://github.com/".insteadOf git://github.com/
mkdir -p /root
cat > /root/.bowerrc << 'BOWEREOF'
{
"allow_root": true,
"registry": "https://bower.io"
}
BOWEREOF
# 3. 安装编译工具链(容器内已有大部分依赖,只需安装 toolchain)
./gradlew toolchain
# 4. 按依赖顺序编译各组件
# 关键参数:-PparentDir=/usr/bigtop(安装路径) -PpkgSuffix(包名加版本后缀,如 hadoop_3_3_0) -PbuildThreads=2C(线程数)
# 基础组件(无需 pkgSuffix)
./gradlew bigtop-utils-pkg -PparentDir=/usr/bigtop -PbuildThreads=2C
./gradlew bigtop-groovy-pkg -PparentDir=/usr/bigtop -PbuildThreads=2C
./gradlew bigtop-jsvc-pkg -PparentDir=/usr/bigtop -PbuildThreads=
5042



&spm=1001.2101.3001.12003&articleId=161919549&d=1&t=3&u=d0ea01c62e78490686ea8af880609a23)

被折叠的 条评论
为什么被折叠?



