共計(jì) 3132 個(gè)字符,預(yù)計(jì)需要花費(fèi) 8 分鐘才能閱讀完成。
這篇文章主要講解了“ambari 怎么增加 ElasticSearch 服務(wù)”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著丸趣 TV 小編的思路慢慢深入,一起來研究和學(xué)習(xí)“ambari 怎么增加 ElasticSearch 服務(wù)”吧!
Ambari 是支持服務(wù)擴(kuò)展的,只需要,恩,整理,打包,扔我們的服務(wù)到它的資源目錄,重啟服務(wù)器就可以了。聽起來很簡單。它的服務(wù)組織結(jié)構(gòu)是分 Stack / Service /Component 3 層的 。所以我們從 Stack 開始。一個(gè)自定義 Stack 的目錄結(jié)構(gòu)如圖 (從 HDP 的復(fù)制過來)。
自定義 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 # 服務(wù)目錄
└── ELASTICSEARCH
├── configuration
│ └── elasticsearch-env.xml
├── metainfo.xml
├── metrics.json
└── package
├── archive.zip
├── scripts
│ └── master.py
└── templates
9 directories, 8 files
有了 Stack 后(當(dāng)然,你直接扔到HDP的服務(wù)下面也可以),我們可以添加自己的服務(wù)了。可以看到服務(wù)是在 Stack 的 services 下的,每個(gè)目錄。
自定義 Service
目錄結(jié)構(gòu)
|_ services
|_ service_name
metainfo.xml # 服務(wù)配置文件
metrics.json # 運(yùn)維指標(biāo)配置,映射 ganglia 和 ambari
|_ configuration
{configuration files} # 配置文件
|_ package
{files, scripts, templates} # 安裝腳本,模板和一些文件
metainfo.xml 服務(wù)配置文件,我盡量寫全面一點(diǎn),為了解釋清楚各個(gè)配置項(xiàng)。
?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 !-- 自動(dòng)部署,僅在 cardinality 滿足的情況下,界面上就不問,在這臺(tái)主機(jī),是否安裝這個(gè)組件了 --
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 !-- 依賴服務(wù),安裝的時(shí)候限制,沒有不能繼續(xù)安裝 --
/requiredServices
configuration-dependencies
config-type elasticsearch-env /config-type
/configuration-dependencies
monitoringService false /monitoringService !-- 如果是監(jiān)控服務(wù)的話,每個(gè)組件重啟,他都要重啟 --
/service
/services
/metainfo
服務(wù)和組件名字一定要大寫,不然后面你會(huì)全部重新來過的。不要問我為什么知道,我重試了 N 次。
package 節(jié)點(diǎn)的 name 很重要。yum install [name]
category 節(jié)點(diǎn)組件類型可以有 MASTER,SLAVE,CLIENT 幾種,那 p2p 集群咋辦?
MASTER 不是必須得有,只有 SLAVE 也可以
cardinality 節(jié)點(diǎn)是安裝基數(shù)。1+ 最少一個(gè) , 0-1 最多一個(gè) ,ALL 全部
master.py 一個(gè)最簡單的安裝腳本,好吧,實(shí)際上它什么也沒做
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()
部署,重啟,安裝,然后就能看到我們的成果了,雖然看起來超級(jí)簡單,沒關(guān)系,下面我們會(huì)繼續(xù)完善功能,配置,監(jiān)控,告警管理。。。。
感謝各位的閱讀,以上就是“ambari 怎么增加 ElasticSearch 服務(wù)”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì) ambari 怎么增加 ElasticSearch 服務(wù)這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是丸趣 TV,丸趣 TV 小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!