Using the Cloudera Manager API to Set Advanced Configuration Snippets (Safety Valves)

You can use the Cloudera Manager API to set service configuration properties.

You must have network access to the Cloudera Manager Admin Console.
  1. Find the name of the configuration property.
    1. Go to the Cloudera Manager Configuration Property Reference and navigate to the page for the Cloudera Runtime version and service you want to configure.
    2. Search through the page for the Advanced Configuration Snippet property.
    3. Copy the value of the API Name.
  2. Log into a host with network access to the Cloudera Manager Admin Console using ssh, and run the following command:
    curl -X PUT -u username:password "Cloudera_Manager_server_name:Cloudera_Manager_server_port/api/v49/clusters/Cluster_name/services/service_name/config" -H  "accept: application/json" -H  "Content-Type: application/json" -d '{  \"items\": [        {      \"name\": \"API-Name\",      \"value\": \"name=value\",      \"sensitive\": false    }  ]}'
    The following command changes the value of the HDFS Replication Environment Advanced Configuration Snippet (Safety Valve) in the HDFS-1 service in Cluster 1 to test=2:
    curl -X PUT -u admin:admin "http://myCMserver.com:7180/api/v49/clusters/Cluster%201/services/HDFS-1/config" -H  "accept: application/json" -H  "Content-Type: application/json" -d '{  \"items\": [        {      \"name\": \"hdfs_replication_env_safety_valve\",      \"value\": \"HDFSConfigProperty=2\",      \"sensitive\": false    }  ]}'
The configuration value has been changed.