ambari2.7.3(hdp3.1) 安装 elasticsearch6.3.2

ambari的hdp中原生不支持elasticsearch安装,下面介绍如何通过mpack方式使ambari支持elasticsearch安装:

一 安装Service

1 下载

Mpack include version 6.3.2 of ElasticSearch, Logstash, Kibana, FileBeat, and MetricBeat

# wget https://community.hortonworks.com/storage/attachments/87416-elasticsearch-mpack-2600-9.tar.gz

2 安装mpack

# ambari-server install-mpack --mpack=/path/to/87416-elasticsearch-mpack-2600-9.tar.gz --verbose

3 重启ambari-server

# ambari-server restart

访问ambari页面发现services中并没有elasticsearch,检查mpack.json发现问题:

/var/lib/ambari-server/resources/mpacks/elasticsearch-ambari.mpack-6.3.2/mpack.json

{

"service_name" : "ELASTICSEARCH",

"service_version" : "6.3.2",

"applicable_stacks" : [

{

"stack_name" : "HDP",

"stack_version" : "2.3"

},

{

"stack_name" : "HDP",

"stack_version" : "2.4"

},

{

"stack_name" : "HDP",

"stack_version" : "2.5"

},

{

"stack_name" : "HDP",

"stack_version" : "2.6"

}

]

}

applicable_stacks表明service只应用到hdp2.3-2.6版本,没有3.1,手工加上;

mpack详细结构详见:https://cwiki.apache.org/confluence/display/AMBARI/Management+Packs

要注意直接修改mpack.json然后重启ambari-server不管用,需要重新install mpack:

1 卸载

ambari-server uninstall-mpack --mpack-name=elasticsearch-ambari.mpack

2 修改mpack.json并重新打包

elasticsearch_mpack-2.6.0.0-9.tar.gz

3 安装mpack(同上)

4 重启ambari-server(同上)

这时就可以在页面上看到ElasticSearch, Logstash, Kibana, FileBeat, and MetricBeat

二 部署ElasticSearch

下面开始部署ElasticSearch,发现报错:

Traceback (most recent call last):

File "/var/lib/ambari-agent/cache/stack-hooks/before-ANY/scripts/hook.py", line 38, in <module>

BeforeAnyHook().execute()

File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py", line 352, in execute

method(env)

File "/var/lib/ambari-agent/cache/stack-hooks/before-ANY/scripts/hook.py", line 31, in hook

setup_users()

File "/var/lib/ambari-agent/cache/stack-hooks/before-ANY/scripts/shared_initialization.py", line 50, in setup_users

groups = params.user_to_groups_dict[user],

KeyError: u'elasticsearch'

Error: Error: Unable to run the custom hook script ['/usr/bin/python', '/var/lib/ambari-agent/cache/stack-hooks/before-ANY/scripts/hook.py', 'ANY', '/var/lib/ambari-agent/data/command-303.json', '/var/lib/ambari-agent/cache/stack-hooks/before-ANY', '/var/lib/ambari-agent/data/structured-out-303.json', 'INFO', '/var/lib/ambari-agent/tmp', 'PROTOCOL_TLSv1_2', '']

跟进报错的代码:

/var/lib/ambari-agent/cache/stack-hooks/before-ANY/scripts/shared_initialization.py

  1. 35 should_create_users_and_groups = False
  2. 36 if params.host_sys_prepped:
  3. 37 should_create_users_and_groups = not params.sysprep_skip_create_users_and_groups
  4. 38 else:
  5. 39 should_create_users_and_groups = not params.ignore_groupsusers_create
  6. 40
  7. 41 if should_create_users_and_groups:
  8. 42 for group in params.group_list:
  9. 43 Group(group,
  10. 44 )
  11. 45
  12. 46 for user in params.user_list:
  13. 47 User(user,
  14. 48 uid = get_uid(user) if params.override_uid == "true" else None,
  15. 49 gid = params.user_to_gid_dict[user],
  16. 50 groups = params.user_to_groups_dict[user],
  17. 51 fetch_nonlocal_groups = params.fetch_nonlocal_groups,
  18. 52 )

这时需要将配置ignore_groupsusers_create打开,查看和修改配置有两种方式:

1 命令行

# cd /var/lib/ambari-server/resources/scripts
# python configs.py -u admin -p admin -n $cluster_name -l $ambari_server -t 8080 -a get -c cluster-env |grep -i ignore_groupsusers_create
"ignore_groupsusers_create": "false",
# python configs.py -u admin -p admin -n $cluster_name -l $ambari_server -t 8080 -a set -c cluster-env -k ignore_groupsusers_create -v true

