Versions Compared

Key

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

...

  1. Add components to hosts. The components will show up on the Ambari web UI in the host view with the  Install Pending...  state.

    Code Block
    languagebash
    curl -v -k -i -u admin:admin -H 'X-Requested-By: ambari' -X POST -d '
    {
      "RequestInfo":{
        "query":"Hosts/host_name.in(c6401.ambari.apache.org,c6402.ambari.apache.org,c6403.ambari.apache.org)"
      },
      "Body":{
        "host_components":[
        {
          "HostRoles":{
            "component_name":"HBASE_REGIONSERVER"
          }
        },
        {
          "HostRoles":{
            "component_name":"DATANODE"
          }
        },
        {
          "HostRoles":{
            "component_name":"TEZ_CLIENT"
          }
        }
        ]
      }
    }' $HTTP_PROTOCOL://$CONSOLE_NODE:$PORT/api/v1/clusters/$CLUSTER/hosts 
  2. Install components on hosts

    Code Block
    languagebash
    curl -v -k -i -u admin:admin -H 'X-Requested-By: ambari' -X PUT --data '
    {
       "RequestInfo":{
          "context":"Install components on hosts"
       },
       "Body":{
          "HostRoles":{
             "state":"INSTALLED"
          }
       }
    }' "$HTTP_PROTOCOL://$CONSOLE_NODE:$PORT/api/v1/clusters/$CLUSTER/host_components?HostRoles/component_name.in(DATANODE,HBASE_REGIONSERVER,TEZ_CLIENT)&HostRoles/host_name.in(c6401.ambari.apache.org,c6402.ambari.apache.org,c6403.ambari.apache.org)" 
    

    Alternatively, you can kick off an install of components via a bit more implicit REST API call that kicks off installation on all  hosts.

    Code Block
    languagebash
    curl -v -k -i -u admin:admin -H 'X-Requested-By: ambari' -X PUT -d '
    { "HostRoles": { "state":"INSTALLED" } }
    ' $HTTP_PROTOCOL://$CONSOLE_NODE:$PORT/api/v1/clusters/$CLUSTER/host_components?HostRoles/state=INIT
    
  3. Start components on hosts

    Code Block
    languagebash
    curl -v -k -i -u admin:admin -H 'X-Requested-By: ambari' -X PUT --data '
    {
       "RequestInfo":{
          "context":"Start components on hosts"
       },
       "Body":{
          "HostRoles":{
             "state":"STARTED"
          }
       }
    }' "$HTTP_PROTOCOL://$CONSOLE_NODE:$PORT/api/v1/clusters/$CLUSTER/host_components?HostRoles/component_name.in(DATANODE,HBASE_REGIONSERVER,TEZ_CLIENT)&HostRoles/host_name.in(c6401.ambari.apache.org,c6402.ambari.apache.org,c6403.ambari.apache.org)" 

...