04.Ambari自定义服务开发-自定义服务配置文件在Ambari中的设置方法

文章目录

    • 设置方法
    • 配置文件设置Custom xxx
    • 配置文件详细的配置方法
      • `.xml`文件的整体格式
      • 基础参数格式
      • value-attributes配置介绍
        • 设置属性在服务安装后不可修改
        • 设置允许字段为空
        • 是否显示配置名称
        • 参数类型设置
          • 字符串类型
          • Password
          • Boolean
          • Int
          • Float
          • Directory
          • Directories
          • Content-多行文本
          • user-自动创建用户和用户组

官网说明: https://cwiki.apache.org/confluence/display/AMBARI/Configuration+support+in+Ambari

设置方法

服务需要配置的参数统一都是由.xml格式文件进行配置,默认会读取configuration/目录下的.xml文件。可以通过配置metainfo.xml中的<configuration-dir></configuration-dir>参数修改读取的目录。

configuration/目录下的.xml文件,都会在WebUI显示,如下图所示:

image-20240221113520974

image-20240221133508787

配置文件设置Custom xxx

默认配置文件在WebUI可以配置两种,一种是我们在.xml文件中指定的配置对应Advanced xxx,另外一种是自定义配置对应上面页面中Custom xxx,自定义配置主要应对我们没有提前设置的参数,可以自定义补充。可以通过在.xml文件中参数supports_adding_forbidden="true"来控制是否需要Custom xxx,设置为false或者不添加该参数是需要Custom xxx

配置方法

<configuration supports_adding_forbidden="true">
  ...
</configuration>

详细配置Custom xxx的方法见05.Ambari自定义服务开发-自定义服务配置文件生成

配置文件详细的配置方法

.xml文件的整体格式

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
....
</configuration>

<configuration>下可以设置我们需要配置的具体配置参数了

基础参数格式

<property>
        <name>doris_pid_dir</name>
        <display-name>Doris pid directory</display-name>
        <value>/var/run/doris</value>
        <description>Doris pid directory</description>
</property>

说明:

  • name:属性名称
  • display-name:WebUI中显示的属性名称,如未设置display-name,前端页面显示name值
  • value:属性具体值,在WebUI中显示的值,可修改
  • description:描述信息,在WebUI中显示。

在页面中如下图所示

image-20240221140348478

value-attributes配置介绍

参考:https://blog.csdn.net/qq_44226094/article/details/130210270

用于设置参数的类型、是否为空等等

样例

<!-- 这里规定了属性值的类型为int,最小值为0,最大值为48000 -->
<value-attributes>
  <!-- 值类型
    boolean/ int/ float/ directory/ directories/ content/
    value-list/ user/ password -->
  <type>int</type>

  <!--是否可复写 true/ false -->
  <overridable>true</overridable>
  <!-- 空值是否有效 true/ false -->
  <empty-value-valid>true</empty-value-valid>
  <!-- property是否 ui true/ false -->
  <ui-only-property>true</ui-only-property>
  <!-- 不可编辑 true / false -->
  <read-only>true</read-only>
  <!--值是否在安装时可编辑 true/ false -->
  <editable-only-at-install></editable-only-at-install>
  <!-- property 显示值 true/ false -->
  <show-property-name></show-property-name>
  <!-- 步长 -->
  <increment-step>100</increment-step>
  <!-- 可选值 -->
  <selection-cardinality>2+</selection-cardinality>
  <!-- property 文件名 -->
  <property-file-name></property-file-name>
  <!-- property文件类型 -->
  <property-file-type></property-file-type>
  <!-- 条目 -->
  <entries>
    <entry>
      <value>2</value>
    </entry>
    <!-- ... -->
  </entries>
  <!-- 隐藏 -->
  <hidden></hidden>
  <!--条目是否可编辑 true/ false -->
  <entries-editable></entries-editable>
  <!-- 用户组 -->
  <user-groups></user-groups>
  <!-- 密钥库是否启用 true/ false -->
  <keystore></keystore>
  <!-- 最小值 -->
  <minimum>0</minimum>
  <!-- 最大值 -->
  <maximum>48000</maximum>
  <!-- 值单位 B/ MB/ ms/ Bytes/ milliseconds -->
  <unit></unit>
  <!--可见  -->
  <visible></visible>
  <!-- 复制 -->
  <copy></copy>
</value-attributes>
设置属性在服务安装后不可修改

<property>标签内添加:

<value-attributes>
  <editable-only-at-install>true</editable-only-at-install>
</value-attributes>

使用样例

