Return-Path: X-Original-To: apmail-ambari-user-archive@www.apache.org Delivered-To: apmail-ambari-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 38E8A17286 for ; Tue, 7 Apr 2015 07:16:52 +0000 (UTC) Received: (qmail 7260 invoked by uid 500); 7 Apr 2015 07:16:49 -0000 Delivered-To: apmail-ambari-user-archive@ambari.apache.org Received: (qmail 7229 invoked by uid 500); 7 Apr 2015 07:16:49 -0000 Mailing-List: contact user-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ambari.apache.org Delivered-To: mailing list user@ambari.apache.org Received: (qmail 7219 invoked by uid 99); 7 Apr 2015 07:16:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2015 07:16:48 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of adamskikrzysiek@gmail.com designates 209.85.215.44 as permitted sender) Received: from [209.85.215.44] (HELO mail-la0-f44.google.com) (209.85.215.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2015 07:16:43 +0000 Received: by lagv1 with SMTP id v1so35377473lag.3 for ; Tue, 07 Apr 2015 00:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-type; bh=V18iSoKAYW3L9oMMx1/GfCrSu8bl1yAioqhyj2TN6lA=; b=qJFCjuMObSYEA1TfTD4q90Jx2JslH+EFHMkEEY/LRnBV4R6+o5jksgAfoDD5vtwBl3 xb3g82U0bd+g5FA/s4Q3gIG+rFZN8850Rr3a+LCRt0zz1/aeVQPZw2aKSiavmsowtDUc j1P0lL3A/5T9WYyNRbKeaFD+Hx/yzo406IYTkUTf/yUOCQYsn0JWG5KVlhzbSs9TvRpA ZQD0oBxSKMefUQAfOFt6Ub0YTYcEwcmmf351IEyvmbbpJz9RtBEhOgnQ7Bs2yC+CgDoZ XDQcT2Uv5ntcriFZR0hujP3eCe2zVfRl7j3LtG7lHVjDMXmqLV9KPR9Z909G95rCVTM3 70Hw== X-Received: by 10.152.203.162 with SMTP id kr2mr6276039lac.68.1428390937572; Tue, 07 Apr 2015 00:15:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Krzysztof Adamski Date: Tue, 07 Apr 2015 07:15:37 +0000 Message-ID: Subject: Start/stop all services programmatically To: "user@ambari.apache.org" Content-Type: multipart/alternative; boundary=001a113463266f392805131d2e5a X-Virus-Checked: Checked by ClamAV on apache.org --001a113463266f392805131d2e5a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, I am busy implementing a manual job to stop all hosts services via script before rebooting the OS. The examples I found in wiki are per service or component. 1. Is there any way to invoke the stop/start for all hosts components just like from a web interface? 2. How ambari determines the proper order for the services to start/stop e.g. first stop hiveserver before stopping mysql etc. curl -s --user admin:admin -H "X-Requested-By: ambari" -X GET " http://ambari:8080/api/v1/clusters/ing_hdp/components/? ServiceComponentInfo/category.in(SLAVE,MASTER)&host_ components/HostRoles/host_name=3Dhost1&fields=3Dhost_components/HostRoles/ component_name,host_components/HostRoles/state" | jq -r '[[.items[].host_components[].HostRoles.component_name]]|tostring' | sed -r 's/[\["]//g' | sed -r 's/[]]//g' function stop(){ curl -u admin:admin -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Stop =E2=80=98"$1"=E2=80=99 via REST"}, "Body= ": {"HostRoles": {"state": "INSTALLED"}}}' http://ambari:8080/api/v1/ clusters/ing_hdp/hosts/host1/host_components/$1 } Thanks for any guide. --001a113463266f392805131d2e5a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello,

I am busy implement= ing a manual job to stop all hosts services via script before rebooting the= OS. The examples I found in wiki are per service or component.
<= br>
1. Is there any way to invoke the stop/start for all hosts co= mponents just like from a web interface?
2. How ambari determines= the proper order for the services to start/stop e.g. first stop hiveserver= before stopping mysql etc.

curl -s --user admin:admin -H "X-Requested-By: ambari" -X GET &q= uot;http://ambari:8080/api/v1/<= /u>clusters/ing_hdp/components/?ServiceComponentInfo/category.in(SLAVE,MASTER)&host_components/HostRoles/host_name=3Dh= ost1&fields=3Dhost_components/HostRoles/component_name,ho= st_components/HostRoles/state" | jq -r '[[.items[].host= _components[].HostRoles.component_name]]|tostring' | sed = -r 's/[\["]//g' | sed -r 's/[]]//g'

=C2=A0 function stop(){

curl -u admin:adm= in -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo= ": {"context" :"Stop =E2=80=98"$1"=E2=80=99 v= ia REST"}, "Body": {"HostRoles": {"state"= ;: "INSTALLED"}}}' http://ambari= :8080/api/v1/clusters/ing_hdp/hosts/host1/host_components/$1<= /a>

}

Thanks for any gu= ide.

--001a113463266f392805131d2e5a--