Llama的使用

本文涉及的产品
云原生网关 MSE Higress,422元/月
任务调度 XXL-JOB 版免费试用,400 元额度,开发版规格
MSE Nacos 企业版免费试用,1600元额度,限量50份
简介:

1. 介绍

Llama (Low Latency Application MAster) 是一个 Yarn 的 Application Master,用于协调 Impala 和 Yarn 之间的集群资源的管理和监控。Llama 使 Impala 能够获取、使用和释放资源配额,而不需要 Impala 使用 Yarn 管理的 container 进程。Llama 提供了 Thrift API 来和 Yarn 交互。

个人理解,Llama 的作用就是使 Impala 能够工作在 YARN 之上,使得 Impala 和 YARN 共享集群资源,提供低延迟的查询。

2. 架构

3. Llama 安装

3.1 安装 llama

Llama 需要安装在装有 Yarn 的节点上。

在 rhel 系统上安装:

$ sudo yum install llama-master
AI 代码解读

3.2 配置

Llama 只能和 Yarn 配合工作,不能用于 MRv1。

Llama 的配置文件在 /etc/llama/conf/ 目录,llama-site.xml 默认配置在 http://cloudera.github.io/llama/llama-site.html

3.3 启动和停止

启动:

$ sudo service llama start
AI 代码解读

停止:

$ sudo service llama stop
AI 代码解读

3.4 配置 HA

Llama 使用 Zookeeper 来实现 HA,任一时刻,只有一个 Llama-master 实例是 active的以确保资源不会被分区。

为了从 Yarn 获取资源,Llama 启动 YARN application 并且运行未管理的ApplicationMaster。当一个 Llama 实例宕掉的时候,分配给该实例启动的 application 的所有资源将会被回首,直到这些 application 超时(默认超时时间为10分钟)。当 Llama 运行失败的时候,这些资源将会被杀掉他启动的application的 Llama 回收。

HA 相关配置参数在 /etc/llama/conf/llama-site.xml:

属性 描述 默认值
llama.am.cluster.id Cluster ID of the Llama pair, used to differentiate between different Llamas llama
llama.am.ha.enabled Whether to enable Llama HA false
llama.am.ha.zk-quorum ZooKeeper quorum to use for leader election and fencing  
llama.am.ha.zk-base Base znode for leader election and fencing data /llama
llama.am.ha.zk-timeout-ms The session timeout, in milliseconds, for connections to ZooKeeper quorum 10000
llama.am.ha.zk-acl ACLs to control access to ZooKeeper world:anyone:rwcda
llama.am.ha.zk-auth Authorization information to go with the ACLs  

上面必填的两个参数为:

  • llama.am.ha.enabled : true
  • llama.am.ha.zk-quorum : cdh1:21088,cdh2:21088

3.5 修改 Impala 启动参数

使用 jdbc 方式提交查询到 Impala 时,会出现 number of running queries 20 is over limit 20 的异常,这时候在 impala的 源代码中搜索关键字 number of running queries,可以找到https://github.com/cloudera/Impala/blob/cdh5-1.4_5.1.2/be/src/scheduling/admission-controller.cc,从源代码中可以看到出现该问题和 Llama 有关系,在找不到 llama 的相关配置时,impala 一个队列中能够接受的最大请求数为 20。代码见:RequestPoolService.java

@VisibleForTesting
  TPoolConfigResult getPoolConfig(String pool) {
    
    TPoolConfigResult result = new TPoolConfigResult();
    int maxMemoryMb = allocationConf_.get().getMaxResources(pool).getMemory();
    result.setMem_limit(
        maxMemoryMb == Integer.MAX_VALUE ? -1 : (long) maxMemoryMb * ByteUnits.MEGABYTE);
    if (llamaConf_ == null) {
    												//llama配置为空
      result.setMax_requests(LLAMA_MAX_PLACED_RESERVATIONS_DEFAULT);
      result.setMax_queued(LLAMA_MAX_QUEUED_RESERVATIONS_DEFAULT);
    } else {
    
      // Capture the current llamaConf_ in case it changes while we're using it.
      Configuration currentLlamaConf = llamaConf_;
      result.setMax_requests(getLlamaPoolConfigValue(currentLlamaConf, pool,
          LLAMA_MAX_PLACED_RESERVATIONS_KEY,
          LLAMA_MAX_PLACED_RESERVATIONS_DEFAULT));  //20
      result.setMax_queued(getLlamaPoolConfigValue(currentLlamaConf, pool,
          LLAMA_MAX_QUEUED_RESERVATIONS_KEY,
          LLAMA_MAX_QUEUED_RESERVATIONS_DEFAULT));
    }
    LOG.trace("getPoolConfig(pool={}): mem_limit={}, max_requests={}, max_queued={}",
        new Object[] {
     pool, result.mem_limit, result.max_requests, result.max_queued });
    return result;
  }
