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.idCluster ID of the Llama pair, used to differentiate between different Llamasllama
llama.am.ha.enabledWhether to enable Llama HAfalse
llama.am.ha.zk-quorumZooKeeper quorum to use for leader election and fencing 
llama.am.ha.zk-baseBase znode for leader election and fencing data/llama
llama.am.ha.zk-timeout-msThe session timeout, in milliseconds, for connections to ZooKeeper quorum10000
llama.am.ha.zk-aclACLs to control access to ZooKeeperworld:anyone:rwcda
llama.am.ha.zk-authAuthorization 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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Llama2-7B是Llama2系列的一个版本,它是由Meta AI开发的一种大型语言模型。Llama2-7B有官方版本和Huggingface版本。官方版本包括Llama2-7B和Llama2-7B-Chat,而Huggingface版本包括Llama2-7B Huggingface版本和Llama2-7B-Chat Huggingface版本。 如果你想使用Llama2-7B来进行中文对话,可以访问https://huggingface.co/RicardoLee/Llama2-chat-Chinese-50W下载和使用Llama2-7B Huggingface版本。 需要注意的是,Llama2系列的模型在中文对话方面可能存在一些约束问题,根据一些用户的反馈,Llama2模型在中文对话的表现可能不如其他语言。所以在使用Llama2-7B进行中文对话时,可能会遇到一些限制或不理想的结果。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Llama2-7B/13B chat模型(下载地址).txt](https://download.csdn.net/download/u010291330/88215001)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Llama2-chat-7B 开源中文版强势来袭!](https://blog.csdn.net/qq_27590277/article/details/131874933)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值