diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd/httpd.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd/httpd.json new file mode 100644 index 0000000..cf5710e --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd/httpd.json @@ -0,0 +1,23 @@ +{ + "name": "httpd-service", + "lifetime": "3600", + "components": [ + { + "name": "httpd", + "number_of_containers": 1, + "artifact": { + "id": "centos/httpd-24-centos7:latest", + "type": "DOCKER" + }, + "run_privileged_container": false, + "launch_command": "/usr/bin/run-httpd", + "resource": { + "cpus": 1, + "memory": "2048" + } + } + ], + "quicklinks": { + "Apache Document Root": "http://httpd-0.${SERVICE_NAME}.${USER}.${DOMAIN}:8080" + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Examples.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Examples.md new file mode 100644 index 0000000..4db7212 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Examples.md @@ -0,0 +1,53 @@ + + +# YARN Service Examples + +This document describes some example service definitions (`Yarnfile`). + + + +## Apache web server - httpd +Below is the `Yarnfile` for a service called `httpd-service` with one `httpd` instance : +``` +{ + "name": "httpd-service", + "components": [ + { + "name": "httpd", + "number_of_containers": 1, + "artifact": { + "id": "centos/httpd-24-centos7:latest", + "type": "DOCKER" + }, + "launch_command": "/usr/bin/run-httpd", + "resource": { + "cpus": 1, + "memory": "2048" + } + } + ], + "quicklinks": { + "Apache Document Root": "http://httpd-0.${SERVICE_NAME}.${USER}.${DOMAIN}:8080/" + } +} + +``` +This `Yarnfile` is already included in the Hadoop distribution, user can simply run below command to try: +``` +yarn service create [service-name] --example httpd +``` +where `service-name` is optional. If omitted, it uses the name defined in the `Yarnfile`. + +Once the service is running, navigate to `http://httpd-0.${SERVICE_NAME}.${USER}.${DOMAIN}:8080` to see the root page. diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Overview.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Overview.md index 3dd4d8c..407fbc0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Overview.md +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Overview.md @@ -52,7 +52,8 @@ The benefits of combining these workloads are two-fold: * [Concepts](Concepts.md): Describes the internals of the framework and some features in YARN core to support running services on YARN. * [Service REST API](YarnServiceAPI.md): The API doc for deploying/managing services on YARN. -* [Service Discovery](ServiceDiscovery.md): Deep dives into the YARN DNS internals +* [Service Discovery](ServiceDiscovery.md): Deep dives into the YARN DNS internals. +* [Examples](Examples.md): List some example service definitions (`Yarnfile`).