Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Apply host template - Host must have a single version of CDH installed

Expert Contributor

While attempting to apply a host template, I keep running into this error/notification:

 

Host must have a single version of CDH installed

 

I didn't notice multiple cm agents running on the host, is there anything else I need to check?

 

Thanks! 

7 REPLIES 7

New Contributor

Hi buntu,

Apart from having the CM Agent service running - did you send a parcel to the host? (This is done by Adding to cluster)
Below API endpoint should be called with POST

/clusters/{{ cluster }}/hosts

 and payload:

{'items': ['my_node_fqdn', 'other_node_fqdn'] }

Hopes this helps others.

Thank You. This worked for me. 

Explorer

Hello,

 

In my case, I'm trying to deploy a new host with Cloudera CM Api (suing Python). All runs good, but when I want to apply a host template, I'm receiving this error:

 

ApiException: Host must have a single version of CDH installed. (error 400)

 

I know that Cloudera automatically dsitribute and activate parcels to new host, but how can I do, in teh same code, to recognize that the activation completes and then run apply host template?

 

Parcel state is Activated when running, despite of is in distribution state.

Explorer

This is my code:

 

from cm_api.api_client import ApiResource, ApiException
from time import sleep
import ssl
from time import gmtime, strftime
import socket

 

repo_url='https://archive.cloudera.com/cm5/redhat/7/x86_64/cm/5.15.1/'
hostnames = ["clouderapre-node3"]
hosts = []
host_password='cloudera'
parcel_version = "5.15.0-1.cdh5.15.0.p0.21"

 


CM_SERVER_HOST="clouderapre-mgr.fintonic.com"
cxt = ssl.create_default_context(cafile="/home/rlopez/certs/CA.crt.pem")
api = ApiResource(CM_SERVER_HOST, username="cmapi", password="B1gd4t@", use_tls=True, ssl_context=cxt)
cm = api.get_cloudera_manager()
cluster = api.get_cluster('cluster')
parcel = cluster.get_parcel('CDH', parcel_version)
template = cluster.get_host_template(name='nodo-computo')

 

for hostname in hostnames:
     create_host = api.create_host(hostname, hostname, socket.gethostbyname(hostname), "/default")
     hosts.append(create_host)
     install_cm_agent = cm.host_install(user_name='root', host_names=[hostname], cm_repo_url=repo_url,       password=host_password, )
     while install_cm_agent.success == None:
         sleep(5)
         install_cm_agent = install_cm_agent.fetch()

     if install_cm_agent.success != True:
         print "cm_host_install failed: " + install_cm_agent.resultMessage
         exit(0)

sleep(60)

 

for host in hosts:
     hostId = [host.hostId]
     add_host = cluster.add_hosts(hostId)
     install_template = template.apply_host_template(host_ids=hostId, start_roles=True)
     while install_template.resultMessage == "ApiException: Host must have a single version of CDH installed. (error 400)":
         sleep(5)
         install_template = template.apply_host_template(host_ids=hostId, start_roles=True).wait()
         exit(0)

New Contributor

Facing similar issue, did you get any solution yet?

 

Regards,

Smith

New Contributor

Hi, Do you have a solution for this? 

New Contributor

Hi,


From my point of view, during the time the CDH parcels packages are syncing, the below info is the summary size of parcels directory, it may last some time which depend your rate of network transport, after it's finished you can continue your next work like apply service template on hosts.

2.7G /opt/cloudera/parcels


Cheers,

Hua

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.