You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by Qing Chi 79624 <ch...@vmware.com> on 2014/06/03 05:46:58 UTC

Questions about ambari REST API

Hello guys,

I'm working on provisioning cluster through Ambari now using REST API. And I have some questions about ambari REST API.
Questions,:

  1.  Can only manage a cluster in Ambari?
  2.  How to install packages of service using ambari REST API?
  3.  Why the cluster which created by REST API would disappear after create another cluster using ambari Web UI? Steps:

a)  Create a cluster named "apache" using REST API and add hosts, services, components and configurations to the cluster.
b)  Create another cluster named "test" using ambari Web UI, and  persist it.
c)  open this URL http://10.111.88.146:8080/api/v1/clusters on browser. Following is result:
{
"href" : "http://10.111.88.146:8080/api/v1/clusters",
"items" : [
{
"href" : "http://10.111.88.146:8080/api/v1/clusters/test",
"Clusters" : {
"cluster_name" : "test",
"version" : "HDP-2.1"
}
}
]
}
I am confused where is the cluster named "apache". But I rerun the command to create a cluster named "apache". It will give me the message("Attempted to create a Cluster which already exists, clusterName=apache").
Command:
curl -H "X-Requested-By: ambari" -X POST -d "@cluster" --user "admin:admin" -i http://10.141.73.168:8080/api/v1/clusters/apache
{
"Clusters":
 {
"cluster_name": "apache",
 "version":"HDP-2.0"
 }
}
Response:
HTTP/1.1 409 Conflict
Set-Cookie: AMBARISESSIONID=1kcj0ocdogqm9ggvn4m2ekbng;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Content-Length: 108
Server: Jetty(7.6.7.v20120910)
{
"status" : 409,
"message" : "Attempted to create a Cluster which already exists, clusterName=apache"
}

Can you give me some helps for these questions?

Thanks,

-qing

Re: Questions about ambari REST API

Posted by Qing Chi 79624 <ch...@vmware.com>.
Hi Yusaku,

Thank you for clarify this issue.

-qing

On 6/3/14 1:15 PM, "Yusaku Sako" <yu...@hortonworks.com> wrote:

