杭州商城型网站建设,网站续费模版,广告文案策划,专题研究网站建设工作动态借鉴#xff1a;http://www.ibm.com/developerworks/cn/opensource/os-cn-bigdata-ambari3/index.htmlAmbari 在启动的时候#xff0c;会扫描 resource 目录下 Stack 下面的 service 配置。也就是每个 Service 的 metainfo.xml#xff0c;同时会将这些配置信息放在自己的数据… 借鉴http://www.ibm.com/developerworks/cn/opensource/os-cn-bigdata-ambari3/index.htmlAmbari 在启动的时候会扫描 resource 目录下 Stack 下面的 service 配置。也就是每个 Service 的 metainfo.xml同时会将这些配置信息放在自己的数据库中。当用户在 WEB 上面点击 “Add Service”的时候WEB 就会加载这些配置信息到具体的页面里。在 Service 的 metainfo.xml 中commandScript 字段就是用来配置 service check 脚本入口。如果一个 Service 的 metainfo.xml 有该字段那么在 Service 的 Action 列表中就会出现“Run Service Check”这个命令。对于自定义的 Service默认是没有这些配置项的。如果一个自定义的 Service 需要某些必须的参数时就必须创建 Service 的配置目录configuration和对应的配置文件让用户安装的时候输入。在ambari的基础上我们想要安装我们自己的软件通过查找自己做了一下mkdir /var/lib/ambari-server/resources/stacks/HDP/2.4/services/DAXIONG在/var/lib/ambari-server/resources/stacks/HDP/2.4/services下面有很多service目录是ambari自己的安装软件组我们可以自己建一个目录目录名字最好大写我是按照目录里写的在每个service下的目录中都有metainfo.xml文件上述也介绍了下面是我的metainfo.xml内容?xml version1.0?metainfo schemaVersion2.0/schemaVersion services service nameDAXIONG/name displayNameDAXIONG Service/displayName commentA DAXIONG Service/comment version1.0/version components component nameDAXIONG_MASTER/name categoryMASTER/category cardinality1/cardinality commandScript scriptscripts/master.py/script scriptTypePYTHON/scriptType timeout600/timeout /commandScript /component component nameDAXIONG_SLAVE/name categorySLAVE/category cardinality1/cardinality commandScript scriptscripts/slave.py/script scriptTypePYTHON/scriptType timeout600/timeout /commandScript /component component nameDAXIONG_CLIENT/name categoryCLIENT/category cardinality1/cardinality commandScript scriptscripts/client.py/script scriptTypePYTHON/scriptType timeout600/timeout /commandScript /component /components osSpecifics osSpecific osFamilyany/osFamily /osSpecific /osSpecifics /service /services/metainfo创建命令脚本. 为命令脚本创建一个目录 /var/lib/ambari-server/resources/stacks/HDP/2.0.6/services/DAXIONG/package/scripts[rootmaster scripts]# lsmaster.py client.py slave.py[rootmaster scripts]# cat master.pyimport sysfrom 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()[rootmaster scripts]# cat client.pyimport sysfrom 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()[rootmaster scripts]# cat slave.pyimport sysfrom 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()上面的配置完后需要重新启动ambari然后在web界面添加服务就可以了这只是一个简单是事例因为最近在做这一方面所以简单的测试了一下。中间原来搭建的hbase出现了问题只需要进入所在的机器host开启没有开启的服务即可。下面是截图 转载于:https://blog.51cto.com/daxionglaiba/1828855