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.

Having issues when adding CDH service using Cloudera API

Having issues when adding CDH service using Cloudera API

New Contributor

Trying to build a CDH cluster using Cloudera Manager API, as part of this, started adding as Zookeeper as a first service to the cluster.

I was able to add Zookeeper service with one instance/server successfully using the below json/payload and curl command.

curl -X POST -H "Content-Type: application/json" -d @file.json 'http://user:password@cm-host:7180/api/v12/clusters/test/services'

{
"items": [ {
"name": "zookeeper",
"type": "ZOOKEEPER",
"clusterRef": {
"clusterName": "test"
},
"roles": [{
"name": "zookeeper",
"type": "SERVER",
"hostRef": {"hostId": "Zookeeper-host-id-1"}
}]
}
]
}

But, Getting the below when adding/deploying service to second/another instance using the above curl command and JSON payload. I did make sure that host-id is different when adding this time.

{
"message" : "ORA-00001: unique constraint (SCM.UNIQUE_SRV_NAME) violated\n"
}

Do not want to deploy role to the all hosts to the same time, wanted to have flexibility in adding/deploying role to other instaces when needed. 

Thank you.

3 REPLIES 3

Re: Having issues when adding CDH service using Cloudera API

Community Manager

Hi,

 

Looks like you are adding zookeeper roles which you can use different api call:
http://cm-host:7180/api/v12/clusters/test/services/zookeeper/roles

 

You may want to check the documentation link here:
https://cloudera.github.io/cm_api/apidocs/v12/tutorial.html

 

Thanks and hope this helps,

Li

Li Wang, Technical Resolution Manager


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

Learn more about the Cloudera Community:

Terms of Service

Community Guidelines

How to use the forum

Re: Having issues when adding CDH service using Cloudera API

New Contributor

Thank you, I was able to add service, roles and then confiuration changes.

 

Can you please share information on this,

 

1. I am getting the below error message when I try to use API version "v16" in the URL, http://cm-host:7180/api/v16/clusters/test/services/HDFS/config

{"message": "Role type configuration is supported only up to API v2."}

What is the latest/alternative for "Role type configuration" in V16 or latest API versions for CDH 5.x

Json/payload used is: 

 

{
"roleTypeConfigs" :
[ {
"roleType" : "NAMENODE",
"items" : [
{
"name" : "dfs_name_dir_list",
"value" : "/opt/cloudera/dfs/nn"
},
{
"name" : "oom_heap_dump_enabled",
"value" : "false"
}
]
}
]
}

 

2. As per CM console, the parameter(s) for NameNode Data Directories is dfs.name.dir, dfs.namenode.name.dir but none of them worked and I was getting "unknown" parameter error. Instead, I had to use "dfs_name_dir_list". Is there any link/document where it listed these paramter names to be used in JSON payload.

 

 

Re: Having issues when adding CDH service using Cloudera API

New Contributor

I was trying enable "HDFS Trash" but API was not accepting the parameter names that tried using JSON/payload.

I tried, use_trash and Use_Trash

{
"roleType" : "GATEWAY",
"items" : [ {
"name" : "Use_Trash",
"value" : "true"
} ]
}