TT Bigdata TT Bigdata
首页
  • 部署专题

    • 常规安装
    • 一键部署
  • 组件安装

    • 常规&高可用
  • 版本专题

    • 更新说明
  • Ambari-Env

    • 环境准备
    • 开始使用
  • 组件编译

    • 专区—Ambari
    • 专区—Bigtop-官方组件
    • 专区—Bigtop-扩展组件
  • 报错解决

    • 专区—Ambari
    • 专区—Bigtop
  • 其他技巧

    • Maven镜像加速
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL快速安装
    • Temurin JDK 23快速安装
  • 成神之路

    • 专区—Ambari
    • 专区—Bigtop
  • 集成案例

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 核心代码

    • 各组件代码
    • 通用代码模板
  • 国产化&其他系统

    • Rocky系列
    • Ubuntu系列
  • 生产调优

    • 组件调优指南
    • 1v1指导调优
  • 支持&共建

    • 蓝图愿景
    • 技术支持
    • 合作共建
登陆
GitHub (opens new window)

JaneTTR

数据酿造智慧,每一滴都是沉淀!
首页
  • 部署专题

    • 常规安装
    • 一键部署
  • 组件安装

    • 常规&高可用
  • 版本专题

    • 更新说明
  • Ambari-Env

    • 环境准备
    • 开始使用
  • 组件编译

    • 专区—Ambari
    • 专区—Bigtop-官方组件
    • 专区—Bigtop-扩展组件
  • 报错解决

    • 专区—Ambari
    • 专区—Bigtop
  • 其他技巧

    • Maven镜像加速
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL快速安装
    • Temurin JDK 23快速安装
  • 成神之路

    • 专区—Ambari
    • 专区—Bigtop
  • 集成案例

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 核心代码

    • 各组件代码
    • 通用代码模板
  • 国产化&其他系统

    • Rocky系列
    • Ubuntu系列
  • 生产调优

    • 组件调优指南
    • 1v1指导调优
  • 支持&共建

    • 蓝图愿景
    • 技术支持
    • 合作共建
登陆
GitHub (opens new window)
  • 方法论

  • 代码生命周期-metainfo

    • 加载原理深度剖析[一]
    • 加载原理深度剖析[二]
    • 加载原理深度剖析[三]
    • 结构与层级深入解读
      • Redis 集群 metainfo.xml 示例
      • metainfo.xml 属性释义
        • 1. StackInfo 🏗️
        • 2. ServiceInfo 🔧
        • 3. ComponentInfo 🧩
        • 4. QuickLinksConfigurationInfo 🔗
        • 5. ThemeInfo 🎨
        • 6. ConfigurationInfo ⚙️
        • 7. ExtensionInfo 📦
        • 层次结构总结 ✨
    • configFile详解[一]
    • configFile详解[二]
    • cardinality详解[一]
    • cardinality详解[二]
    • cardinality详解[三]
    • category详解[一]
    • category详解[二]
    • category详解[三]
    • theme详解[一]
    • theme详解[二]
    • theme详解[三]
    • commandScript详解[二]
    • commandScript详解[一]
    • commandScript详解[三]
    • customCommand详解[一]
    • customCommand详解[二]
    • customCommand详解[三]
    • requiredServices详解[一]
    • requiredServices详解[二]
    • osSpecifics详解[一]
    • osSpecifics详解[二]
    • osSpecifics详解[三]
    • quicklinks详解[一]
    • quicklinks详解[二]
    • quicklinks详解[三]
    • quicklinks详解[四]
    • versionAdvertised详解
  • 架构剖析

  • UI样式

  • GOD-Ambari
  • 代码生命周期-metainfo
JaneTTR
2025-05-31
目录

结构与层级深入解读

# Redis 集群 metainfo.xml 示例

<?xml version="1.0"?>
<metainfo>
    <schemaVersion>2.0</schemaVersion>
    <services>
        <service>
            <!-- Redis 集群服务的基本信息 -->
            <name>REDIS</name>
            <displayName>Redis</displayName>
            <comment>
                Component Redis Power By JaneTTR . mail: 3832514048@qq.com ,git: https://gitee.com/tt-bigdata/ambari-env
            </comment>
            <version>7.4.0</version>

            <!-- Redis 集群组件定义 -->
            <components>
                <!-- Redis 主节点组件 -->
                <component>
                    <name>REDIS_MASTER</name>
                    <displayName>Redis Master</displayName>
                    <category>MASTER</category>
                    <cardinality>3+</cardinality> <!-- Redis 集群至少需要 3 个主节点 -->
                    <versionAdvertised>true</versionAdvertised>
                    <commandScript>
                        <script>scripts/redis_master.py</script> <!-- Python 脚本 -->
                        <scriptType>PYTHON</scriptType>
                    </commandScript>
                    <configFiles>
                        <configFile>
                            <type>env</type>
                            <fileName>redis-site.xml</fileName>
                            <dictionaryName>redis-site</dictionaryName>
                        </configFile>
                        <configFile>
                            <type>env</type>
                            <fileName>redis-env.sh</fileName>
                            <dictionaryName>redis-env</dictionaryName>
                        </configFile>
                    </configFiles>
                </component>

                <!-- Redis 从节点组件 -->
                <component>
                    <name>REDIS_SLAVE</name>
                    <displayName>Redis Slave</displayName>
                    <category>SLAVE</category>
                    <cardinality>3+</cardinality> <!-- 从节点可以是 0 或多个 -->
                    <versionAdvertised>true</versionAdvertised>
                    <commandScript>
                        <script>scripts/redis_slave.py</script> <!-- Python 脚本 -->
                        <scriptType>PYTHON</scriptType>
                    </commandScript>
                    <configFiles>
                        <configFile>
                            <type>env</type>
                            <fileName>redis-site.xml</fileName>
                            <dictionaryName>redis-site</dictionaryName>
                        </configFile>
                        <configFile>
                            <type>env</type>
                            <fileName>redis-env.sh</fileName>
                            <dictionaryName>redis-env</dictionaryName>
                        </configFile>
                    </configFiles>
                </component>

                <!-- Redis 客户端组件 -->
                <component>
                    <name>REDIS_CLIENT</name>
                    <displayName>Redis Client</displayName>
                    <category>CLIENT</category>
                    <cardinality>0+</cardinality> <!-- 客户端是可选的,可以部署多个 -->
                    <versionAdvertised>true</versionAdvertised>
                    <commandScript>
                        <script>scripts/redis_client.py</script> <!-- Python 脚本 -->
                        <scriptType>PYTHON</scriptType>
                    </commandScript>
                </component>
            </components>

            <!-- 操作系统相关 -->
            <osSpecifics>
                <osSpecific>
                    <osFamily>any</osFamily> <!-- 支持任何操作系统 -->
                    <packages>
                        <package>
                            <name>redis_${stack_version}</name>
                        </package>
                    </packages>
                </osSpecific>
            </osSpecifics>

            <!-- Redis 服务健康检查 -->
            <commandScript>
                <script>scripts/service_check.py</script> <!-- 健康检查 Python 脚本 -->
                <scriptType>PYTHON</scriptType>
                <timeout>300</timeout>
            </commandScript>

            <!-- Redis 服务不依赖其他服务 -->
            <!-- 如果有其他依赖项,可以在这里定义 -->

            <!-- 配置依赖 -->
            <configuration-dependencies>
                <config-type>redis-site</config-type>
                <config-type>redis-env</config-type>
            </configuration-dependencies>
        </service>
    </services>
</metainfo>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

在该 metainfo.xml 文件中,定义了 Redis 集群的三个核心组件:Redis Master、Redis Slave 以及 Redis Client。它们均由 Python 脚本进行服务管理与生命周期控制。实战推荐 组件定义和配置标准完全兼容 Ambari Stack 管理体系。

# metainfo.xml 属性释义

# 1. StackInfo 🏗️

StackInfo 说明

StackInfo 作为顶层结构,统领整个 stack 的核心定义,包括服务、扩展、JDK 版本与全局属性等。常见的 JDK 限定、服务集合、属性等均在此配置。

属性名 说明 类型 示例值 备注
minJdk 最小JDK版本 String 1.8 JDK最低要求
maxJdk 最大JDK版本 String 11 JDK最高要求
name Stack名称 String HDP 唯一标识
version Stack版本 String 2.7.3 Stack版本号
repositories 存储库列表 List<RepositoryInfo> - Stack仓库配置
services 服务集合 Collection<ServiceInfo> HDFS, YARN Stack中全部服务

