...
Add the Service to the Cluster.
Code Block POST /api/v1/clusters/MyCluster/services { "ServiceInfo": { "service_name":"TESTSRV" } }
Add the Components to the Service. In this case, add TEST_CLIENT to TESTSRV.
Code Block POST /api/v1/clusters/MyCluster/services/TESTSRV/components/TEST_CLIENT
Install the component on a host. For example, on the
c6403.ambari.apache.org
host, first create the component resource, then have Ambari install the component. This will end up calling theinstall()
method in the command script.Code Block POST /api/v1/clusters/MyCluster/hosts/c6403.ambari.apache.org/host_components/TEST_CLIENT
Code Block PUT /api/v1/clusters/MyCluster/hosts/c6403.ambari.apache.org/host_components/TEST_CLIENT { "RequestInfo":{ "context":"Install Test Srv"}, "Body":{ "HostRoles":{ "state":"INSTALLED" } } }
Use the following to configure the client on the host. This will end up calling the
configure()
method in the command script.Code Block POST /api/v1/clusters/MyCluster/requests { "RequestInfo" : { "command" : "CONFIGURE", "context" : "Config Test Srv Client" }, "Requests/resource_filters": [{ "service_name" : "TESTSRV", "component_name" : "TEST_CLIENT", "hosts" : "c6403.ambari.apache.org" }] }
If you want to see which hosts the component is installed.
Code Block GET /api/v1/clusters/MyCluster/components/TEST_CLIENT