如何修改Ambari API将Hive View集群配置设为Custom选项
Hey there, I’ve dealt with this exact Ambari 2.5.x quirk before! The root issue with your current API request is that you’re missing the critical property that triggers the switch from "Local Cluster" to "Custom" mode in the Hive View settings.
The Key Fix: Add Cluster Mode Properties
To force the view to use the Custom configuration, you need to add two essential properties to the properties section of your payload:
cluster.config.mode: Set this to"CUSTOM"— this is the toggle that flips the radio button from Local to Customcluster.name: Specify your Ambari cluster name (you can grab this from the Ambari UI header, e.g.,my-cluster)
Modified Curl Command
Here’s the updated API request with these properties included:
curl --user admin:admin -i -H 'X-Requested-By: ambari' -X PUT http://localhost:8080/api/v1/views/HIVE/versions/1.5.0/instances/AUTO_HIVE_INSTANCE --data '{ "ViewInstanceInfo" : { "description" : "This view instance is auto created when the Hive service is added to a cluster.", "instance_name" : "AUTO_HIVE_INSTANCE", "label" : "Hive View", "view_name" : "HIVE", "version" : "1.5.0", "visible" : true, "properties" : { "cluster.config.mode": "CUSTOM", "cluster.name": "your-cluster-name", "hdfs.auth_to_local" : null, "hdfs.umask-mode" : "022", "hive.jdbc.url" : "jdbc:hive2://localhost:10000/", "hive.ldap.configured" : "false", "hive.metastore.warehouse.dir" : "/apps/hive/warehouse", "hive.session.params" : "transportMode=binary;hive.server2.proxy.user=${username};user=admin;password=password;", "jobs.dir" : "/user/admin/hive/jobs", "scripts.dir" : "/user/admin/hive/scripts", "scripts.settings.defaults-file" : "/user/admin/.${instanceName}.defaultSettings", "webhdfs.auth" : "", "webhdfs.url" : "webhdfs://localhost:50070", "webhdfs.username" : "admin", "yarn.ats.url" : "http://localhost:8188", "yarn.resourcemanager.url" : "http://localhost:8088" } } }'
Why This Works
In Ambari 2.5.x, the cluster.config.mode property directly controls the view’s cluster configuration mode:
"LOCAL"(the default) keeps it locked to the "Local Cluster" option"CUSTOM"switches it to the "Custom" radio button, enabling the manual cluster properties you’ve defined
Verification
After sending this updated request, log into your Ambari UI, navigate to the Hive View’s configuration page, and you should see the "Custom" option selected automatically.
内容的提问来源于stack exchange,提问作者HP.

