Support Questions
Find answers, ask questions, and share your expertise

Error "Requested URL not found" while creating cluster using CM-api

Error "Requested URL not found" while creating cluster using CM-api

New Contributor

Hi All,

I have been trying to use the CM-api python client to create the cluster. As i have already pushed the cloudera onto the 5 nodes using the Puppet tool and the services cloudera-scm-server/agent/server-db are running, But i am facing issues to create the cluster by modifying the example file given in  "https://github.com/cloudera/cm_api/blob/master/python/examples/cluster_set_up.py". 

 

I have modified the file with parameters and hostnames as shown below. And i am executing "python clustersetup.py" from one of the nodes by storing modified example file in it.

cm_host = "n6.hadoop.com"
cm_port = 7180
host_list = ['n6.hadoop.com', 'n1.hadoop.com', 'n2.hadoop.com', 'n4.hadoop.com']
cluster_name = "Cluster 1"
cdh_version = "CDH5" 
cdh_version_number = "5.4.5" 
hive_metastore_host = "n6.hadoop.com"
hive_metastore_name = "hive"
hive_metastore_password = "admin" 
hive_metastore_database_type = "postgresql"
hive_metastore_database_port = 7432
reports_manager_host = "n6.hadoop.com"
reports_manager_name = "reports_manager"
reports_manager_username = "rman"
reports_manager_password = "admin" 
reports_manager_database_type = "postgresql"
cm_username = "admin"
cm_password = "admin"
cm_service_name = "mgmt"
host_username = "root"
host_password = "cloudera"
cm_repo_url =  None
# cm_repo_url = "deb http://archive.cloudera.com/cm5/ubuntu/lucid/amd64/cm/ lucid-cm5 contrib" # OPTIONAL: only if you want to use a specific repo; this is specific to Debian

 

Error i am facing is 

[root@n2 ~]# python clustersetup.py
Traceback (most recent call last):
  File "clustersetup.py", line 238, in <module>
    main()
  File "clustersetup.py", line 235, in main
    set_up_cluster()
  File "clustersetup.py", line 62, in set_up_cluster
    cm.begin_trial()
  File "/usr/lib/python2.6/site-packages/cm_api/endpoints/cms.py", line 451, in begin_trial
    self._post("trial/begin", None, api_version=6)
  File "/usr/lib/python2.6/site-packages/cm_api/endpoints/types.py", line 362, in _post
    api_version)
  File "/usr/lib/python2.6/site-packages/cm_api/endpoints/types.py", line 380, in _call
    api_version)
  File "/usr/lib/python2.6/site-packages/cm_api/endpoints/types.py", line 139, in call
    ret = method(path, params=params)
  File "/usr/lib/python2.6/site-packages/cm_api/resource.py", line 148, in post
    self._make_headers(contenttype))
  File "/usr/lib/python2.6/site-packages/cm_api/resource.py", line 73, in invoke
    headers=headers)
  File "/usr/lib/python2.6/site-packages/cm_api/http_client.py", line 174, in execute
    raise self._exc_class(ex)
cm_api.api_client.ApiException: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!--
 /*
 Stylesheet for Squid Error pages
 Adapted from design by Free CSS Templates
 http://www.freecsstemplates.org
 Released for free under a Creative Commons Attribution 2.5 License
*/

/* Page basics */
* {
        font-family: verdana, sans-serif;
}

html body {
        margin: 0;
        padding: 0;
        background: #efefef;
        font-size: 12px;
        color: #1e1e1e;
}

/* Page displayed title area */
#titles {
        margin-left: 15px;
        padding: 10px;
        padding-left: 100px;
        background: url('http://www.squid-cache.org/Artwork/SN.png') no-repeat left;
}

/* initial title */
#titles h1 {
        color: #000000;
}
#titles h2 {
        color: #000000;
}

/* special event: FTP success page titles */
#titles ftpsuccess {
        background-color:#00ff00;
        width:100%;
}

/* Page displayed body content area */
#content {
        padding: 10px;
        background: #ffffff;
}

/* General text */
p {
}

/* error brief description */
#error p {
}

