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.

CM API enable_nn_ha "Could not find NameNode"

Solved Go to solution
Highlighted

CM API enable_nn_ha "Could not find NameNode"

Explorer

I'm using the python CM API to try and enable HDFS HA on my cluster:

 

hdfs_service.enable_nn_ha(active_name=hdfs_nn_host, nameservice="nameservice1",
standby_host_id=api.get_host(hdfs_snn_host).hostId, jns=journal_nodes,
zk_service_name=ZOOKEEPER_SERVICE_NAME, force_init_znode=True,
clear_existing_standby_name_dirs=True, clear_existing_jn_edits_dir=True).wait()

 

This command leads to the error:

 

cm_api.api_client.ApiException: Could not find NameNode with name 'host1'

 

where host1 is the name of host running the NameNode service as shown by Cloudera Manager.  My question around the active_name parameter to this function is what actual value is the CM API looking for?  I've tried supplying the hostId value for this node as well, with no luck.  My HDFS service is up/running healthy as I am able to do all hdfs dfs * commands.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: CM API enable_nn_ha "Could not find NameNode"

Super Collaborator

It's expecting the role/instance name of your NN, you can retrieve that by 

 

example code using python

from cm_api.api_client import ApiResource

api = ApiResource(server_host="nightly57-1.gce.cloudera.com")

#assuming your cluster name is 'Cluster 1' and hdfs service name is 'HDFS-1'

NameNodes = api.get_cluster("Cluster 1").get_service("HDFS-1").get_roles_by_type("NAMENODE")

print [instance.name for instance in NameNodes]

# sample stdout 

[u'HDFS-1-NAMENODE-51999a2564364e0f3a6a74def356741b', u'HDFS-1-NAMENODE-46bf2f74734fa565bb829ef019ff4a2d']

 

Alternatively, open your browser to http://cm_server:port/api/v6/clusters/{clusterName}/services/{HdfsServiceName}/roles

 

 

...
"items" : [ { "name" : "HDFS-1-NAMENODE-51999a2564364e0f3a6a74def356741b", <=== this "type" : "NAMENODE",
...

see:

https://cloudera.github.io/cm_api/apidocs/v11/path__clusters_-clusterName-_services_-serviceName-_ro...

 

 

View solution in original post

2 REPLIES 2

Re: CM API enable_nn_ha "Could not find NameNode"

Super Collaborator

It's expecting the role/instance name of your NN, you can retrieve that by 

 

example code using python

from cm_api.api_client import ApiResource

api = ApiResource(server_host="nightly57-1.gce.cloudera.com")

#assuming your cluster name is 'Cluster 1' and hdfs service name is 'HDFS-1'

NameNodes = api.get_cluster("Cluster 1").get_service("HDFS-1").get_roles_by_type("NAMENODE")

print [instance.name for instance in NameNodes]

# sample stdout 

[u'HDFS-1-NAMENODE-51999a2564364e0f3a6a74def356741b', u'HDFS-1-NAMENODE-46bf2f74734fa565bb829ef019ff4a2d']

 

Alternatively, open your browser to http://cm_server:port/api/v6/clusters/{clusterName}/services/{HdfsServiceName}/roles

 

 

...
"items" : [ { "name" : "HDFS-1-NAMENODE-51999a2564364e0f3a6a74def356741b", <=== this "type" : "NAMENODE",
...

see:

https://cloudera.github.io/cm_api/apidocs/v11/path__clusters_-clusterName-_services_-serviceName-_ro...

 

 

View solution in original post

Highlighted

Re: CM API enable_nn_ha "Could not find NameNode"

Explorer

Thanks - that worked!

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