AI 代码解读

目前,参考Admission Control and Query Queuing,在不安装和使用 llama 情况下,找到的一种解决办法是:

修改 impala 启动参数(/etc/default/impala),添加 ` -default_pool_max_requests=-1`,该参数设置每一个队列的最大请求数,如果为-1,则表示不做限制。

4. 使用

4.1 Llama Application Master

4.2 Llama Admin Command Line tool

4.3 Llama Node Manager Auxiliary Service

相关实践学习
基于MSE实现微服务的全链路灰度
通过本场景的实验操作,您将了解并实现在线业务的微服务全链路灰度能力。
目录
打赏
0
0
0
0
176
分享
相关文章
10-23|如何查看linux当前时间
10-23|如何查看linux当前时间
又又又上新啦!魔搭免费模型推理API支持DeepSeek-R1,Qwen2.5-VL,Flux.1 dev及Lora等
又又又上新啦!魔搭免费模型推理API支持DeepSeek-R1,Qwen2.5-VL,Flux.1 dev及Lora等
266 7
更睿智的看世界!实测阿里首个多模态视觉推理模型QVQ-72B-Preview
阿里通义千问Qwen团队于12月25日推出首个开源视觉推理模型QVQ-72B-Preview,该模型在数学、物理、化学等领域表现出色,在MMMU基准测试中得分70.3,超越Qwen2-VL-72B-Instruct。尽管在部分任务如立体图形计数上存在局限性,QVQ-72B-Preview仍展示了强大的视觉理解和推理能力。模型目前仅支持单轮对话和图像输出,不支持视频输入。地址:https://modelscope.cn/studios/Qwen/QVQ-72B-preview
Chroma | AI应用开发
文将详细介绍Chroma向量数据库的功能特点、适应场景,并通过Python实操演示其基本使用方法【7月更文挑战第7天】
648 1
Chroma | AI应用开发
打造领域专属的大语言模型
大模型虽擅长自然语言处理,但在专业领域常表现不足。微调通过利用特定领域的数据,在已有大模型基础上进一步训练,能显著提升模型的专业表现,同时有效控制成本。微调前需确定领域、收集并格式化数据;过程中涉及数据上传、模型训练及状态监控;最后通过验证测试评估效果。此法既经济又高效,特别适合中小型企业及个人用户。
如何根据自己的开发板型号下载和配置交叉编译链
【7月更文挑战第9天】为AMD64 Ubuntu配置ARM64开发板交叉编译环境: 1. 下载适配开发板的GCC,如rk3568用Linaro AArch64。 2. 将GCC置于`downloads`等目录。 3. 解压至`/opt/`,如`tar -xvf gcc-linaro-*.tar.xz -C /opt/`。 4. 编辑`~/.bashrc`添加`/opt/gcc-linaro/*/bin`至PATH。 5. 运行`source ~/.bashrc`激活环境变量。 6. 通过`aarch64-linux-gnu-gcc -v`验证安装。
398 0
支付系统----微信支付19---集成MyBatis-plus,数据库驱动对应的依赖版本设置问题,5没版本没有cj这个依赖,mysql驱动默认的是版本8,这里是一个父类,数据库都有,写个父类,继承就行
支付系统----微信支付19---集成MyBatis-plus,数据库驱动对应的依赖版本设置问题,5没版本没有cj这个依赖,mysql驱动默认的是版本8,这里是一个父类,数据库都有,写个父类,继承就行
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等

登录插画

登录以查看您的控制台资源

管理云资源
状态一览
快捷访问