Versions Compared

Key

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

...

  1. Add the Service to the Cluster.

    Code Block
    POST
    /api/v1/clusters/MyCluster/services
    
    {
    "ServiceInfo": {
      "service_name":"TESTSRV"
      }
    }
  2. 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
    
  3. Install the component on a hostall target hosts. For example, on the to install on c6402.ambari.apache.org and c6403.ambari.apache.org host, first create the component resource, then have Ambari install the component. This will end up calling host_component resource on the hosts using POST.

    Code Block
    POST
    /api/v1/clusters/MyCluster/hosts/c6402.ambari.apache.org/host_components/TEST_CLIENT
    
    POST
    /api/v1/clusters/MyCluster/hosts/c6403.ambari.apache.org/host_components/TEST_CLIENT
  4. Now have Ambari install the components on all hosts. In this single command, you are instructing Ambari to install all components related to the service. This call the install() method in the command script on each host.

    Code Block
    POSTPUT
    /api/v1/clusters/MyCluster/hosts/c6403services/TESTSRV
    
    {
      "RequestInfo": {
        "context": "Install Test Srv Client"
      },
      "Body": {
        "ServiceInfo": {
          "state": "INSTALLED"
        }    
      }
    }    
    
  5. Alternatively, instead of installing all components at the same time, you can explicitly install each host component. In this example, we will explicitly install the TEST_CLIENT on c6402.ambari.apache.org

    /host_components/TEST_CLIENT

    :

    Code Block
    PUT
    /api/v1/clusters/MyCluster/hosts/c6403c6402.ambari.apache.org/host_components/TEST_CLIENT
    
    {
      "RequestInfo": {
        "context":"Install Test Srv Client"
      },
         "Body": {
          "HostRoles": {
            "state":"INSTALLED"
          }
       }
    }
  6. 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"
      }]
    }
  7. If you want to see which hosts the component is installed.

    Code Block
    GET
    /api/v1/clusters/MyCluster/components/TEST_CLIENT