https://github.com/Jaraxal/ambari-elasticsearch-service
下载得到ambari-elasticsearch-service-master.zip压缩包
(1)进入ambari源码ambari-server/resources/stacks/HDP/2.4/services目录
[root@master services]# pwd
/var/lib/ambari-server/resources/stacks/HDP/2.4/services
[root@master services]# ls
ACCUMULO FALCON HBASE HIVE KERBEROS MAHOUT PIG RANGER_KMS SPARK stack_advisor.py stack_advisor.pyo TEZ ZOOKEEPER
ATLAS FLUME HDFS KAFKA KNOX OOZIE RANGER SLIDER SQOOP stack_advisor.pyc STORM YARN
(2)创建ELASTICSEARCH目录并进入该目录
[root@master services]# mkdir ELASTICSEARCH
[root@master services]# cd ELASTICSEARCH/
(3)编辑metainfo.xml
[root@master ELASTICSEARCH]#vi metainfo.xml
[root@master ELASTICSEARCH]#cat metainfo.xml
<metainfo>
<schemaVersion>2.0schemaVersion>
<services>
<service>
<name>ELASTICSEARCHname>
<version>5.1.1version>
<extends>common-services/ELASTICSEARCH/5.1.1extends>
service>
services>
metainfo>
(1)进入ambari-server/src/main/resources/common-services目录
[root@master common-services]# pwd
/opt/apache-ambari-2.4.2-src/ambari-server/src/main/resources/common-services
[root@master common-services]# ls
ACCUMULO ATLAS FLUME HBASE KAFKA LOGSEARCH PIG RANGER_KMS SPARK2 TEZ ZOOKEEPER
AMBARI_INFRA ELASTICSEARCH GANGLIA HDFS KERBEROS MAHOUT PXF SLIDER SQOOP YARN
AMBARI_METRICS FALCON HAWQ HIVE KNOX OOZIE RANGER SPARK STORM ZEPPELIN
(2)创建ES版本目录
[root@master common-services]# mkdir -p ELASTICSEARCH/5.1.1/
[root@vnode1 common-services]# cd
(3)解压ambari-elasticsearch-service-master.zip
[root@master ~]# unzip ambari-elasticsearch-service-master.zip
(4)编辑ambari-elasticsearch-service-master中的metainfo.xml文件
[root@master ~]# cd ambari-elasticsearch-service-master
[root@master ambari-elasticsearch-service-master]# vi metainfo.xml
[root@vnode0 5.1.1]# vi metainfo.xml
<metainfo>
<schemaVersion>2.0schemaVersion>
<services>
<service>
<name>ELASTICSEARCHname>
<displayName>ElasticSearchdisplayName>
<comment>ElasticSearch servicecomment>
<version>5.1.1version>
<components>
<component>
<name>ELASTICSEARCHname>
<displayName>ElasticSearchdisplayName>
<category>MASTERcategory>
<cardinality>1cardinality>
<commandScript>
<script>scripts/master.pyscript>
<scriptType>PYTHONscriptType>
<timeout>600timeout>
commandScript>
component>
<component>
<name>ELASTICSEARCH_NODEname>
<displayName>ElasticSearchNodedisplayName>
<category>SLAVEcategory>
<cardinality>ALLcardinality>
<auto-deploy>
<enabled>falseenabled>
auto-deploy>
<commandScript>
<script>scripts/slave.pyscript>
<scriptType>PYTHONscriptType>
<timeout>600timeout>
commandScript>
component>
components>
<osSpecifics>
<osSpecific>
<osFamily>anyosFamily>
<packages>
<package>
<name>elasticsearchname>
package>
packages>
osSpecific>
osSpecifics>
<requiredServices>
<service>GANGLIAservice>
requiredServices>
<configuration-dependencies>
<config-type>elasticsearch-envconfig-type>
configuration-dependencies>
<monitoringService>falsemonitoringService>
service>
services>
metainfo>
(5)复制脚本
将https://github.com/Jaraxal/ambari-elasticsearch-service下载得到ambari-elasticsearch-service-master.zip压缩包的配置文件复制到ambari对应目录下。
[root@master ambari-elasticsearch-service-master]# cp -r * /opt/apache-ambari-2.4.2-src/ambari-server/src/main/resources/common-services/ELASTICSEARCH/5.1.1/
(6)查看
[root@master ambari-elasticsearch-service-master]# cd /opt/apache-ambari-2.4.2-src/ambari-server/src/main/resources/common-services/ELASTICSEARCH/5.1.1/
[root@master 5.1.1]# ls
configuration LICENSE metainfo.xml package quicklinks README.md
[root@master 5.1.1]#
(7)设置ES下载URL
[root@master 5.1.1]# cd package/scripts/
[root@master scripts]# ls
elastic_common.py master.py params.py status_params.py
[root@master scripts]# vi params.py
elastic_download = 'http://192.168.1.180/hdp/elasticsearch-5.1.1.tar.gz'
[root@master 2.4.3.0]# vi HDP-2.4.3.0-227.xml
<repository-version xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="version_definition.xsd">
<release>
<type>STANDARDtype>
<stack-id>HDP-2.4stack-id>
<version>2.4.3.0version>
<build>227build>
<compatible-with>2.4.[0-9]+compatible-with>
<release-notes>http://example.comrelease-notes>
<display>HDP-2.4.3.0-227display>
<package-version>2_4_3_0_*package-version>
release>
<manifest>
<service id="KNOX-060" name="KNOX" version="0.6.0"/>
<service id="SLIDER-0800" name="SLIDER" version="0.80.0"/>
<service id="FALCON-061" name="FALCON" version="0.6.1"/>
<service id="MAHOUT-090" name="MAHOUT" version="0.9.0"/>
<service id="HBASE-112" name="HBASE" version="1.1.2"/>
<service id="FLUME-152" name="FLUME" version="1.5.2"/>
<service id="HIVE-121000" name="HIVE" version="1.2.1000"/>
<service id="TEZ-070" name="TEZ" version="0.7.0"/>
<service id="OOZIE-420" name="OOZIE" version="4.2.0"/>
<service id="HDFS-271" name="HDFS" version="2.7.1"/>
<service id="YARN-271" name="YARN" version="2.7.1"/>
<service id="MAPREDUCE2-271" name="MAPREDUCE2" version="2.7.1"/>
<service id="ZOOKEEPER-346" name="ZOOKEEPER" version="3.4.6"/>
<service id="KAFKA-090" name="KAFKA" version="0.9.0"/>
<service id="SQOOP-146" name="SQOOP" version="1.4.6"/>
<service id="ATLAS-050" name="ATLAS" version="0.5.0"/>
<service id="SPARK-162" name="SPARK" version="1.6.2"/>
<service id="STORM-0100" name="STORM" version="0.10.0"/>
<service id="PIG-0150" name="PIG" version="0.15.0"/>
<service id="RANGER-050" name="RANGER" version="0.5.0"/>
<service id="RANGER_KMS-050" name="RANGER_KMS" version="0.5.0"/>
<service id="ACCUMULO-170" name="ACCUMULO" version="1.7.0"/>
<service id="ELASTICSEARCH-511" name="ELASTICSEARCH" version="5.1.1"/>
manifest>
<available-services/>
<repository-info>
<os family="redhat6">
<repo>
<baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos7/2.x/BUILDS/2.4.3.0-227baseurl>
<repoid>HDP-2.4repoid>
<reponame>HDPreponame>
repo>
<repo>
<baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos7baseurl>
<repoid>HDP-UTILS-1.1.0.20repoid>
<reponame>HDP-UTILSreponame>
repo>
os>
repository-info>
repository-version>
[root@master 2.4.3.0]# createrepo --update .
Spawning worker 0 with 46 pkgs
Spawning worker 1 with 46 pkgs
Spawning worker 2 with 45 pkgs
Spawning worker 3 with 45 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete