Llama的使用

简介:

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

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

停止:

$ sudo service llama stop

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;
  }

目前,参考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

目录
相关文章
|
测试技术 Android开发 虚拟化
踩坑记录 | Android 逆向之如何处理 Kali Nat 模式无法上网?
踩坑记录 | Android 逆向之如何处理 Kali Nat 模式无法上网?
617 0
|
机器学习/深度学习 人工智能 自然语言处理
MedicalGPT:基于LLaMA-13B的中英医疗问答模型(LoRA)、实现包括二次预训练、有监督微调、奖励建模
MedicalGPT:基于LLaMA-13B的中英医疗问答模型(LoRA)、实现包括二次预训练、有监督微调、奖励建模
MedicalGPT:基于LLaMA-13B的中英医疗问答模型(LoRA)、实现包括二次预训练、有监督微调、奖励建模
|
Ubuntu Linux Shell
10-23|如何查看linux当前时间
10-23|如何查看linux当前时间
|
9月前
|
人工智能 物联网 API
又又又上新啦!魔搭免费模型推理API支持DeepSeek-R1,Qwen2.5-VL,Flux.1 dev及Lora等
又又又上新啦!魔搭免费模型推理API支持DeepSeek-R1,Qwen2.5-VL,Flux.1 dev及Lora等
554 7
|
11月前
|
安全 测试技术
更睿智的看世界!实测阿里首个多模态视觉推理模型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
|
分布式计算 Hadoop
Hadoop-27 ZooKeeper集群 集群配置启动 3台云服务器 myid集群 zoo.cfg多节点配置 分布式协调框架 Leader Follower Observer
Hadoop-27 ZooKeeper集群 集群配置启动 3台云服务器 myid集群 zoo.cfg多节点配置 分布式协调框架 Leader Follower Observer
269 1
|
分布式计算 资源调度 数据可视化
Hadoop-06-Hadoop集群 历史服务器配置 超详细 执行任务记录 JobHistoryServer MapReduce执行记录 日志聚合结果可视化查看
Hadoop-06-Hadoop集群 历史服务器配置 超详细 执行任务记录 JobHistoryServer MapReduce执行记录 日志聚合结果可视化查看
240 1
|
API 算法框架/工具 异构计算
Python中Keras微调Google Gemma:定制化指令增强大语言模型LLM
Python中Keras微调Google Gemma:定制化指令增强大语言模型LLM
|
XML 关系型数据库 MySQL
支付系统----微信支付19---集成MyBatis-plus,数据库驱动对应的依赖版本设置问题,5没版本没有cj这个依赖,mysql驱动默认的是版本8,这里是一个父类,数据库都有,写个父类,继承就行
支付系统----微信支付19---集成MyBatis-plus,数据库驱动对应的依赖版本设置问题,5没版本没有cj这个依赖,mysql驱动默认的是版本8,这里是一个父类,数据库都有,写个父类,继承就行
|
Ubuntu 编译器 开发工具
如何根据自己的开发板型号下载和配置交叉编译链
【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`验证安装。
698 0