Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Service Names are Random in Director provisioned Cluster

avatar
Explorer

After provisioned the cluster via Cloudera Director, all the service names appear to be random:

e.g. "CD-ZOOKEEPER-ftOlmEAM": 

 

..../api/v13/clusters/[cluster_name]/services/

... 
{ "name" : "CD-ZOOKEEPER-ftOlmEAM", "type" : "ZOOKEEPER", "clusterRef" : { "clusterName" : "platform-pod1-dev-cdh" }, "serviceUrl" : "http://ip-10-0-1-121.us-west-2.compute.internal:7180/cmf/serviceRedirect/CD-ZOOKEEPER-ftOlmEAM", "roleInstancesUrl" : "http://ip-10-0-1-121.us-west-2.compute.internal:7180/cmf/serviceRedirect/CD-ZOOKEEPER-ftOlmEAM/instances", "serviceState" : "STARTED", "healthSummary" : "GOOD", "healthChecks" : [ { "name" : "ZOOKEEPER_CANARY_HEALTH", "summary" : "GOOD", "suppressed" : false }, { "name" : "ZOOKEEPER_SERVERS_HEALTHY", "summary" : "GOOD", "suppressed" : false } ], "configStalenessStatus" : "FRESH", "clientConfigStalenessStatus" : "FRESH", "maintenanceMode" : false, "maintenanceOwners" : [ ], "displayName" : "ZOOKEEPER-1", "entityStatus" : "GOOD_HEALTH" }
...

 

v.s. cluster provisioned via Cloudera Manager wizzard, the service name is very predictable...

 

{
  "items" : [ {
    "name" : "zookeeper",
    "type" : "ZOOKEEPER",
    "clusterRef" : {
      "clusterName" : "cluster"
    },
    "serviceUrl" : "http://ip-10-110-1-204.ec2.internal:7180/cmf/serviceRedirect/zookeeper",
    "serviceState" : "STARTED",
    "healthSummary" : "GOOD",
    "healthChecks" : [ {
      "name" : "ZOOKEEPER_CANARY_HEALTH",
      "summary" : "GOOD"
    }, {
      "name" : "ZOOKEEPER_SERVERS_HEALTHY",
      "summary" : "GOOD"
    } ],
    "configStale" : false,
    "maintenanceMode" : false,
    "maintenanceOwners" : [ ],
    "displayName" : "ZooKeeper"
  }

 

This makes it very difficult to build automation around Manager REST APIs. For example, download client-conif: 

 

http://cloudera.github.io/cm_api/apidocs/v13/path__clusters_-clusterName-_services_-serviceName-_cli...

 

Is there any way to config this in Director's cluster config or rename the service after provisioning?

1 ACCEPTED SOLUTION

avatar
Expert Contributor

WZ,

 

Service names must be globally unique in Cloudera Manager. Director appends random characters to ensure that this uniqueness when creating services in case there are multiple clusters created under the same Cloudera Manager. There is no way to turn off this randomization in Director at the moment and there is no way to rename a service in Cloudera Manager (you can rename the display name only).

 

Since Director supports only a single instance of each service type, you can retrieve the list of services from Cloudera Manager and create a mapping from service type to service name for your cluster.

 

In bash, you can use jq to process the service list to retrieve the service names.

$ curl -u cmusername:cmpassword http://<cmhost>:7180/api/v15/clusters/<clustername>/services | jq -r '.items[] | "export \(.type)=\(.name)"' > export_service_names.sh
$ cat export_service_names.sh 
export ZOOKEEPER=CD-ZOOKEEPER-asdna2f

you can then script against well known servicename variables by sourcing this export_service_names.sh script.

 

You can similarly retrieve the service names using the java client or python client.

 

 

View solution in original post

2 REPLIES 2

avatar
Expert Contributor

WZ,

 

Service names must be globally unique in Cloudera Manager. Director appends random characters to ensure that this uniqueness when creating services in case there are multiple clusters created under the same Cloudera Manager. There is no way to turn off this randomization in Director at the moment and there is no way to rename a service in Cloudera Manager (you can rename the display name only).

 

Since Director supports only a single instance of each service type, you can retrieve the list of services from Cloudera Manager and create a mapping from service type to service name for your cluster.

 

In bash, you can use jq to process the service list to retrieve the service names.

$ curl -u cmusername:cmpassword http://<cmhost>:7180/api/v15/clusters/<clustername>/services | jq -r '.items[] | "export \(.type)=\(.name)"' > export_service_names.sh
$ cat export_service_names.sh 
export ZOOKEEPER=CD-ZOOKEEPER-asdna2f

you can then script against well known servicename variables by sourcing this export_service_names.sh script.

 

You can similarly retrieve the service names using the java client or python client.

 

 

avatar
Explorer
makes sense. thanks a lot!