Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on 11-10-2017 12:37 PM - edited 08-17-2019 11:55 PM
in my Ambari cluster we have some services that not installed yet
as graphite service as described here ( in the picture )
what are the API commands that required in order to identify which service is/are available to install
and the API that install the service
Created 11-12-2017 06:28 AM
I thought it was only an install. If you want to add a service and install the service, there are series of steps which you need to do.
This doc will help you. Currently I do not have configuration for knox which is required in Step 3.
https://cwiki.apache.org/confluence/display/AMBARI/Adding+a+New+Service+to+an+Existing+Cluster
Created 11-10-2017 12:53 PM
You can use this API to get all the available services.
http://{ambari-server}:{port}/api/v1/clusters/{clustername}/stack_versions/{stack-version-no}/reposi...
Hit the above API and parse "RepositoryVersions -> services" array
To check list of installed services you can use
http://{ambari-server}:{port}/api/v1/clusters/{clustername}/services.
Check the diff between two to find out the services which are not installed
To install the service use
curl -u <username>:<password> -i -X PUT -d '{"ServiceInfo": {"state" : "INSTALLED"}}' http://<ambari-server-host>:{port}/api/v1/clusters/<cluster-name>/services/<service-name>;Thanks,
Aditya
Created 11-10-2017 12:59 PM
hi aditye regarding the - http://{ambari-server}:{port}/api/v1/clusters/{clustername}/services. , can you show me please the full approach ( full syntax )
Created 11-10-2017 01:03 PM
get list of available services : curl -k -u {username}:{password} -H "X-Requested-By:ambari" -i -X GET http://{ambari-server}:{port}/api/v1/clusters/{clustername}/stack_versions/{stack-version-no}/reposi...
Get list of installed services: curl -k -u {username}:{password} -H "X-Requested-By:ambari" -i -X GET http://{ambari-server}:{port}/api/v1/clusters/{clustername}/services
To get the {stack-version-no} you can hit below API and see the available stack versions
curl -k -u {username}:{password} -H "X-Requested-By:ambari" -i -X GET http://{ambari-server}:{port}/api/v1/clusters/{clustername}/stack_versions/Similarly to get {repository-version-no}, get {stack-version-no} from above call and hit below url
curl -k -u {username}:{password} -H "X-Requested-By:ambari" -i -X GET http://{ambari-server}:{port}/api/v1/clusters/{clustername}/stack_versions/{stack-version-no}/replace the placeholders with your values
Created 11-10-2017 01:07 PM
hi aditye , can you give me real example for the first API
second how to get these values ?
stack_versions
{stack-version-no}
repository_versions
{repository-version-no}
Created 11-10-2017 01:15 PM
To get the {stack-version-no} , hit below API
curl -k -u {username}:{password} -H "X-Requested-By:ambari" -i -X GET http://{ambari-server}:{port}/api/v1/clusters/{clustername}/stack_versions/
ex: curl -k -u admin:admin -H "X-Requested-By:ambari" -i -X GET http://172.31.192.200:8080/api/v1/clusters/cl1/stack_versions
{
"href" : "http://172.31.192.200:8080/api/v1/clusters/cl1/stack_versions",
"items" : [
{
"href" : "http://172.31.192.200:8080/api/v1/clusters/cl1/stack_versions/1", --> stack version no
"ClusterStackVersions" : {
"cluster_name" : "cl1",
"id" : 1,
"repository_version" : 1,
"stack" : "HDP",
"version" : "2.6"
}
}
]
}
<br>To get {repository-version-no} , hit below API
curl -k -u {username}:{password} -H "X-Requested-By:ambari" -i -X GET http://{ambari-server}:{port}/api/v1/clusters/{clustername}/stack_versions/{stack-version-no}
ex: curl -k -u admin:admin -H "X-Requested-By:ambari" -i -X GET http://172.31.192.200:8080/api/v1/clusters/cl1/stack_versions/1
{
"href" : "http://x.x.x.x:8080/api/v1/clusters/cl1/stack_versions/1/",
"ClusterStackVersions" : {
"cluster_name" : "cl1",
"id" : 1,
"repository_version" : 1,
"stack" : "HDP",
"state" : "CURRENT",
"version" : "2.6",
"host_states" : {
"CURRENT" : [
"hbase-migration-repro-4.novalocal",
"hbase-migration-repro-1.novalocal",
"hbase-migration-repro-3.novalocal",
"hbase-migration-repro-2.novalocal"
],
"INIT" : [ ],
"INSTALLED" : [ ],
"INSTALLING" : [ ],
"INSTALL_FAILED" : [ ],
"NOT_REQUIRED" : [ ],
"OUT_OF_SYNC" : [ ]
}
},
"repository_versions" : [
{
"href" : "http://x.x.x.x:8080/api/v1/clusters/hbasetest/stack_versions/1/repository_versions/51", --- > repository version no
"RepositoryVersions" : {
"id" : 51,
"stack_name" : "HDP",
"stack_version" : "2.6"
}
}
]
}
<br>Then you can hit the final API
curl -k -u {username}:{password} -H "X-Requested-By:ambari" -i -X GET http://{ambari-server}:{port}/api/v1/clusters/{clustername}/stack_versions/{stack-version-no}/reposi...
Created 11-11-2017 07:09 PM
hi aditya , everything was great until I intend to install the service
for this example we try to install the service - Knox
I try this:
curl -u xxxx:xxxx -i -X PUT -d '{"ServiceInfo": {"state" : "INSTALLED"}}' http://182.243.5.12 :8080/api/v1/clusters/HDP101/services/Knox
HTTP/1.1 400 Bad Request X-Frame-Options: DENY X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff Cache-Control: no-store Pragma: no-cache Set-Cookie: AMBARISESSIONID=13q980rkix8lh1ewku7n3xlhfh;Path=/;HttpOnly Expires: Thu, 01 Jan 1970 00:00:00 GMT User: admin Content-Type: text/plain Content-Length: 107 Server: Jetty(8.1.19.v20160209)
Created on 11-11-2017 07:23 PM - edited 08-17-2019 11:55 PM
here is how I check the service name
curl -k -u xxxxx:xxxx -H "X-Requested-By:ambari" -i -X GET http://182.243.5.12
:8080/api/v1/clusters/HDP101/stack_versions/1/repository_versions/1 | grep display_name | grep -i knox
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 11316 100 11316 0 0 603k 0 --:--:-- --:--:-- --:--:-- 613k "display_name" : "Knox",
Created 11-12-2017 06:28 AM
I thought it was only an install. If you want to add a service and install the service, there are series of steps which you need to do.
This doc will help you. Currently I do not have configuration for knox which is required in Step 3.
https://cwiki.apache.org/confluence/display/AMBARI/Adding+a+New+Service+to+an+Existing+Cluster
Created 11-12-2017 09:03 AM
hi Aditya , just to be clear the status for now is that , from ambari GUI when I go to actions --> add service , then I see the Knox service but it is uncheck in the checkbox ! , so what are the steps from here ? , do we need in this case to do ( add service and install service ? )