Daniel Horak created AMBARI-9215:
------------------------------------

             Summary: ambari-server not running when (re)started via ansible 
'command' or 'shell' module
                 Key: AMBARI-9215
                 URL: https://issues.apache.org/jira/browse/AMBARI-9215
             Project: Ambari
          Issue Type: Bug
    Affects Versions: 1.6.1
         Environment: HDP 2.1 on RHEL 6 with 2.1.GlusterFS stack.

            Reporter: Daniel Horak


When I start ambari-server via ansible 'command' or 'shell' module, ambari 
server immediately stop, when the ansible command finish.

*How to reproduce:*
1) prepare ansible inventory file (you have to have configured passwordless ssh 
to the server AMBARI.EXAMPLE.COM).
{noformat}
# echo "AMBARI.EXAMPLE.COM" > hosts
{noformat}
2) check ansible configuration
{noformat}
# ansible AMBARI.EXAMPLE.COM -i hosts  -m ping
  AMBARI.EXAMPLE.COM | success >> {
      "changed": false, 
      "ping": "pong"
  }
{noformat}
3) run ambari-server restart (and sleep 30) via ansible and in the meantime, 
check the state of ambari-server on the server AMBARI.EXAMPLE.COM.
{noformat}
# ansible AMBARI.EXAMPLE.COM -i hosts -m shell -a "ambari-server restart; sleep 
30"
  AMBARI.EXAMPLE.COM | success | rc=0 >>
  Using python  /usr/bin/python2.6
  Restarting ambari-server
  Using python  /usr/bin/python2.6
  Stopping ambari-server
  Ambari Server is not running
  Using python  /usr/bin/python2.6
  Starting ambari-server
  Ambari Server running with 'root' privileges.
  Organizing resource files at /var/lib/ambari-server/resources...
  Waiting for server start...
  Server PID at: /var/run/ambari-server/ambari-server.pid
  Server out at: /var/log/ambari-server/ambari-server.out
  Server log at: /var/log/ambari-server/ambari-server.log
  Ambari Server 'start' completed successfully.
{noformat}

in the meantime on the AMBARI.EXAMPLE.COM:
{noformat}
AMBARI.EXAMPLE.COM# ambari-server status
  Using python  /usr/bin/python2.6
  Ambari-server status
  Ambari Server running
  Found Ambari Server PID: '3785 at: /var/run/ambari-server/ambari-server.pid
{noformat}

4) when the ansible command finish, check the state of ambari-server and 
related log:
{noformat}
AMBARI.EXAMPLE.COM# ambari-server status
  Using python  /usr/bin/python2.6
  Ambari-server status
  Ambari Server not running. Stale PID File at: 
/var/run/ambari-server/ambari-server.pid

AMBARI.EXAMPLE.COM# tail -4 /var/log/ambari-server/ambari-server.log 
  16:52:26,965  INFO [Thread-2] ContextHandler:795 - stopped 
o.e.j.s.ServletContextHandler{/,file:/usr/lib/ambari-server/web/}
  16:52:27,018  INFO [main] AmbariServer:439 - Joined the Server
  16:52:27,144  INFO [Thread-2] ContextHandler:795 - stopped 
o.e.j.s.ServletContextHandler{/,null}
  16:52:27,197  INFO [Thread-2] ShutdownThread:82 - shutdown already commenced
{noformat}

*Note:* when I use ansible 'service' module, it works well, but I need to use 
'shell' module, because it is called from longer shell script (direct call 
{{ambari-server restart}} is just reproducer). Also restarting other services 
this way (e.g. ambari-agent) works well.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to