Nitin Kumar Nitin Kumar - 1 year ago 112
SQL Question

Restarting a MySQL server managed by Ambari

I have a scenario where I need to change several parameters of a hadoop cluster managed by Ambari to document performance of a particular application. The change in the configs entails a restart of the affected components.

I am using the Ambari REST API for achieving this. I figured out how to do this for all service components of hadoop. I' am not sure whether the API provides a way to restart the MySQL server that Hive uses.

I have the following questions:-

  1. Is it the case that a mere stop and start of mysqld on the appropriate machine is enough to ensure that the required configuration changes are recognized by Ambari and the application?

  2. I chose the 'New MySQL database' option while installing Hive via Ambari. Does this mean that restarts are reflected in Ambari only when it is carried out from the Ambari UI?

Your inputs would be highly appreciated.



Found a solution to the problem. I used the following commands using the Ambari REST API for changing configurations and restarting services from the backend.

Login to the host on which the ambari server is running and use the already provided script as described below.

Modifying configuration files


/var/lib/ambari-server/resources/scripts/ -port <ambari-server-port> set localhost $1 $2 "$3" "$4"

where CONFIG_FILE can take values like tez-site, mapred-site, hadoop-site, hive-site etc. PROPERTY_NAME and PROPERTY_VALUE should be set to values relevant to the specified CONFIG_FILE.

Restarting host components

curl -uadmin:admin -H 'X-Requested-By: ambari' -X POST -d '
      "context":"Restart MySQL server used by Hive Metastore on and HDFS client on",
}' http://localhost:<ambari-server-port>/api/v1/clusters/c1/requests

Reference Links:

  1. Restarting components
  2. modifying configurations

Hope this helps!