To migrate Grafana to another host, first we need to remove the Grafana service from one node and then need to re-install it on another node. We can do the below steps:
1. Take backup of Ambari Database
2. Add the component to a new Node using the following API:
curl --user username:password -H 'X-Requested-By: ambari' -i -X POST http://AMBARI_SERVER_HOST:8080/api/v1/clusters/CLUSTER_NAME/hosts/NEW_HOST_NAME/host_components/COMPONENTNAME
For Example, to add Grafana:
curl --user admin:admin -H 'X-Requested-By: ambari' -i -X POST http://<ambari-server-host>:8080/api/v1/clusters/MyLabCluster/hosts/SecondLabNode02.cloudera.com/host_components/METRICS_GRAFANA
3. Go to Ambari Hosts tab and click on the node where the Component has been added using the above API
4. The current status of the Component would be Install Pending
5. Click on Install Pending and select Re-intall to complete the installation
6. Once the above is completed, Start the service using Ambari Service UI.
7. Stop the Service using Ambari Service UI. ( Grafana service on old Host )
8. Remove the component using the following Ambari API call:
curl -u username:password -H 'X-Requested-By: ambari' -X DELETE http://AMBARI_SERVER_HOST:8080/api/v1/clusters/CLUSTER_NAME/hosts/OLD_HOSTNAME/host_components/COMPONENTNAME
For example, if Grafana is to be removed,
curl --user admin:admin -H 'X-Requested-By: ambari' -X DELETE http://<ambari-server-host>:8080/api/v1/clusters/MyLabCluster/hosts/FirstLabNode01.cloudera.com/host_components/METRICS_GRAFANA