Launching a YARN service

Launching a service saves the service file to HDFS and starts the service.

Run the following command to launch the sleeper service example. This sleeper example is provided with YARN, so it can be referred to by the name ;sleeper; or the path to the JSON file can be specified:

yarn app -launch sleeper-service <sleeper OR /path/to/sleeper.json>

This command saves and starts the sleeper service with two instances of the sleeper component. The service could also be launched by making calls to the REST API instead of using the command line. The service can be stopped and destroyed as follows. The stop command stops the service from running, but leaves the service JSON file stored in HDFS so that the service could be started again using a start command. The destroy command stops the service if it is running and removes the service information entirely.

yarn app -stop sleeper-service
yarn app -destroy sleeper-service