You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2018/06/11 15:32:07 UTC

[incubator-openwhisk] branch master updated: Change how to detect zookeeper is ready (#3486)

This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new f55af05  Change how to detect zookeeper is ready (#3486)
f55af05 is described below

commit f55af05535c36bed04c798b1ff62e81442517acd
Author: Jonathan Springer <jo...@gmail.com>
AuthorDate: Mon Jun 11 11:32:02 2018 -0400

    Change how to detect zookeeper is ready (#3486)
    
    'dump' is the command to zookeeper which causes it to show the list of who's registered, which we then grep to see that the kafka has registered itself.  See documentation at https://zookeeper.apache.org/doc/r3.1.2/zookeeperAdmin.html#sc_zkCommands.  For example, this is the output of `echo dump | nc 172.17.0.1 2181` on my current OpenWhisk test environment:
    
    ```
    SessionTracker dump:
    Session Sets (3):
    0 expire at Fri Jan 09 22:27:18 GMT 1970:
    0 expire at Fri Jan 09 22:27:20 GMT 1970:
    1 expire at Fri Jan 09 22:27:22 GMT 1970:
    	0x1002de25dd20000
    ephemeral nodes dump:
    Sessions with Ephemerals (1):
    0x1002de25dd20000:
    	/controller
    	/brokers/ids/0
    ```
    
    The `/brokers/ids/0` is the kafka broker registering.
---
 ansible/roles/kafka/tasks/deploy.yml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ansible/roles/kafka/tasks/deploy.yml b/ansible/roles/kafka/tasks/deploy.yml
index 9dca8c3..a5de38b 100644
--- a/ansible/roles/kafka/tasks/deploy.yml
+++ b/ansible/roles/kafka/tasks/deploy.yml
@@ -88,8 +88,11 @@
   delay: "{{ docker.pull.delay }}"
 
 - name: wait until the kafka server started up
-  shell: docker logs kafka{{ groups['kafkas'].index(inventory_hostname) }}
+  shell:
+    (echo dump; sleep 1) |
+    nc {{hostvars[groups['zookeepers']|first].ansible_host}} {{zookeeper.port}} |
+    grep /brokers/ids/{{ groups['kafkas'].index(inventory_hostname) }}
   register: result
-  until: (('[Kafka Server ' + (groups['kafkas'].index(inventory_hostname)|string) + '], started') in result.stdout)
+  until: (result.rc == 0)
   retries: 10
   delay: 5

-- 
To stop receiving notification emails like this one, please contact
rabbah@apache.org.