How you have chosen to install the HDP component across the hosts is unique to your cluster. Before upgrading HDP, use the Ambari Web Hosts and Services tabs to determine the components installed on each host. For more information about using Ambari Web, see the Ambari User’s Guide sections Working with Hosts and Viewing Components on a Host. Be sure to record the location of all components, including master components (such as NameNode, ResourceManager, etc) and slave components (such as DataNodes, NodeManagers, etc).
Another option is to use the Ambari REST API and export the list of hosts and their associated components in json format.
http://
ambari.server:8080/api/v1/clusters/
cluster.name/hosts?fields=host_components
where ambari.server is the Ambari Server host and cluster.name is your cluster name.