<property>
        <name>test_editable-only-at-install</name>
        <display-name>测试服务安装后不可编辑</display-name>
        <value>123456</value>
        <description>测试服务安装后不可编辑描述</description>
        <value-attributes>
            <editable-only-at-install>true</editable-only-at-install>
        </value-attributes>
</property>

效果

image-20240221150628545

设置允许字段为空

<property>标签内添加:

<value-attributes>
  <empty-value-valid>true</empty-value-valid>
</value-attributes>

使用样例

    <property>
        <name>test_empty-value-valid</name>
        <display-name>测试字段允许为空</display-name>
        <value>123456</value>
        <description>测试字段允许为空描述</description>
        <value-attributes>
            <empty-value-valid>true</empty-value-valid>
        </value-attributes>
    </property>

tip:

  1. empty-value-valid参数为true代表可以为空,不设置或者为false是不能为空

  2. 如果不设置<empty-value-valid>true</empty-value-valid>参数,不填写内容,会提示需要填写

效果

image-20240221150726144

是否显示配置名称

<property>标签内添加:

<value-attributes>
    <!-- 默认为input输入框,当type为content时,即为文本框 -->
    <type>content</type>
    <!-- 是否显示配置名称 -->
    <show-property-name>false</show-property-name>
</value-attributes>

使用样例

     <property>
        <name>test_show-property-name</name>
        <display-name>测试是否显示配置名称</display-name>
        <value>123456</value>
        <description>测试是否显示配置名称描述</description>
        <value-attributes>
            <!-- 默认为input输入框,当type为content时,即为文本框 -->
            <type>content</type>
            <!-- 是否显示配置名称 -->
            <show-property-name>false</show-property-name>
        </value-attributes>
    </property>

效果

image-20240407163102901

参数类型设置
字符串类型
    <property>
        <name>fe_passwd</name>
        <display-name>Frontend密码</display-name>
        <value>  </value>
        <description>默认无密码,用来添加节点、检查节点连接客户端使用</description>
    </property>
Password
    <property>
        <name>fe_passwd</name>
        <display-name>Frontend密码</display-name>
        <value>  </value>
        <value-attributes>
            <type>password</type>
        </value-attributes>
        <description>默认无密码,用来添加节点、检查节点连接客户端使用</description>
    </property>

样例

image-20240407163809249

Boolean
    <property>
        <name>test_type_boolean</name>
        <display-name>测试类型-boolean</display-name>
        <value></value>
        <value-attributes>
            <type>boolean</type>
        </value-attributes>
    </property>

样例

image-20240221151106088

Int
    <property>
        <name>test_type_int</name>
        <display-name>测试类型-int</display-name>
        <value></value>
        <value-attributes>
            <type>int</type>
        </value-attributes>
    </property>

样例

image-20240221151154850

Float
    <property>
        <name>test_type_float</name>
        <display-name>测试类型-float</display-name>
        <value></value>
        <value-attributes>
            <type>float</type>
        </value-attributes>
    </property>

样例

image-20240221151240720

Directory

填写目录格式数据,非目录格式无法填写

    <property>
        <name>test_type_directory</name>
        <display-name>测试类型-directory</display-name>
        <value></value>
        <value-attributes>
            <type>directory</type>
        </value-attributes>
    </property>

样例

image-20240221151324634

Directories

填写多个目录格式数据,多个目录采用逗号分隔,或者换行分隔,换行分隔保存后会自动转换成逗号分隔

    <property>
        <name>test_type_directories</name>
        <display-name>测试类型-directories</display-name>
        <value></value>
        <value-attributes>
            <type>directories</type>
        </value-attributes>
    </property>

样例

image-20240221151409240

Content-多行文本
    <property>
        <name>test_type_content</name>
        <display-name>测试类型-content</display-name>
        <value></value>
        <value-attributes>
            <type>content</type>
        </value-attributes>
    </property>

样例

image-20240221151452976

user-自动创建用户和用户组

