Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to update safety-valve configurations using java

How to update safety-valve configurations using java

Explorer

Hi,

 

How do i put the safety valve properties without using cloudera ui. I have not used cloudera-manager api java version.

 

Does any one tried earlier? Any pointers on the tutorials about the java version to update safety valve without UI. 

Thank you very much for the help in advance.

 

Thanks & Regards,

Sandeep B A

 

PS:Since i'm managing my cluster using cloudera manager. I don't want to use UI.

5 REPLIES 5

Re: How to update safety-valve configurations using java

Hi Sandeep,

You can update a safey valve just like any other property in the API. Take a look at the full configuration view for your service or role config group to discover all of the possible configuration options, then update the appropriate one. Safety valves pretty much always have "safety_valve" in the configuration name. Make sure you pass in a valid XML fragment for hadoop xml safety valves.

When using the Java API, be sure to always fetch objects using the appropriate Resource object. Data model objects like ApiCluster are usually only shallowly populated, so if you do ((ApiCluster) cluster).getServices().get(0).getRoles(), you'll get a Null Pointer Exception.

 

Instead do something like this:

    ClustersResource clustersResource = apiRoot.getClustersResource();

    for (ApiCluster cluster : clustersResource.readClusters(DataView.SUMMARY)) {
      ServicesResource servicesResource =
          clustersResource.getServicesResource(cluster.getName());
      for (ApiService service : servicesResource.readServices(DataView.SUMMARY)) {
      ...

 There's some basic information about using the Java API here:

http://cloudera.github.io/cm_api/

 

Thanks,

Darren

 

Re: How to update safety-valve configurations using java

Explorer
Hi Darren,

Thanks for the help. I will try to follow the suggested method by you and in case encounter any problems will get back.

I was interested in adding safety valve to hbase-site.xml and reboot the cluster using api and deploy client configuration. Since you have given hint will try to walk through the api documentation and see if i can figure out this.

Thanks & Regards,
Sandeep B A

Re: How to update safety-valve configurations using java

Explorer
Meaning for HBase to add server side configurations using cloudera api.

Re: How to update safety-valve configurations using java

Hi Sandeep,

 

You can check ApiService.setConfig(ApiServiceConfig config) method and after setting service configuration set it back in your ApiCluster object. You can deploy configuration of any service (in your case its hbase) in this way.

 

Better you check Python API which CM-API provides. Python api has all functions in it.

 

Best Regards,

Chirag Patadia.

Regards,
Chirag Patadia.

Re: How to update safety-valve configurations using java

New Contributor

Hi,
I was also in need of a similar requirement to read the safety valve properties of hbase configurations using cloudera Java API, preferably as I am not much comfortable with python.My cloudera manager version is 4.8 enterprise trial. My findings until now is as follows:
1. The config object which I get from HBaseConfiguration.create(),unfortunately it has most of the config properties exept those of safety valve ones.
2. I even tried what Chirag had mentioned " ApiService.setConfig(ApiServiceConfig config) method and after setting service configuration set it back in your ApiCluster object". This did not set the safety valve property on hbase. I tested this with service restart and deploy-client-configuration on Cloudera manager-UI as well.

For example:
I need to update :
<property>
<name>hbase.ipc.client.tcpnodelay</name>
<value>true</value>
</property>
property on safety valves available on hbase config page on cloudera manager UI.

Anyone, Please share any thoughts how do I go about reading and updating the safety valve properties of Hbase.

Thanks for the help,
Guru

Don't have an account?
Coming from Hortonworks? Activate your account here