Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Shown below is how to define a service in common-services folder. The same approach can be taken when defining services in the stacks folder, which will be discussed in the Define Stack section.

Services should MUST provide the main metainfo.xml file which provides important metadata about the service. 
Apart from that, other files can be provided to give more information about the service. More details about these files are provided below.

...

The scripts necessary to manage service and components are specified in the metainfo.xml (HDFS)
Each of these scripts should extend the Script class which provides useful methods. Example: NameNode script
 

These scripts should be provided in the <service-id>/<service-version>/package/scripts folder.

...

Code Block
languagepy
titlemaster.py
linenumberstrue
import sys
from resource_management import *Script
class Master(Script):
  def install(self, env):
    print 'Install the Sample Srv Master';
  def stop(self, env):
    print 'Stop the Sample Srv Master';
  def start(self, env):
    print 'Start the Sample Srv Master';
  def status(self, env):
    print 'Status of the Sample Srv Master';
  def configure(self, env):
    print 'Configure the Sample Srv Master';
if __name__ == "__main__":
  Master().execute()
Code Block
languagepy
titleslave.py
linenumberstrue
import sys
from resource_management import *Script
class Slave(Script):
  def install(self, env):
    print 'Install the Sample Srv Slave';
  def stop(self, env):
    print 'Stop the Sample Srv Slave';
  def start(self, env):
    print 'Start the Sample Srv Slave';
  def status(self, env):
    print 'Status of the Sample Srv Slave';
  def configure(self, env):
    print 'Configure the Sample Srv Slave';
if __name__ == "__main__":
  Slave().execute()
Code Block
languagepy
titleclient.py
linenumberstrue
import sys
from resource_management import *Script
class SampleClient(Script):
  def install(self, env):
    print 'Install the Sample Srv Client';
  def configure(self, env):
    print 'Configure the Sample Srv Client';
if __name__ == "__main__":
  SampleClient().execute()

...