incubator-ambari-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yusaku Sako <yus...@hortonworks.com>
Subject Re: How to update service state on specific hosts?
Date Tue, 08 Oct 2013 21:20:47 GMT
Christian,

For operating upon multiple components on multiple hosts at the same
time, you can do something like the following:

PUT /clusters/{cluster}/host_components

        "RequestInfo": {
          "context": "Start Components",
          "query":
"HostRoles/component_name.in(GANGLIA_MONITOR,HBASE_REGIONSERVER,DATANODE,TASKTRACKER,NODEMANAGER)&HostRoles/state=INSTALLED&HostRoles/host_name.in(host-a,host-b,host-c)
        },
        "Body": {
          "HostRoles": { "state": "STARTED" }
        }

That's exactly what Ambari Web does it when adding new hosts.

Yusaku

On Tue, Oct 8, 2013 at 1:37 PM, Christian Smith
<christian@greenbutton.com> wrote:
> Hi Tom,
>
> Sorry maybe I wasn't clear...  So above is what I'm currently able to do,
> however its slow when I add multiple hosts to a cluster as I need a request
> per host, per component.
>
> I have a cluster with hosts A, B & C already installed and started.  I add
> hosts D, E & F to the cluster with datanode and tasktracker components.  I
> then want to set the services/components just on hosts D, E & F to
> INSTALLED, then STARTED, hopefully with a single request.
>
> When I first install the cluster I can do a PUT to the following URI to
> change all services states from INIT to INSTALLED, so I was hoping there was
> some way to do the same, but for a subset of hosts.
>
> Thanks again,
> Christian
>
>
> On Wed, Oct 9, 2013 at 9:22 AM, Tom Beerbower <tbeerbower@hortonworks.com>
> wrote:
>>
>> Hi Christian,
>>
>> If I understand correctly you want to set the state of a component on a
>> specific host.  If so, here is an example from the docs ...
>>
>> Start the NAMENODE component by updating its state to 'STARTED'.
>>
>> PUT api/v1/clusters/c1/hosts/hostname/host_components/NAMENODE
>>
>> {
>>   "HostRoles":{
>>     "state":"STARTED"
>>   }
>> }
>>
>>
>> 202 Accepted
>> {
>>   "href" :
>> "http://your.ambari.server:8080/api/v1/clusters/c1/requests/12",
>>   "Requests" : {
>>     "id" : 12,
>>     "status" : "InProgress"
>>   }
>> }
>>
>>
>> Thanks,
>> Tom
>>
>>
>>
>> On 10/8/13 4:13 PM, Christian Smith wrote:
>>>
>>> Hi,
>>>
>>> I have a scenario where I have an existing cluster with all the services
>>> installed and started.  I then add one or more slaves to the existing
>>> cluster.
>>>
>>> I'm wondering if there' s an easy way for me to set the service/component
>>> states to INSTALLED then STARTED just for the new hosts?  When installing
>>> the cluster I use something like PUT state=INSTALLED to
>>> /api/v1/clusters/c1/services?ServiceInfo/state=INIT, but obviously I can't
>>> use this on a running cluster.
>>>
>>> I've tried various predicates like selecting just the hostnames I need
>>> for a component, but the predicate isn't supported.
>>>
>>> For example, this fails
>>>
>>>
>>> /api/v1/clusters/c1/services/HDFS/components/DATANODE?host_components/HostRoles/host_name=my-hostname
>>>
>>> I know I can iterate through each host, but this is slow...
>>>
>>> Thanks in advance,
>>> Christian
>>
>>
>>
>> --
>> 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.

Mime
View raw message