This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Skip to end of metadata
Go to start of metadata

To restart host components on a given host, you can issue a request to execute the RESTART command for a list of components in the Requests/resource_filters object.

POST http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/requests

{
  "RequestInfo":{
      "command":"RESTART",
      "context":"Restart all components on c6401.ambari.apache.org",
      "operation_level":{"level":"HOST","cluster_name":"MyCluster"}
    },
    "Requests/resource_filters":[
      {"service_name":"YARN","component_name":"APP_TIMELINE_SERVER","hosts":"c6401.ambari.apache.org"},
      {"service_name":"HDFS","component_name":"DATANODE","hosts":"c6401.ambari.apache.org"},
      {"service_name":"HIVE","component_name":"HCAT","hosts":"c6401.ambari.apache.org"},
      {"service_name":"HDFS","component_name":"HDFS_CLIENT","hosts":"c6401.ambari.apache.org"},
      {"service_name":"MAPREDUCE2","component_name":"HISTORYSERVER","hosts":"c6401.ambari.apache.org"},
      {"service_name":"HIVE","component_name":"HIVE_CLIENT","hosts":"c6401.ambari.apache.org"},
      {"service_name":"HIVE","component_name":"HIVE_METASTORE","hosts":"c6401.ambari.apache.org"},
      {"service_name":"HIVE","component_name":"HIVE_SERVER","hosts":"c6401.ambari.apache.org"},
      {"service_name":"MAPREDUCE2","component_name":"MAPREDUCE2_CLIENT","hosts":"c6401.ambari.apache.org"},
      {"service_name":"AMBARI_METRICS","component_name":"METRICS_COLLECTOR","hosts":"c6401.ambari.apache.org"},
      {"service_name":"AMBARI_METRICS","component_name":"METRICS_MONITOR","hosts":"c6401.ambari.apache.org"},
      {"service_name":"HIVE","component_name":"MYSQL_SERVER","hosts":"c6401.ambari.apache.org"},
      {"service_name":"HDFS","component_name":"NAMENODE","hosts":"c6401.ambari.apache.org"},
      {"service_name":"YARN","component_name":"NODEMANAGER","hosts":"c6401.ambari.apache.org"},
      {"service_name":"PIG","component_name":"PIG","hosts":"c6401.ambari.apache.org"},
      {"service_name":"YARN","component_name":"RESOURCEMANAGER","hosts":"c6401.ambari.apache.org"},
      {"service_name":"HDFS","component_name":"SECONDARY_NAMENODE","hosts":"c6401.ambari.apache.org"},
      {"service_name":"TEZ","component_name":"TEZ_CLIENT","hosts":"c6401.ambari.apache.org"},
      {"service_name":"HIVE","component_name":"WEBHCAT_SERVER","hosts":"c6401.ambari.apache.org"},
      {"service_name":"YARN","component_name":"YARN_CLIENT","hosts":"c6401.ambari.apache.org"},
      {"service_name":"ZOOKEEPER","component_name":"ZOOKEEPER_CLIENT","hosts":"c6401.ambari.apache.org"},
      {"service_name":"ZOOKEEPER","component_name":"ZOOKEEPER_SERVER","hosts":"c6401.ambari.apache.org"}
    ]
}

 

To build the list of host components to use in this command, you can first get a list of components on a given host:

GET http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/hosts/c6401.ambari.apache.org/host_components?fields=HostRoles/service_name

 

This will return a list of host component objects. You can use the HostRoles/component_name, HostRoles/host_name and HostRoles/service_name in your RESTART command.

    {
      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/hosts/c6401.ambari.apache.org/host_components/APP_TIMELINE_SERVER",
      "HostRoles" : {
        "cluster_name" : "MyCluster",
        "component_name" : "APP_TIMELINE_SERVER",
        "host_name" : "c6401.ambari.apache.org",
        "service_name" : "YARN"
      },
      "host" : {
        "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/hosts/c6401.ambari.apache.org"
      }
    },
    {
      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/hosts/c6401.ambari.apache.org/host_components/DATANODE",
      "HostRoles" : {
        "cluster_name" : "MyCluster",
        "component_name" : "DATANODE",
        "host_name" : "c6401.ambari.apache.org",
        "service_name" : "HDFS"
      },
      "host" : {
        "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/hosts/c6401.ambari.apache.org"
      }
    },
  • No labels