ambari怎么增加ElasticSearch服务

54次阅读
没有评论

共计 3132 个字符,预计需要花费 8 分钟才能阅读完成。

这篇文章主要讲解了“ambari 怎么增加 ElasticSearch 服务”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着丸趣 TV 小编的思路慢慢深入,一起来研究和学习“ambari 怎么增加 ElasticSearch 服务”吧!

 Ambari 是支持服务扩展的,只需要,恩,整理,打包,扔我们的服务到它的资源目录,重启服务器就可以了。听起来很简单。它的服务组织结构是分 Stack / Service /Component 3 层的  。所以我们从 Stack 开始。一个自定义 Stack 的目录结构如图 (从 HDP 的复制过来)。

自定义 Stack

[root@master stacks]# pwd
/var/lib/ambari-server/resources/stacks
[root@master stacks]# tree NQ
└── 1.1
 ├── configuration
 │ └── cluster-env.xml
 ├── metainfo.xml
 ├── repos
 │ └── repoinfo.xml # 软件仓库的 URL
 └── services # 服务目录
 └── ELASTICSEARCH
 ├── configuration
 │ └── elasticsearch-env.xml
 ├── metainfo.xml
 ├── metrics.json
 └── package
 ├── archive.zip
 ├── scripts
 │ └── master.py
 └── templates
9 directories, 8 files

有了 Stack 后(当然,你直接扔到HDP的服务下面也可以),我们可以添加自己的服务了。可以看到服务是在 Stack 的 services 下的,每个目录。

自定义 Service

目录结构

 |_ services
 |_  service_name 
 metainfo.xml # 服务配置文件
 metrics.json # 运维指标配置,映射 ganglia 和 ambari
 |_ configuration
 {configuration files} # 配置文件
 |_ package
 {files, scripts, templates} # 安装脚本,模板和一些文件 

metainfo.xml     服务配置文件,我尽量写全面一点,为了解释清楚各个配置项。

?xml version= 1.0 ? 
 metainfo 
  schemaVersion 2.0 /schemaVersion 
  services 
  service 
  name ELASTICSEARCH /name 
  displayName ElasticSearch /displayName 
  comment ElasticSearch service /comment 
  version 1.4.0 /version 
  components 
  component 
  name ELASTICSEARCH /name 
  displayName ElasticSearch /displayName 
  category MASTER /category 
  cardinality 1 /cardinality 
  commandScript 
  script scripts/master.py /script 
  scriptType PYTHON /scriptType 
  timeout 600 /timeout 
  /commandScript 
  /component 
  component 
  name ELASTICSEARCH_NODE /name 
  displayName ElasticSearchNode /displayName 
  category SLAVE /category 
  cardinality ALL /cardinality 
  auto-deploy   !-- 自动部署,仅在 cardinality 满足的情况下,界面上就不问,在这台主机,是否安装这个组件了 -- 
  enabled false /enabled 
  /auto-deploy 
  commandScript 
  script scripts/slave.py /script 
  scriptType PYTHON /scriptType 
  timeout 600 /timeout 
  /commandScript 
  !-- configFiles 
  configFile 
  type env /type 
  fileName elasticsearch-env.xml /fileName 
  dictionaryName elasticsearch-env /dictionaryName 
  /configFile 
  /configFiles -- 
  /component 
  /components 
  osSpecifics 
  osSpecific 
  osFamily any /osFamily 
  packages 
  package 
  name elasticsearch /name 
  /package 
  /packages 
  /osSpecific 
  /osSpecifics 
  requiredServices 
  service GANGLIA /service   !-- 依赖服务,安装的时候限制,没有不能继续安装 -- 
  /requiredServices 
  configuration-dependencies 
  config-type elasticsearch-env /config-type 
  /configuration-dependencies 
  monitoringService false /monitoringService   !-- 如果是监控服务的话,每个组件重启,他都要重启 -- 
  /service 
  /services 
 /metainfo

服务和组件名字一定要大写,不然后面你会全部重新来过的。不要问我为什么知道,我重试了 N 次。

package 节点的 name 很重要。yum install [name] 

category 节点组件类型可以有 MASTER,SLAVE,CLIENT 几种,那 p2p 集群咋办?

MASTER 不是必须得有,只有 SLAVE 也可以

cardinality 节点是安装基数。1+ 最少一个 ,  0-1 最多一个 ,ALL 全部

master.py   一个最简单的安装脚本,好吧,实际上它什么也没做

import sys
from resource_management import *
class Master(Script):
 def install(self, env):
 print  Install the ES Master 
 def stop(self, env):
 print  Stop the ES Master 
 def start(self, env):
 print  Start the ES Master 
 
 def status(self, env):
 print  Status of the ES Master 
 def configure(self, env):
 print  Configure the ES Master 
if __name__ ==  __main__ :
 Master().execute()

部署,重启,安装,然后就能看到我们的成果了,虽然看起来超级简单,没关系,下面我们会继续完善功能,配置,监控,告警管理。。。。

感谢各位的阅读,以上就是“ambari 怎么增加 ElasticSearch 服务”的内容了,经过本文的学习后,相信大家对 ambari 怎么增加 ElasticSearch 服务这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是丸趣 TV,丸趣 TV 小编将为大家推送更多相关知识点的文章,欢迎关注!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-16发表,共计3132字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)