/* some data which may have caused the problem */
#data {
}

/* the error message received from the system or other software */
#sysmsg {
}

pre {
    font-family:sans-serif;
}

/* special event: FTP / Gopher directory listing */
#dirmsg {
    font-family: courier;
    color: black;
    font-size: 10pt;
}
#dirlisting {
    margin-left: 2%;
    margin-right: 2%;
}
#dirlisting tr.entry td.icon,td.filename,td.size,td.date {
    border-bottom: groove;
}
#dirlisting td.size {
    width: 50px;
    text-align: right;
    padding-right: 5px;
}

/* horizontal lines */
hr {
        margin: 0;
}

/* page displayed footer area */
#footer {
        font-size: 9px;
        padding-left: 10px;
}


body
:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }
:lang(he) { direction: rtl; float: right; }
 --></style>
</head><body>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>

<div id="content">
<p><b>Invalid Request</b> error was encountered while trying to process the request:</p>

<blockquote id="data">
<pre>POST /api/v10/cm/trial/begin HTTP/1.1
Accept-Encoding: identity
Host: n1.hadoop.com:7180
Content-Type: application/json
Connection: close
User-Agent: Python-urllib/2.6
</pre>
</blockquote>

<p>Some possible problems are:</p>
<ul>
<li><p>Missing or unknown request method.</p></li>
<li><p>Missing URL.</p></li>
<li><p>Missing HTTP Identifier (HTTP/1.0).</p></li>
<li><p>Request is too large.</p></li>
<li><p>Content-Length missing for POST or PUT requests.</p></li>
<li><p>Illegal character in hostname; underscores are not allowed.</p></li>
<li><p>HTTP/1.1 <q>Expect:</q> feature is being asked from an HTTP/1.0 software.</p></li>
</ul>

<p>Your cache administrator is <a href="mailto:root?subject=CacheErrorInfo%20-%20ERR_INVALID_REQ&amp;body=CacheHost%3A%20tslinux01%0D%0AErrPage%3A%20ERR_INVALID_REQ%0D%0AErr%3A%20%5Bnone%5D%0D%0ATimeStamp%3A%20Mon,%2012%20Oct%202015%2014%3A28%3A38%20GMT%0D%0A%0D%0AClientIP%3A%2010.223.1.31%0D%0A%0D%0AHTTP%20Request%3A%0D%0APOST%20%2Fapi%2Fv10%2Fcm%2Ftrial%2Fbegin%20HTTP%2F1.1%0AAccept-Encoding%3A%20identity%0D%0AHost%3A%20n1.hadoop.com%3A7180%0D%0AContent-Type%3A%20application%2Fjson%0D%0AConnection%3A%20close%0D%0AUser-Agent%3A%20Python-urllib%2F2.6%0D%0A%0D%0A%0D%0A">root</a>.</p>
<br>
</div>

<hr>
<div id="footer">
<p>Generated Mon, 12 Oct 2015 14:28:38 GMT by tslinux01 (squid/3.1.10)</p>
<!-- ERR_INVALID_REQ -->
</div>
</body></html>
 (error 411)

Please help me to fix this.

4 REPLIES 4

Re: Error "Requested URL not found" while creating cluster using CM-api

Explorer

did you manage to resolve the issue? I'm facing the same problem with cdh5.5

Re: Error "Requested URL not found" while creating cluster using CM-api

New Contributor

No luck. I am still facing the issues. Did u try using any other versions?

Re: Error "Requested URL not found" while creating cluster using CM-api

I'm guessing that the installed CM version is not the latest, so the v10 endpoint doesn't exist. To fix this, you can specify the API version that the python client bindings will use, or just download an older version of the python client bindings.
https://github.com/cloudera/cm_api/blob/master/python/src/cm_api/api_client.py#L58

The python client bindings will default to the latest API version at the time the client was published.

Re: Error "Requested URL not found" while creating cluster using CM-api

Explorer

I'm using the latest CM, re-submitting the ApiResource call with version 10 and this is now working for me:

api = ApiResource(cm_host, cm_port, cm_username, cm_password, version=10)

 

thanks Darren