Service 目錄結構
[root@manager SAMPLESRV]# pwd
/var/lib/ambari-server/resources/stacks/FSDP/2.5/services/SAMPLESRV
[root@manager SAMPLESRV]# tree
.
├── configuration
│ └── scrapy-config.xml
├── metainfo.xml
├── package
│ └── scripts
│ ├── master.py
│ ├── sample_client.py
│ └── slave.py
└── quicklinks
└── quicklinks.json
在metainfo.xml中添加configuration-dependencies
屬性
<configuration-dependencies>
<config-type>scrapy-config</config-type>
</configuration-dependencies>
<restartRequiredAfterChange>true</restartRequiredAfterChange>
該屬性與爲Ambari自定義Service添加QuickLink一節中給出的xml文件的quickLinksConfigurations
屬性是並列關係,即在service
屬性內部。
scrapy-config.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>scrapy.bot.name</name>
<value>sina</value>
<description>Scrapy bot's name</description>
</property>
<property>
<name>scrapy.spider.modules</name>
<value>sina.spiders</value>
<description>sina's spider modules</description>
</property>
<property>
<name>scrapy.robotstxt.obey</name>
<value>False</value>
<description>Whether oderby robots protocol</description>
</property>
</configuration>
爲了能夠讓新添加的配置文件生效,在Ambari Web頁面中刪除掉現有的New Sample Service
,接着按照爲Ambari添加新的Service給出的方法,重新添加New Sample Service
這個Service,安裝完成後便可以看到配置中的配置選項了。