>Ambari currently supports single clusters only, though the REST API
>resource tree was designed with multiple cluster in mind.
>If you use the Ambari Web UI, there's actually code to delete any
>existing cluster when deploying a new cluster.
>This delete logic is there to get around partial failure to re-try
>installation from a clean slate.
>That's why you are seeing the existing cluster installed with the API
>disappear.
>
>Yusaku
>
>On Mon, Jun 2, 2014 at 8:56 PM, Qing Chi 79624 <ch...@vmware.com> wrote:
>> Hi,
>>
>> I did not use Ambari Blueprints API. I will use it to create cluster.
>> Thanks for your help.
>>
>> -qing
>>
>> From: Jeff Sposetti <je...@hortonworks.com>
>> Reply-To: <us...@ambari.apache.org>
>> Date: Mon, 2 Jun 2014 20:51:04 -0700
>> To: <us...@ambari.apache.org>
>> Cc: Emma Lin <li...@vmware.com>, Xiaoding Bian <xi...@vmware.com>
>> Subject: Re: Questions about ambari REST API
>>
>> Hi,
>>
>> How did you create your cluster? Did you use the Ambari Blueprints API
>>(and
>> are using the Ambari 1.6.0 release)?
>>
>> 
>>https://urldefense.proofpoint.com/v1/url?u=https://cwiki.apache.org/confl
>>uence/display/AMBARI/Blueprints&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=XFP
>>etyuh5lGv3twiMNs7nw%3D%3D%0A&m=dcUf3UlbKMBsmGIyqFcBeThu2xKfq1z7h5%2FjvI0U
>>b6o%3D%0A&s=6a695a399a7b207d089bd84f37908a52772ca02ba45cf24de691a21986ab1
>>079
>>
>> J
>>
>> On Mon, Jun 2, 2014 at 8:46 PM, Qing Chi 79624 <ch...@vmware.com> wrote:
>>>
>>> Hello guys,
>>>
>>> I'm working on provisioning cluster through Ambari now using REST API.
>>>And
>>> I have some questions about ambari REST API.
>>> Questions,:
>>>
>>> Can only manage a cluster in Ambari?
>>> How to install packages of service using ambari REST API?
>>> Why the cluster which created by REST API would disappear after create
>>> another cluster using ambari Web UI? Steps:
>>>
>>> a)  Create a cluster named "apache" using REST API and add hosts,
>>> services, components and configurations to the cluster.
>>> b)  Create another cluster named "test" using ambari Web UI, and
>>>persist
>>> it.
>>> c)  open this URL
>>>https://urldefense.proofpoint.com/v1/url?u=http://10.111.88.146:8080/api
>>>/v1/clusters&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=XFPetyuh5lGv3twiMNs7n
>>>w%3D%3D%0A&m=dcUf3UlbKMBsmGIyqFcBeThu2xKfq1z7h5%2FjvI0Ub6o%3D%0A&s=e3cbc
>>>31cc2942453d12b4058e6a68165a53abd44f95092cb81dabe6d7a790fef on browser.
>>> Following is result:
>>> {
>>> "href" : 
>>>"https://urldefense.proofpoint.com/v1/url?u=http://10.111.88.146:8080/ap
>>>i/v1/clusters&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=XFPetyuh5lGv3twiMNs7
>>>nw%3D%3D%0A&m=dcUf3UlbKMBsmGIyqFcBeThu2xKfq1z7h5%2FjvI0Ub6o%3D%0A&s=e3cb
>>>c31cc2942453d12b4058e6a68165a53abd44f95092cb81dabe6d7a790fef",
>>> "items" : [
>>> {
>>> "href" : 
>>>"https://urldefense.proofpoint.com/v1/url?u=http://10.111.88.146:8080/ap
>>>i/v1/clusters/test&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=XFPetyuh5lGv3tw
>>>iMNs7nw%3D%3D%0A&m=dcUf3UlbKMBsmGIyqFcBeThu2xKfq1z7h5%2FjvI0Ub6o%3D%0A&s
>>>=4a992d82b806bb88230145f69baf82f4cdc1e9887fe1c1d051e381ca39836a9a",
>>> "Clusters" : {
>>> "cluster_name" : "test",
>>> "version" : "HDP-2.1"
>>> }
>>> }
>>> ]
>>> }
>>> I am confused where is the cluster named "apache". But I rerun the
>>>command
>>> to create a cluster named "apache". It will give me the
>>>message("Attempted
>>> to create a Cluster which already exists, clusterName=apache").
>>> Command:
>>> curl -H "X-Requested-By: ambari" -X POST -d "@cluster" --user
>>> "admin:admin" -i
>>>https://urldefense.proofpoint.com/v1/url?u=http://10.141.73.168:8080/api
>>>/v1/clusters/apache&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=XFPetyuh5lGv3t
>>>wiMNs7nw%3D%3D%0A&m=dcUf3UlbKMBsmGIyqFcBeThu2xKfq1z7h5%2FjvI0Ub6o%3D%0A&
>>>s=a8f45159268465f104ac9d28f718b2d7e7d7f184f48e3f667387845a012749e9
>>> {
>>> "Clusters":
>>>  {
>>> "cluster_name": "apache",
>>>  "version":"HDP-2.0"
>>>  }
>>> }
>>> Response:
>>> HTTP/1.1 409 Conflict
>>> Set-Cookie: AMBARISESSIONID=1kcj0ocdogqm9ggvn4m2ekbng;Path=/
>>> Expires: Thu, 01 Jan 1970 00:00:00 GMT
>>> Content-Type: text/plain
>>> Content-Length: 108
>>> Server: Jetty(7.6.7.v20120910)
>>> {
>>> "status" : 409,
>>> "message" : "Attempted to create a Cluster which already exists,
>>> clusterName=apache"
>>> }
>>>
>>> Can you give me some helps for these questions?
>>>
>>> Thanks,
>>>
>>> -qing
>>
>>
>>
>> CONFIDENTIALITY NOTICE
>> NOTICE: This message is intended for the use of the individual or
>>entity to
>> which it is addressed and may contain information that is confidential,
>> privileged and exempt from disclosure under applicable law. If the
>>reader of
>> this message is not the intended recipient, you are hereby notified
>>that any
>> printing, copying, dissemination, distribution, disclosure or
>>forwarding of
>> this communication is strictly prohibited. If you have received this
>> communication in error, please contact the sender immediately and
>>delete it
>> from your system. Thank You.
>
>-- 
>CONFIDENTIALITY NOTICE
>NOTICE: This message is intended for the use of the individual or entity
>to 
>which it is addressed and may contain information that is confidential,
>privileged and exempt from disclosure under applicable law. If the reader
>of this message is not the intended recipient, you are hereby notified
>that 
>any printing, copying, dissemination, distribution, disclosure or
>forwarding of this communication is strictly prohibited. If you have
>received this communication in error, please contact the sender
>immediately 
>and delete it from your system. Thank You.


Re: Questions about ambari REST API

Posted by Yusaku Sako <yu...@hortonworks.com>.
Ambari currently supports single clusters only, though the REST API
resource tree was designed with multiple cluster in mind.
If you use the Ambari Web UI, there's actually code to delete any
existing cluster when deploying a new cluster.
This delete logic is there to get around partial failure to re-try
installation from a clean slate.
That's why you are seeing the existing cluster installed with the API disappear.

Yusaku

On Mon, Jun 2, 2014 at 8:56 PM, Qing Chi 79624 <ch...@vmware.com> wrote:
> Hi,
>
> I did not use Ambari Blueprints API. I will use it to create cluster.
> Thanks for your help.
>
> -qing
>
> From: Jeff Sposetti <je...@hortonworks.com>
> Reply-To: <us...@ambari.apache.org>
> Date: Mon, 2 Jun 2014 20:51:04 -0700
> To: <us...@ambari.apache.org>
> Cc: Emma Lin <li...@vmware.com>, Xiaoding Bian <xi...@vmware.com>
> Subject: Re: Questions about ambari REST API
>
> Hi,
>
> How did you create your cluster? Did you use the Ambari Blueprints API (and
> are using the Ambari 1.6.0 release)?
>
> https://cwiki.apache.org/confluence/display/AMBARI/Blueprints
>
> J
>
> On Mon, Jun 2, 2014 at 8:46 PM, Qing Chi 79624 <ch...@vmware.com> wrote:
>>
>> Hello guys,
>>
>> I'm working on provisioning cluster through Ambari now using REST API. And
>> I have some questions about ambari REST API.
>> Questions,:
>>
>> Can only manage a cluster in Ambari?
>> How to install packages of service using ambari REST API?
>> Why the cluster which created by REST API would disappear after create
>> another cluster using ambari Web UI? Steps:
>>
>> a)  Create a cluster named "apache" using REST API and add hosts,
>> services, components and configurations to the cluster.
>> b)  Create another cluster named "test" using ambari Web UI, and  persist
>> it.
>> c)  open this URL http://10.111.88.146:8080/api/v1/clusters on browser.
>> Following is result:
>> {
>> "href" : "http://10.111.88.146:8080/api/v1/clusters",
>> "items" : [
>> {
>> "href" : "http://10.111.88.146:8080/api/v1/clusters/test",
>> "Clusters" : {
>> "cluster_name" : "test",
>> "version" : "HDP-2.1"
>> }
>> }
>> ]
>> }
>> I am confused where is the cluster named "apache". But I rerun the command
>> to create a cluster named "apache". It will give me the message("Attempted
>> to create a Cluster which already exists, clusterName=apache").
>> Command:
>> curl -H "X-Requested-By: ambari" -X POST -d "@cluster" --user
>> "admin:admin" -i http://10.141.73.168:8080/api/v1/clusters/apache
>> {
>> "Clusters":
>>  {
>> "cluster_name": "apache",
>>  "version":"HDP-2.0"
>>  }
>> }
>> Response:
>> HTTP/1.1 409 Conflict
>> Set-Cookie: AMBARISESSIONID=1kcj0ocdogqm9ggvn4m2ekbng;Path=/
>> Expires: Thu, 01 Jan 1970 00:00:00 GMT
>> Content-Type: text/plain
>> Content-Length: 108
>> Server: Jetty(7.6.7.v20120910)
>> {
>> "status" : 409,
>> "message" : "Attempted to create a Cluster which already exists,
>> clusterName=apache"
>> }
>>
>> Can you give me some helps for these questions?
>>
>> Thanks,
>>
>> -qing
>
>
>
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or entity to
> which it is addressed and may contain information that is confidential,
> privileged and exempt from disclosure under applicable law. If the reader of
> this message is not the intended recipient, you are hereby notified that any
> printing, copying, dissemination, distribution, disclosure or forwarding of
> this communication is strictly prohibited. If you have received this
> communication in error, please contact the sender immediately and delete it
> from your system. Thank You.

-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.

Re: Questions about ambari REST API

Posted by Qing Chi 79624 <ch...@vmware.com>.
Hi,

I did not use Ambari Blueprints API. I will use it to create cluster.
Thanks for your help.

-qing

From: Jeff Sposetti <je...@hortonworks.com>>
Reply-To: <us...@ambari.apache.org>>
Date: Mon, 2 Jun 2014 20:51:04 -0700
To: <us...@ambari.apache.org>>
Cc: Emma Lin <li...@vmware.com>>, Xiaoding Bian <xi...@vmware.com>>
Subject: Re: Questions about ambari REST API

Hi,

How did you create your cluster? Did you use the Ambari Blueprints API (and are using the Ambari 1.6.0 release)?

https://cwiki.apache.org/confluence/display/AMBARI/Blueprints<https://urldefense.proofpoint.com/v1/url?u=https://cwiki.apache.org/confluence/display/AMBARI/Blueprints&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=XFPetyuh5lGv3twiMNs7nw%3D%3D%0A&m=5bnHHfuv%2F5zxtWeiQKHJpOm5x5rf7C6m2WXn8KW4XDw%3D%0A&s=135ecd3c627043ed83a6fa53fe01dd996c47b8df3c8bfd0b90bb974786dd466b>

J

On Mon, Jun 2, 2014 at 8:46 PM, Qing Chi 79624 <ch...@vmware.com>> wrote:
Hello guys,

I'm working on provisioning cluster through Ambari now using REST API. And I have some questions about ambari REST API.
Questions,:

  1.  Can only manage a cluster in Ambari?
  2.  How to install packages of service using ambari REST API?
  3.  Why the cluster which created by REST API would disappear after create another cluster using ambari Web UI? Steps:

a)  Create a cluster named "apache" using REST API and add hosts, services, components and configurations to the cluster.
b)  Create another cluster named "test" using ambari Web UI, and  persist it.
c)  open this URL http://10.111.88.146:8080/api/v1/clusters<https://urldefense.proofpoint.com/v1/url?u=http://10.111.88.146:8080/api/v1/clusters&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=XFPetyuh5lGv3twiMNs7nw%3D%3D%0A&m=5bnHHfuv%2F5zxtWeiQKHJpOm5x5rf7C6m2WXn8KW4XDw%3D%0A&s=25bca294780369073affca3f272af44b1e72bf867d77c28ee999c38624e70dc0> on browser. Following is result:
{
"href" : "http://10.111.88.146:8080/api/v1/clusters<https://urldefense.proofpoint.com/v1/url?u=http://10.111.88.146:8080/api/v1/clusters&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=XFPetyuh5lGv3twiMNs7nw%3D%3D%0A&m=5bnHHfuv%2F5zxtWeiQKHJpOm5x5rf7C6m2WXn8KW4XDw%3D%0A&s=25bca294780369073affca3f272af44b1e72bf867d77c28ee999c38624e70dc0>",
"items" : [
{
"href" : "http://10.111.88.146:8080/api/v1/clusters/test<https://urldefense.proofpoint.com/v1/url?u=http://10.111.88.146:8080/api/v1/clusters/test&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=XFPetyuh5lGv3twiMNs7nw%3D%3D%0A&m=5bnHHfuv%2F5zxtWeiQKHJpOm5x5rf7C6m2WXn8KW4XDw%3D%0A&s=b1bed6825f7f6d659e8f87942bdf505c73bdc44cbb6696b60b7ebfcd291db4af>",
"Clusters" : {
"cluster_name" : "test",
"version" : "HDP-2.1"
}
}
]
}
I am confused where is the cluster named "apache". But I rerun the command to create a cluster named "apache". It will give me the message("Attempted to create a Cluster which already exists, clusterName=apache").
Command:
curl -H "X-Requested-By: ambari" -X POST -d "@cluster" --user "admin:admin" -i http://10.141.73.168:8080/api/v1/clusters/apache<https://urldefense.proofpoint.com/v1/url?u=http://10.141.73.168:8080/api/v1/clusters/apache&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=XFPetyuh5lGv3twiMNs7nw%3D%3D%0A&m=5bnHHfuv%2F5zxtWeiQKHJpOm5x5rf7C6m2WXn8KW4XDw%3D%0A&s=29a4a41986c92d9aa07a29f045a4ddfd9d01b2fb5df8c66f2b7bfb9d778337f3>
{
"Clusters":
 {
"cluster_name": "apache",
 "version":"HDP-2.0"
 }
}
Response:
HTTP/1.1 409 Conflict
Set-Cookie: AMBARISESSIONID=1kcj0ocdogqm9ggvn4m2ekbng;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Content-Length: 108
Server: Jetty(7.6.7.v20120910)
{
"status" : 409,
"message" : "Attempted to create a Cluster which already exists, clusterName=apache"
}

