Created on 05-02-2016 10:01 AM - edited 09-16-2022 03:16 AM
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.
Created 05-05-2016 05:01 PM
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:
Created 05-05-2016 05:01 PM
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:
Created 05-06-2016 05:07 AM
Thanks - that worked!