Ambari Custom Component Installation

Source: Internet
Author: User

Reference: http://www.ibm.com/developerworks/cn/opensource/os-cn-bigdata-ambari3/index.html

The service configuration under the Stack in the resource directory is scanned when the Ambari is started. This is the metainfo.xml of each Service, and the configuration information is placed in its own database. When the user clicks on the "Add Service" on the Web, the Web will load the configuration information into the specific page. In the metainfo.xml of the service, the Commandscript field is used to configure the Service check script entry. If the metainfo.xml of a service has this field, the "Run Service Check" command appears in the service's Action list. For custom Service, these configuration items are not the default. If a custom service requires certain required parameters, it is necessary to create the service configuration directory (config) and the corresponding configuration file for the user to enter when installing.

On the basis of Ambari, we want to install our own software and do it by looking for ourselves:

Mkdir/var/lib/ambari-server/resources/stacks/hdp/2.4/services/daxiong

Under/var/lib/ambari-server/resources/stacks/hdp/2.4/services There are a lot of service directory, is ambari own installation software group, we can build a directory, directory name is best capitalized, I wrote according to the directory, in each service under the directory has metainfo.xml file, the above also introduced, the following is my metainfo.xml content;

<?xml version= "1.0"?>
<metainfo>
<schemaVersion>2.0</schemaVersion>
<services>
<service>
<name>DAXIONG</name>
<displayname>daxiong service</displayname>
<comment>a Daxiong service</comment>
<version>1.0</version>
<components>
<component>
<name>DAXIONG_MASTER</name>
<category>MASTER</category>
<cardinality>1</cardinality>
<commandScript>
<script>scripts/master.py</script>
<scriptType>PYTHON</scriptType>
<timeout>600</timeout>
</commandScript>
</component>
<component>
<name>DAXIONG_SLAVE</name>
<category>SLAVE</category>
<cardinality>1+</cardinality>
<commandScript>
<script>scripts/slave.py</script>
<scriptType>PYTHON</scriptType>
<timeout>600</timeout>
</commandScript>
</component>
<component>
<name>DAXIONG_CLIENT</name>
<category>CLIENT</category>
<cardinality>1+</cardinality>
<commandScript>
<script>scripts/client.py</script>
<scriptType>PYTHON</scriptType>
<timeout>600</timeout>
</commandScript>
</component>
</components>
<osSpecifics>
<osSpecific>
<osFamily>any</osFamily>
</osSpecific>
</osSpecifics>
</service>
</services>
</metainfo>

Create a command script. Create a directory for the command script/var/lib/ambari-server/resources/stacks/hdp/2.0.6/services/daxiong/package/scripts

[[email protected] scripts]# ls
master.py client.py slave.py

[email protected] scripts]# cat master.py

Import Sys
From resource_management Import *
Class Master (Script):
def install (self, env):
print ' Install the Sample daxiong Master ';
def stop (self, env):
print ' Stop the Sample daxiong Master ';
def start (self, env):
print ' Start the Sample daxiong Master ';
def status (Self, env):
print ' Status of the Sample daxiong Master ';
def configure (self, env):
print ' Configure the Sample daxiong Master ';
if __name__ = = "__main__":
Master (). Execute ()

[email protected] scripts]# cat client.py

Import Sys
From resource_management Import *
Class Slave (Script):
def install (self, env):
print ' Install the Sample daxiong Slave ';
def stop (self, env):
print ' Stop the Sample daxiong Slave ';
def start (self, env):
print ' Start the Sample daxiong Slave ';
def status (Self, env):
print ' Status of the Sample daxiong Slave ';
def configure (self, env):
print ' Configure the Sample daxiong Slave ';
if __name__ = = "__main__":
Slave (). Execute ()

[email protected] scripts]# cat slave.py

Import Sys
From resource_management Import *
Class Sampleclient (Script):
def install (self, env):
print ' Install the Sample daxiong Client ';
def configure (self, env):
print ' Configure the Sample daxiong Client ';
if __name__ = = "__main__":
Sampleclient (). Execute ()

After the above configuration need to restart Ambari, and then add the service in the Web interface can be, this is just a simple case, because recently in this aspect, so the simple test a bit. In the middle of the original set up hbase problems, only need to enter the machine (host), open the service can not open.

Here are the following:

650) this.width=650; "Title=" captures Q. PNG "alt=" wkiol1er2lwti65raaa86_pjqay738.png-wh_50 "src=" http://s1.51cto.com/wyfs02/M00/84/7C/ Wkiol1er2lwti65raaa86_pjqay738.png-wh_500x0-wm_3-wmp_4-s_3613327396.png "/>



This article is from the "Come Together" blog, please be sure to keep this source http://daxionglaiba.blog.51cto.com/11790757/1828855

Ambari Custom Component Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.