配置后会自动创建用户和用户组,并将用户设置到某个组下,doris-env.xml文件部分内容如下

    <property>
        <name>doris_user</name>
        <display-name>Doris user</display-name>
        <value>doris</value>
        <description>Doris user</description>
        <!--选择配置的属性为用户,设置成用户则会自动创建该用户-->
        <property-type>USER</property-type>
        <value-attributes>
            <type>user</type>
            <overridable>false</overridable>
            <!--设置用户所属用户组-->
            <user-groups>
                <!--设置用户组属于,cluster-env->user_group的配置-->
                <!--读取的配置最终会统一汇总到/var/lib/ambari-agent/data/command-xxx.json这个文件,可以在这里直接查询验证-->
                <property>
                    <type>cluster-env</type>
                    <name>user_group</name>
                </property>
                <!--设置用户组属于,doris-env->doris_group的配置,这里doris-env就是当前文件的配置-->
                <property>
                    <type>doris-env</type>
                    <name>doris_group</name>
                </property>
            </user-groups>
        </value-attributes>
    </property>

    <property>
        <!--创建用户组,组名为doris_group-->
        <name>doris_group</name>
        <display-name>doris User Group</display-name>
        <value>doris_group</value>
        <property-type>GROUP</property-type>
        <description>doris user group.</description>
    </property>

