Hi Margus,

Try this,
How to submit "Install Packages" request

API

curl -u admin:admin -H "X-Requested-By: ambari" -i -X  POST 
http://%{ambari_server_host}%:8080/api/v1/clusters/%{cluster_name}%/stack_versions
 -d

'{

 "ClusterStackVersions":{

   "stack":"HDP",

   "version":"2.5",

   "repository_version":"%{repo_version}%"

 }

}'


Example

curl -u admin:admin -H "X-Requested-By: ambari" -i -X  POST 
http://localhost:8080/api/v1/clusters/cl1/stack_versions -d 
'{"ClusterStackVersions":{"stack":"HDP","version":"2.5","repository_version":"2.5.0.0-1245"}}'


How to validate upgrade prerequisites

API

curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET 
"http://%{ambari_server_host}%:8080/api/v1/clusters/%{cluster_name}%/rolling_upgrades_check?fields=*&UpgradeChecks/repository_version=%{repo_version}%&UpgradeChecks/upgrade_type=${type}";

${type} is either ROLLING, NON_ROLLING. Default is ROLLING

How to submit "Rolling Upgrade" or "Express Upgrade" request

API

curl -u admin:admin -H "X-Requested-By: ambari" -i -X  POST 
"http://%{ambari_server_host}%:8080/api/v1/clusters/%{cluster_name}%/upgrades"; 
-d

'{

 "Upgrade":{

   // Repository version to upgrade to | downgrade from

   "repository_version":"%{repo_version}%",


   // Direction = upgrade|downgrade. Default=upgrade

   "direction":"%{direction}%",


   // Skip service check failures if the tasks are skippable. default=false

   // Value in request overrides corresponding property in the upgrade pack

   "skip_service_check_failures":"false"


   // Skip slave/client component failures if the tasks are skippable. 
Default=false

   // Value in request overrides corresponding property in the  upgrade pack

   "skip_failures":"false"


   // Skip running pre-req checks when upgrade API endpoint is called. 
Default=false

   // Required pre-req check failures

   "skip_prerequisite_checks":"false"



   // Fail upgrade request if pre-requisite checks fail with a warning. 
Default=false

   // Recommended pre-req check failures

   "fail_on_check_warnings":"false"


   // Rolling or Express Upgrade require this. The default is ROLLING

   "upgrade_type":"ROLLING|NON_ROLLING"

 }

}'


Example

curl -u admin:admin -H "X-Requested-By: ambari" -i -X  POST 
"http://localhost:8080/api/v1/clusters/cl1/upgrades"; -d 
'{"Upgrade":{"repository_version":"2.5.0.0-1245", "direction":"UPGRADE", 
"upgrade_type":"ROLLING"}}'

Thanks,
Alejandro

From: Margus Kiting <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Tuesday, December 13, 2016 at 3:25 AM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Ambari new stack Install API procedure

Hi,

I hope someone in this list can help me.

I'm trying to automate HDP upgrade procedure, but I'm stuck with API procedures 
to install new HDP stack packages to all my cluster hosts.

I'm able to register new stack version using API, but for some reason packages 
installation API call sends unreadable blob to Ambari server and the magic 
happens.

I know how to initiate  Express Upgrade process using API, but before starting 
upgrade, packages should be installed to the hosts. Sure, I could install new 
packages to all hosts manually, but I think Ambari would not know that the 
hosts have packages installed.

I hope here are some experts who could explain how new stack version packages 
installation procedure works and maybe there is an proper API call for that.

Thanks in advance!

Best Regards,
Margus Kiting

Reply via email to