详细参数详见

# python configs.py --help

2 rest api

curl --user admin:admin -i -H 'X-Requested-By: ambari' -X GET "http://ambari.server:8080/api/v1/clusters/$cluster_name/configurations?type=cluster-env"

从返回的items中找到tag,然后再请求(增加tag参数):

curl --user admin:admin -i -H 'X-Requested-By: ambari' -X GET "http://ambari.server:8080/api/v1/clusters/$cluster_name/configurations?type=cluster-env&tag=$tag"

返回结果中包含所有的property

"properties" : {
"agent_mounts_ignore_list" : "",
"alerts_repeat_tolerance" : "1",
"enable_external_ranger" : "false",
"fetch_nonlocal_groups" : "true",
"hide_yarn_memory_widget" : "false",
"ignore_bad_mounts" : "false",
"ignore_groupsusers_create" : "false",

修改需要先将上面的配置保存到一个文件,比如/tmp/configurations.tmp,然后修改,然后再调用接口:

curl --user admin:admin -i -H 'X-Requested-By: ambari' -X PUT -d @/tmp/configurations.tmp http://ambari.server:8080/api/v1/clusters/$cluster_name

然后再部署即可;

三 启动ElasticSearch

启动elasticsearch,报错:

1)

File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/config_dictionary.py", line 73, in __getattr__
raise Fail("Configuration parameter '" + self.name + "' was not found in configurations dictionary!")
resource_management.core.exceptions.Fail: Configuration parameter 'java_home' was not found in configurations dictionary!

需要返回ambari的elasticsearch config页面,将java_home修改为实际的java home路径:

# JAVA_HOME must be provided here for OS that use systemd service launch
JAVA_HOME={{java64_home}}

2)

File "/var/lib/ambari-agent/cache/common-services/ELASTICSEARCH/6.3.2/package/templates/elasticsearch.slave.yaml.j2", line 85, in top-level template code
gateway.expected_data_nodes: {{ expected_data_nodes }}
File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/config_dictionary.py", line 73, in __getattr__
raise Fail("Configuration parameter '" + self.name + "' was not found in configurations dictionary!")
resource_management.core.exceptions.Fail: Configuration parameter 'hostname' was not found in configurations dictionary!

查看报错的文件

/var/lib/ambari-agent/cache/common-services/ELASTICSEARCH/6.3.2/package/templates/elasticsearch.slave.yaml.j2
/var/lib/ambari-agent/cache/common-services/ELASTICSEARCH/6.3.2/package/templates/elasticsearch.master.yaml.j2

发现报错的这行,是因为hostname没有赋值导致,直接去掉这行

node.name: {{ hostname }}

在ambari-server端对应的模板文件为:

# grep hostname /var/lib/ambari-server/resources/common-services/ELASTICSEARCH/6.3.2/package/templates/elasticsearch*
/var/lib/ambari-server/resources/common-services/ELASTICSEARCH/6.3.2/package/templates/elasticsearch.master.yaml.j2:node.name: {{ hostname }}
/var/lib/ambari-server/resources/common-services/ELASTICSEARCH/6.3.2/package/templates/elasticsearch.master.yaml.j2.5.6.2: name: {{hostname}}
/var/lib/ambari-server/resources/common-services/ELASTICSEARCH/6.3.2/package/templates/elasticsearch.slave.yaml.j2:node.name: {{ hostname }}
/var/lib/ambari-server/resources/common-services/ELASTICSEARCH/6.3.2/package/templates/elasticsearch.slave.yaml.j2.5.6.2: name: {{hostname}}

然后可以启动成功:

参考:

https://community.hortonworks.com/articles/215078/how-to-install-elk-stack-632-in-ambari.html
https://community.hortonworks.com/questions/212871/add-custom-service-via-ambari-error.html
https://community.hortonworks.com/articles/63557/how-to-edit-the-cluster-envxml-entries-using-ambar.html