上面配置实现了:创建一个名为doris的用户,并将其分配到特定的用户组(doris_grouphadoop

tip:cluster-env->user_group获取到的值就是hadoop

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/759989.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

2024 vue3入门教程:windows系统下部署node环境

一、打开下载的node官网 Node.js — 下载 Node.js 二、根据个人喜好的下载方法&#xff0c;下载到自己的电脑盘符下 三、我用的是方法3下载的压缩包&#xff0c;解压到E盘nodejs目录下&#xff08;看个人&#xff09; 四、配置电脑的环境变量&#xff0c;新建环境变量的时候…

【Flink】Flink SQL

一、Flink 架构 Flink 架构 | Apache Flink 二、设置TaskManager、Slot和Parallelism 在Apache Flink中&#xff0c;设置TaskManager、Slot和Parallelism是配置Flink集群性能和资源利用的关键步骤。以下是关于如何设置这些参数的详细指南&#xff1a; 1. TaskManager 设置 …

【TB作品】智能台灯控制器,ATMEGA128单片机,Proteus仿真

题目 8 &#xff1a;智能台灯控制器 基于单片机设计智能台灯控制器&#xff0c;要求可以调节 LED 灯的亮度&#xff0c;实现定时开启与关闭&#xff0c; 根据光照自动开启与关闭功能。 具体要求如下&#xff1a; &#xff08;1&#xff09;通过 PWM 功能调节 LED 灯亮度&#x…

RabbitMQ-交换机的类型以及流程图练习-01

自己的飞书文档:‌‍‬‍‬‍​‍‬​⁠‍​​​‌⁠​​‬‍​​​‬‬‌​‌‌​​&#xfeff;​​​​&#xfeff;‍​‍​‌&#xfeff;⁠‬&#xfeff;&#xfeff;&#xfeff;​RabbitMQ的流程图和作业 - 飞书云文档 (feishu.cn) 作业 图片一张 画rabbit-mq 消息发…

Java 并发编程常见问题

1、线程状态它们之间是如何扭转的&#xff1f; 1、谈谈对于多线程的理解&#xff1f; 1、对于多核CPU&#xff0c;多线程可以提升CPU的利用率&#xff1b; 2、对于多IO操作的程序&#xff0c;多线程可以提升系统的整体性能及吞吐量&#xff1b; 3、使用多线程在一些场景下可…

前端笔记-day11

文章目录 01-空间-平移02-视距03-空间旋转Z轴04-空间旋转X轴05-空间旋转Y轴06-立体呈现07-案例-3D导航08-空间缩放10-动画实现步骤11-animation复合属性12-animation拆分写法13-案例-走马灯14-案例-精灵动画15-多组动画16-全民出游全民出游.htmlindex.css 01-空间-平移 <!D…

Linux随记(十)

一、升级harbor v2.6.4 --> harbor-offline-installer-v2.11.0-rc3 --> v2.9.4 – 随记 漏洞信息&#xff1a; CVE-2023-20902timing condition in Harbor 2.6.x and below, Harbor 2.7.2 and below, Harbor 2.8.2 and below, and Harbor 1.10.17 and below allows an…

逆变器--学习笔记(一)

并网&#xff1a; 逆变器中的“并网”指的是逆变器将其产生的交流电与电网同步&#xff0c;并输送到公共电网中。并网逆变器通常用于太阳能发电系统和其他分布式发电系统&#xff0c;将其产生的电能输送到电网供其他用户使用。 THD谐波失真总量: 逆变器的THD&#xff08;Tot…

如何玩单机版:QQ音速

前言 我是研究单机的老罗&#xff0c;今天教大家带来一款怀旧游戏QQ音速 的教程。根据我的文章&#xff0c;一步一步就可以玩了。 如今市面上的资源参差不齐&#xff0c;大部分的都不能运行&#xff0c;本人亲自测试&#xff0c;运行视频如下&#xff1a; QQ音速 搭建教程 此…

Node.js全栈指南:静态资源服务器

上一章【认识 MIME 和 HTTP】。 我们认识和了解了 MIME 的概念和作用&#xff0c;也简单地学习了通过浏览器控制台查看请求和返回的用法。 通过对不同的 HTML、CSS、JS 文件进行判断&#xff0c;设置不同的 MIME 值&#xff0c;得以让我们的浏览器正正确地接收和显示不同的文…

还不知道工业以太网和现场总线区别???

工业以太网 工业以太网是一种专为工业环境设计的网络通信技术&#xff0c;它基于标准的以太网技术&#xff0c;但针对工业应用进行了优化。工业以太网能够适应高温、低温、防尘等恶劣工业环境&#xff0c;采用TCP/IP协议&#xff0c;与IEEE 802.3标准兼容&#xff0c;并在应用层…

【C++】string基本用法(常用接口介绍)

文章目录 一、string介绍二、string类对象的创建&#xff08;常见构造&#xff09;三、string类对象的容量操作1.size()和length()2.capacity()3.empty()4.clear()5.reserve()6.resize() 四、string类对象的遍历与访问1.operator[ ]2.正向迭代器begin()和end()3.反向迭代器rbeg…

分治精炼宝库-----快速排序运用(⌯꒪꒫꒪)੭

目录 一.基本概念: 一.颜色分类&#xff1a; 二.排序数组&#xff1a; 三.数组中的第k个最大元素&#xff1a; 解法一&#xff1a;快速选择算法 解法二&#xff1a;简单粗暴优先级队列 四.库存管理Ⅲ&#xff1a; 解法一&#xff1a;快速选择 解法二&#xff1a;简单粗…

linux ls文件排序

linux可以使用ls命令结合一些选项来按照文件大小对文件和目录进行排序。以下是一些常用的方法&#xff1a; 1、这里&#xff0c;-l 选项表示长格式输出&#xff08;包括文件权限、所有者、大小等&#xff09;&#xff0c;-S 选项表示按照文件大小排序&#xff0c;-h 选项表示以…

docker -run hello-world超时

主要原因就是尝试拉取库的时候没有从阿里云镜像里拉&#xff0c;所以设置一下就好了 这里使用的是ubuntu系统&#xff08;命令行下逐行敲就行了&#xff09; sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-EOF {"registry-mirrors": [&quo…

MSPM0G3507——定时器例程讲解4——timx_timer_mode_periodic

以下示例以周期模式配置TimerG并切换LED。周期从500ms开始&#xff0c;每次切换减少50ms&#xff0c;直到周期为100ms&#xff0c;然后重复。设备在等待中断时保持待机模式 #include "ti_msp_dl_config.h"/* ((32KHz / (321)) * 0.5s) 45 - 1 495 due to N1 ticks …

FastGPT 调用Qwen 测试Hello world

Ubuntu 安装Qwen/FastGPT_fastgpt message: core.chat.chat api is error or u-CSDN博客 参考上面文档 安装FastGPT后 登录&#xff0c; 点击右上角的 新建 点击 这里&#xff0c;配置AI使用本地 ollama跑的qwen模型 问题&#xff1a;树上有3只鸟&#xff0c;开了一枪&#…

基于YOLOv9的PCB板缺陷检测

数据集 PCB缺陷检测&#xff0c;我们直接采用北京大学智能机器人开放实验室数据提供的数据集&#xff0c; 共六类缺陷 漏孔、鼠咬、开路、短路、杂散、杂铜 已经对数据进行了数据增强处理&#xff0c;同时按照YOLO格式配置好&#xff0c;数据内容如下 模型训练 ​ 采用YOLO…

Sping源码(九)—— Bean的初始化(非懒加载)— Bean的创建方式(构造器方法)

序言 前面几篇文章介绍了Spring中几种方式下Bean对象的实例化的过程&#xff0c;那如果之前的几种都不满足&#xff0c;按照Spring中正常Bean的实例化步骤&#xff0c;该如何创建这个Bean对象呢&#xff1f; 测试类 我们先创建几个debug中用到的栗子。 Person 以一个平平无…

文章浮现之单细胞VDJ的柱状图

应各位老师的需求复现一篇文章的中的某个图 具体复现图5的整个思路图&#xff0c;这里没有原始数据&#xff0c;所以我使用虚拟生产的metadata进行画图 不废话直接上代码&#xff0c;先上python的代码的结果图 import matplotlib.pyplot as plt import numpy as np# 数据&#…