Support Questions
Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

ambari + Update a blueprint

hi all

I am new in ambari world

I read the blog from the follwing site - https://www.ibm.com/support/knowledgecenter/en/SS4GSP_6.2.5/com.ibm.edt.api.doc/topics/rest_bpid_put...

and that because we need to update values for some services in ambari cluster

and then to deploy new version of blue print

the syntax for the new blue print update is ( from the site example )

curl -u jsmith:passwd 
   -H "Content-Type: application/json"
  -H "Location: /landscaper/orion/file/jsmith_8a6bfff7_2c77_45db_a235_adda61ad6653-OrionContent/myTeam/myBlueprint/myBlueprint.yml"
  http://myserver.example.com:8080/landscaper/rest/blueprint/MyBlueprint 
  -X PUT 
  -d @updatedBlueprint.json

but not clearly for me , ( we need to type this syntax on Linux ambari server machine )

for example: what is the .yml file

  -H "Location: /landscaper/orion/file/jsmith_8a6bfff7_2c77_45db_a235_adda61ad6653-OrionContent/myTeam/myBlueprint/myBlueprint.yml"

from where we need to take the json file?

  -d @updatedBlueprint.json
Michael-Bronson
1 ACCEPTED SOLUTION

Mentor

@uri ben-ari

Usually when you add or delete components in a cluster its advisable to download the new blueprint, to enable you reproduce the cluster like from UAT/DEV to PROD.

The other was round I have never tried though you can add components to an existing cluster using a blueprint. see

Look at this

View solution in original post

17 REPLIES 17

Mentor

@uri ben-ari

The .yml is a configuration file It's basically a human-readable structured data format "YAML stands for "YAML Ain't Markup Language" and it is used extensively in Grav for its configuration files, blueprints, and also in page settings. YAML is to configuration what markdown is to markup." In this case the your configuration file is "myBlueprint.yml"

The json file with the -d @updatedBlueprint.json should be in the current directory where you are running the curl command.

@Geoffrey thx for the answer , but from where I need to get the .yml file ? or maybe to generate this file ? about the json file I gues this files include all the current values for all services , is it true ? so the target ( let me know if I wrong ) to load the json file and generate a new json file with all update values ?

Michael-Bronson

Explorer

Hi @uri ben-ari,

Your link and example are about IBM UrbanCode Deploy, not Apache Ambari.

Blueprints in Ambari are immutable, cannot be updated. You can POST the updated blueprint with a new name and use that to deploy the cluster.

@Doroszlai, Attila can you show me how to POST anew update version so the next new ambari & blueprint will use the new version with all update values?

Michael-Bronson

I just want to explain my target , in the ambari cluster we have parameters for all services , so my target is to create a new json ( blueprint ) that include the new values , and to use this json for the next ambari installation

Michael-Bronson

Explorer

If I understand correctly, you create a cluster using some initial blueprint, change some configuration parameters for services, and would like to get a blueprint with the updated parameters?

If so, then you need to export the blueprint from the cluster, which is explained eg. in this answer.

@Doroszlai, Attila I have anew question , lets say I successfully generate a new json file , and on this json file I change few parameters ( values ) , then I want to update the ambari cluster with this new update json file , is it possible ?

Michael-Bronson

Mentor

@uri ben-ari

The .yml file is specific to the OS setup you run in this case the IBM... Ambari blueprint uses the .json using curl.
1- What do you tend to achieve?

Mentor

@uri ben-ari,

You can generate your new blueprint.json from an existing cluster replacing the {ambari_host} and {Cluster_name} with correct values

curl -H "X-Requested-By: ambari" -X GET -u admin:admin http://{ambari_host}:8080/api/v1/clusters/{Cluster_name}\?format\=blueprint > blueprint.json

Hope that helps

@Geoffrey Shelton Okot , I will run this syntax in the next 15 min

Michael-Bronson

@Geoffrey Shelton Okot nice the syntax generate the .json file , so lets say we want to work on the json file in order to change the values from the parameters , do you know on existing tool/script that know how to replace the current values in the json file with other new values ?

Michael-Bronson

Mentor

@uri ben-ari

I always use a json validator, I don't know any tool that can that could help but if the value don't match your json wont be accepted and the output will give you hints as to which parameter.

Also see Ambari blueprints

@Geoffrey Shelton Okot , ok , I also ask Doroszlai, Attila about "update the ambari cluster with this new update json" is it possible I will happy to know your opinion about this ?

Michael-Bronson

Mentor

@uri ben-ari

Usually when you add or delete components in a cluster its advisable to download the new blueprint, to enable you reproduce the cluster like from UAT/DEV to PROD.

The other was round I have never tried though you can add components to an existing cluster using a blueprint. see

Look at this

so according to your info upload new update json to existing ambari cluster isn't real choice , so let continue to other option , is it possible by API command to change the parameters values for the services ? , can you please give me example for that?

Michael-Bronson

Mentor

@uri ben-ari

In the below example I am removing and re-installing RANGER

Stop RANGER component

curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop All Components"},"Body":{"ServiceComponentInfo":{"state":"INSTALLED"}}}' http://{ambari_host}:8080/api/v1/clusters/{cluster_name}/services/OOZIE/components/RANGER 

Delete RANGER component

curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE  http://{ambari_host}:8080/api/v1/clusters/{cluster_name}/services/RANGER

Install RANGER component

curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://{ambari_host}:8080/api/v1/clusters/{cluster_name}/hosts/HOSTNAME/host_components/RANGER

Hope that helps

@Geoffrey Shelton Okot thx for the examples , but if we want to change the values , for example - in ambari cluster we click HDFS service then we click on config , and then we get list of parameters , and their values , so I just thinking if API can change the value that belong to specific parameter ?

Michael-Bronson