【原创】大数据基础之Ambari(2)通过Ambari部署ElasticSearch(ELK)的更多相关文章

  1. 大数据基础环境--jdk1.8环境安装部署

    1.环境说明 1.1.机器配置说明 本次集群环境为三台linux系统机器,具体信息如下: 主机名称 IP地址 操作系统 hadoop1 10.0.0.20 CentOS Linux release 7 ...

  2. 【原创】大数据基础之Zookeeper(2)源代码解析

    核心枚举 public enum ServerState { LOOKING, FOLLOWING, LEADING, OBSERVING; } zookeeper服务器状态:刚启动LOOKING,f ...

  3. 【原创】大数据基础之Ambari(1)简介、编译安装、使用

    官方:http://ambari.apache.org/ The Apache Ambari project is aimed at making Hadoop management simpler ...

  4. 【原创】大数据基础之Impala(1)简介、安装、使用

    impala2.12 官方:http://impala.apache.org/ 一 简介 Apache Impala is the open source, native analytic datab ...

  5. 【原创】大数据基础之词频统计Word Count

    对文件进行词频统计,是一个大数据领域的hello word级别的应用,来看下实现有多简单: 1 Linux单机处理 egrep -o "\b[[:alpha:]]+\b" test ...

  6. 【原创】大数据基础之Benchmark(2)TPC-DS

    tpc 官方:http://www.tpc.org/ 一 简介 The TPC is a non-profit corporation founded to define transaction pr ...

  7. 大数据基础知识问答----hadoop篇

    handoop相关知识点 1.Hadoop是什么? Hadoop是一个由Apache基金会所开发的分布式系统基础架构.用户可以在不了解分布式底层细节的情况下,开发分布式程序.充分利用集群的威力进行高速 ...

  8. 大数据基础知识:分布式计算、服务器集群[zz]

    大数据中的数据量非常巨大,达到了PB级别.而且这庞大的数据之中,不仅仅包括结构化数据(如数字.符号等数据),还包括非结构化数据(如文本.图像.声音.视频等数据).这使得大数据的存储,管理和处理很难利用 ...

  9. 大数据基础知识问答----spark篇,大数据生态圈

    Spark相关知识点 1.Spark基础知识 1.Spark是什么? UCBerkeley AMPlab所开源的类HadoopMapReduce的通用的并行计算框架 dfsSpark基于mapredu ...

随机推荐

  1. 软件工程(FZU2015) 赛季得分榜,第一回合

    SE_FZU目录:1 2 3 4 5 6 7 8 9 10 11 12 13 积分规则 积分制: 作业为10分制,练习为3分制:alpha30分: 团队项目分=团队得分+个人贡献分 个人贡献分: 个人 ...

  2. docker(五) 使用Docker Registry搭建镜像私服

    1.创建私服 docker run -d --name registry -v /opt/data/registry:/var/lib/registry -p 5000:5000 registry - ...

  3. 2019微信公开课 同行With Us 听课笔记及演讲全文

    [2019WeChat 微信公开课] 产品理念: 微信启动页 一个小人站在地球前面,每个人都有自己的理解和解读 所谓异类,表示与别人与众不同,即优秀的代名词. 微信的与众不同体现在尊重用户对产品的感受 ...

  4. Android艺术——深看Activity的生命周期

    探究Activity的生命周期 1.典型情况下的生命周期分析:onCreate 初始化工作,加载布局资源和数据:onStart ac正在启动但是无法交互,后台:onResume ac可见,显示在前台: ...

  5. poj-2516(最小费用流)

    题意:有n个商店,每个商店有k种货物,每个货物需要a[n][k]个,有m个仓库,每个仓库也有k种货物,每个货物有b[m][k]个,然后k个矩阵,每个矩阵都是n*m的,第i行第j列表示从仓库j到商店i每 ...

  6. DRF之版本控制、认证和权限组件

    一.版本控制组件 1.为什么要使用版本控制 首先我们开发项目是有多个版本的当我们项目越来越更新,版本就越来越多,我们不可能新的版本出了,以前旧的版本就不进行维护了像bootstrap有2.3.4版本的 ...

  7. redis哨兵(Sentinel)、虚拟槽分区(cluster)和docker入门

    一.Redis-Sentinel(哨兵) 1.介绍 Redis-Sentinel是redis官方推荐的高可用性解决方案,当用redis作master-slave的高可用时,如果master本身宕机,r ...

  8. eclipse报错 : One or more constraints have not been satisfied.

    当eclipse进行报错时,但是不影响运行时,这种错误一般是编译时的问题 进行修改3个地方,即可完成 一 :  进行修改这三个地方的配置文件,都改成你统一的jdk版本,和你用的Dynamic Web ...

  9. react native环境搭建与生命周期

    1.搭建开发环境 英文文档:http://facebook.github.io/react-native/docs/getting-started.html 中文文档:https://reactnat ...

  10. pc安装完成charles成功,小米安装crt证书失败

    问题描述: 今天在学习爬虫爬取APP内容时,需要安装crt证书.根据静谧大大的书,前面都挺顺利的.但在我的小米手机上安装crt证书时,出现了错误.手机显示无法安装. 解决之道: 1.不要用小米手机自带 ...