补充属性说明:

  • properties List<PropertyInfo> Stack级别全局属性集合,用于声明平台级参数。

  • upgradePacks Map<String, UpgradePack> Stack升级包定义,控制服务升级路径和行为。

  • roleCommandOrder StackRoleCommandOrder 定义服务启动/停止时各角色的命令执行顺序。

# 2. ServiceInfo 🔧

ServiceInfo 说明

每个服务都由 ServiceInfo 定义。例如 Redis 服务。一个服务包含多个组件,并可配置健康检查脚本、依赖关系等。

属性名 说明 类型 示例值 我的配置值
name 服务名称 String HDFS Redis
displayName 展示名称 String Hadoop Distributed... Redis
version 服务版本 String 2.7.3 7.4.0
components 组件集合 List<ComponentInfo> - REDIS_MASTER, REDIS_SLAVE
requiredServices 依赖服务 List HDFS -
commandScript 健康检查脚本 Object - scripts/service_check.py

# 3. ComponentInfo 🧩

提示

ComponentInfo 描述每个服务下的具体组件(如 Redis Master/Slave),支持独立配置启动脚本与配置文件。

属性名 说明 类型 示例值 我的配置值
name 组件名称 String NAMENODE REDIS_MASTER, REDIS_SLAVE
displayName 展示名称 String HDFS NameNode Redis Master, Redis Slave
category 组件类别 String MASTER MASTER, SLAVE, CLIENT
commandScript 命令脚本 Object - scripts/redis_master.py
configFiles 配置文件集合 List - redis-site.xml 等

# 4. QuickLinksConfigurationInfo 🔗

笔记

定义服务 Web UI 等快捷入口,可通过 quicklinks.json 扩展。

属性名 说明 类型 示例值 我的配置值
fileName 配置文件名 String quicklinks.json quicklinks.json
isDefault 是否默认 Boolean true true

# 5. ThemeInfo 🎨

主题样式可定制服务前端风格。UI扩展

属性名 说明 类型 示例值 我的配置值
fileName 主题文件名 String theme.json theme.json
themeMap 主题映射 Map<String, Theme> - -
defaultThemeName 默认主题名 String default default

# 6. ConfigurationInfo ⚙️

注意

配置文件属性说明,不同组件或服务可独立定义,便于灵活扩展。

属性名 说明 类型 示例值 我的配置值
propertiesAttributes 属性映射 Map<String, Map<String, String>> - -
version 配置版本 String 1.0 1.0
serviceName 服务名称 String HDFS Redis
properties 配置属性 Map<String, String> - -

# 7. ExtensionInfo 📦

警告

扩展定义(ExtensionInfo)主要用于支持父扩展、堆栈关联和自动链接等高级场景,便于自定义 stack 升级与横向拓展。

属性名 说明 类型 示例值 我的配置值
version 扩展版本 String 1.0 1.0
parentExtensionVersion 父扩展版本 String HDP-2.0 -
name 扩展名称 String CustomExtension CustomExtension
stacks 堆栈列表 List<ExtensionMetainfoXml.Stack> - -
extensions 扩展列表 List<ExtensionMetainfoXml.Extension> - -
autoLink 是否自动链接 Boolean true -
active 是否激活 Boolean true -

# 层次结构总结 ✨

  • StackInfo 下辖多个 ServiceInfo 与 ExtensionInfo,并定义全局 JDK、属性等基础配置。
  • 每个 ServiceInfo 可以包含多个 ComponentInfo,以及配置文件、健康检查、UI 扩展等属性。
  • ComponentInfo 负责具体组件的描述(如 Redis Master/Slave)。
  • QuickLinksConfigurationInfo、ThemeInfo、ConfigurationInfo 提供快捷入口、UI 主题和详细属性扩展。
  • ExtensionInfo 实现 stack 的灵活拓展和自定义关联。

提示

如需参考更多 stack、service 或 component 元素的官方/社区案例,建议查阅 Ambari 官方文档或本站其他大数据组件 metainfo.xml 实践文章。

#Redis#Ambari#metainfo.xml#服务编排
加载原理深度剖析[三]
configFile详解[一]

← 加载原理深度剖析[三] configFile详解[一]→

最近更新
01
bigtop-select 打包缺 compat 报错修复 deb
07-16
02
bigtop-select 打包缺 control 文件报错修复 deb
07-16
03
首次编译-环境初始化 必装
07-16
更多文章>
Theme by Vdoing | Copyright © 2017-2025 JaneTTR | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式