Created 08-09-2017 08:37 AM
hi all
we have ambari cluster Version 2.5.0.3 , while all clients machines are Linux redhat
first I generated the json file to my Linux machine as the following: ( on ambari server machine )
curl -H "X-Requested-By: ambari" -X GET -u admin:admin http://130.14.6.28:8080/api/v1/clusters/HDP01\?format\=blueprint > blueprint.json
then I update the blueprint.json file with some changes about the parameters and their values
finally my target is to upload the new blueprint.json to ambari cluster in order to take affect !
path=/root
curl -H "X-Requested-By: ambari" --data @ -X POST -u admin:admin http://130.14.6.28:8080/api/v1/blueprints/HDP01 -d @$path/blueprint.json
but I get the following errors ( seems because wrong syntax )
Warning: Couldn't read data from file "", this makes an empty POST. { "status" : 400, "message" : "Invalid Request: Malformed Request Body. An exception occurred parsing the request body: Unexpected character ('&' (code 38)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: java.io.StringReader@4a3484a6; line: 1, column: 3]"
please advice what is wrong in my syntax ? and what is the right syntax in order to upload the new update blueprint.json file
Created 08-10-2017 09:27 AM
This thread have been going on endlessly, and with duplicates.. I provided you the curl step mentioned above. If an answer provided solved the initial issue please do raise another thread. As jay stated you should mark the appropriate answer as "ACCEPTED" otherwise members will not attend to your questions in the future ,personally I have posted about 4 answers to your same thread .....
Created 08-09-2017 09:05 AM
You should not use the > redirect operator to move the JSON response to a file ... Instead use the Curl "-o /PATH/TO/file.json") to do the same . Please try
Example:
# curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://130.14.6.28:8080/api/v1/clusters/HDP01?format=blueprint -o /tmp/HDP01_blueprint.json
.
Still if you find any issue with the JSON data then please attach the edited JSON so that we can check the JSON characters are fine or not?
Created 08-09-2017 09:08 AM
ok thx , what about the second part - curl -H "X-Requested-By: ambari" --data @ -X POST -u admin:admin http://130.14.6.28:8080/api/v1/blueprints/HDP01 -d @$path/blueprint.json
Created 08-09-2017 09:09 AM
the json data is ok , the problem is about my syntax ( with curl .... )
Created 08-09-2017 09:18 AM
Yes, in the POST you have twice "--data" and "-d" both are not needed together. So please try:
# curl -u admin:admin -H "X-Requested-By: ambari" -d @$path/blueprint.json -X POST http://130.14.6.28:8080/api/v1/blueprints/HDP01
.
OR
# curl -u admin:admin -H "X-Requested-By: ambari" -X POST http://130.14.6.28:8080/api/v1/blueprints/HDP01 -d @$path/blueprint.json
Here the "$path/blueprint.json" needs to be replaced with the actual path like -d@/tmp/blueprint.json
.
Created 08-09-2017 09:20 AM
thx for your answer , now I get - { "status" : 409, "message" : "Attempted to create a Blueprint which already exists, blueprint_name=HDP01" }
Created 08-09-2017 09:24 AM
Please change the blueprint name to something else inside your blueprint.json file.
If you want to see the rpeviously registered blueorint names then you can use the following kind of API:
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://130.14.6.28:8080/api/v1/blueprints
.
Blueprint name should be unique.
Else you can delete the Old blueprints from your ambari server using the name>
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://130.14.6.28:8080/api/v1/blueprints/HDP01
Created 08-09-2017 09:34 AM
ok I removed the old json file and after I create the new one I get this - { "status" : 400, "message" : "Cluster Topology validation failed. Invalid service component count: [Schema_Registry(actual=3, required=5), MassFlowManager(actual=1, required=5), MassRepo(actual=1, required=5), Airflow(actual=1, required=5)]. To disable topology validation and create the blueprint, add the following to the end of the url: '?validate_topology=false'"
Created 08-09-2017 09:38 AM
It means either you are using some services like Nifi/Oozie and few configurations are missing like "Schema_Registry", "MassFlowManager" ... etc. So the blueprint registration is failing.
The other option will be to add the "?validate_topology=false" parametere in the URL to tell ambari to not validate the blueprint so that later you can update it.
# curl -u admin:admin -H "X-Requested-By: ambari" -X POST http://130.14.6.28:8080/api/v1/blueprints/HDP01?validate_topology=false -d @$path/blueprint.json
Created 08-09-2017 09:56 AM
ok now its work but little problem , before I upload the blueprint .json file I change the value - yarn.scheduler.minimum-allocation-mb" , and after I upload the json file and I access to ambari GUI I see the previos value - why ? , second I also restart the ambari-server but still have the old value