Can you give me some helps for these questions?

Thanks,

-qing


CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to which it is addressed and may contain information that is confidential, privileged and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any printing, copying, dissemination, distribution, disclosure or forwarding of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately and delete it from your system. Thank You.

Re: Questions about ambari REST API

Posted by Jeff Sposetti <je...@hortonworks.com>.
Hi,

How did you create your cluster? Did you use the Ambari Blueprints API (and
are using the Ambari 1.6.0 release)?

https://cwiki.apache.org/confluence/display/AMBARI/Blueprints

J

On Mon, Jun 2, 2014 at 8:46 PM, Qing Chi 79624 <ch...@vmware.com> wrote:

>  Hello guys,
>
>  I'm working on provisioning cluster through Ambari now using REST API.
> And I have some questions about ambari REST API.
>  Questions,:
>
>    1. Can only manage a cluster in Ambari?
>    2. How to install packages of service using ambari REST API?
>    3. Why the cluster which created by REST API would disappear after
>    create another cluster using ambari Web UI? Steps:
>
>  a)  Create a cluster named "apache" using REST API and add hosts,
> services, components and configurations to the cluster.
>  b)  Create another cluster named "test" using ambari Web UI, and
>  persist it.
>  c)  open this URL http://10.111.88.146:8080/api/v1/clusters on browser.
> Following is result:
>  {
>  "href" : "http://10.111.88.146:8080/api/v1/clusters",
>  "items" : [
>  {
>  "href" : "http://10.111.88.146:8080/api/v1/clusters/test",
>  "Clusters" : {
>  "cluster_name" : "test",
>  "version" : "HDP-2.1"
>  }
>  }
>  ]
>  }
>  I am confused where is the cluster named "apache". But I rerun the
> command to create a cluster named "apache". It will give me the
> message("Attempted to create a Cluster which already exists,
> clusterName=apache").
>  Command:
>  curl -H "X-Requested-By: ambari" -X POST -d "@cluster" --user
> "admin:admin" -i http://10.141.73.168:8080/api/v1/clusters/apache
>  {
>  "Clusters":
>   {
>  "cluster_name": "apache",
>   "version":"HDP-2.0"
>   }
>  }
>  Response:
>  HTTP/1.1 409 Conflict
>  Set-Cookie: AMBARISESSIONID=1kcj0ocdogqm9ggvn4m2ekbng;Path=/
>  Expires: Thu, 01 Jan 1970 00:00:00 GMT
>  Content-Type: text/plain
>  Content-Length: 108
>  Server: Jetty(7.6.7.v20120910)
>  {
>  "status" : 409,
>  "message" : "Attempted to create a Cluster which already exists,
> clusterName=apache"
>  }
>
>  Can you give me some helps for these questions?
>
>  Thanks,
>
>  -qing
>

-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.