Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FCM-81] Sleep for 30 seconds to ensure Kafka is stable #49

Merged
merged 1 commit into from
Dec 5, 2019

Conversation

TimGrist
Copy link
Contributor

Sleep for 60 seconds to ensure Kafka is stable

@TimGrist TimGrist force-pushed the kafkasleep branch 8 times, most recently from c32148f to f7d1f1b Compare December 2, 2019 14:31
Copy link
Contributor

@wojtek-oledzki wojtek-oledzki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pure Awesomeness!

Pure Awesomeness

@wojtek-oledzki wojtek-oledzki changed the title [FCM-81] Sleep for 60 seconds to ensure Kafka is stable [FCM-81] Sleep for 30 seconds to ensure Kafka is stable Dec 2, 2019
@dennisconrad
Copy link
Contributor

Thank you for this PR!

We are already waiting for the port to appear:

- name: Wait for Kafka port
  wait_for:
    host: "{{ sansible_kafka_listen_address }}"

What does waiting 30s before that add to this?

@wojtek-oledzki
Copy link
Contributor

@dennisconrad it's for cases when Kafka does starts up, and port 9092 is available, but then due to config error Kafka dies

@dennisconrad
Copy link
Contributor

That still doesn't explain why we're waiting for 30s before we're even checking for the port :-) I would understand the other way round, but not like this.

Also, is there another way to ensure Kafka is ready? Can we check a log file instead, something like...

- name: Wait until Kafka is ready
  wait_for:
    path: /var/log/kafka/startup.log
    search_regex: "^Ready\.$"

?

@wojtek-oledzki
Copy link
Contributor

ok, what about

- name: Wait for Kafka port
  wait_for:
    host: "{{ sansible_kafka_listen_address }}"
    port: "{{ sansible_kafka_port }}"
    state: started
    timeout: "{{ sansible_kafka_wait_for_kafka_port }}"

- name: "Check again after {{ sansible_kafka_waitfor_delay }} seconds to ensure Kafka is stable"
  wait_for:
    delay: "{{ sansible_kafka_waitfor_delay }}"
    host: "{{ sansible_kafka_listen_address }}"
    port: "{{ sansible_kafka_port }}"
    state: started
    timeout: "{{ sansible_kafka_wait_for_kafka_port }}"

@dennisconrad
Copy link
Contributor

How about...

- name: Wait for Kafka port
  wait_for:
    delay: "{{ sansible_kafka_waitfor_delay }}"
    host: "{{ sansible_kafka_listen_address }}"
    port: "{{ sansible_kafka_port }}"
    state: started
    timeout: "{{ sansible_kafka_wait_for_kafka_port }}"
  with_items: [1, 2, 3]
  1. Wait 30 seconds
  2. Wait for port
  3. Wait 30 seconds
  4. Wait for port
  5. Wait 30 seconds
  6. Wait for port

If either of 2, 4, 6 times out, the task fails.

@TimGrist
Copy link
Contributor Author

TimGrist commented Dec 5, 2019

  TASK [kafka : Wait for Kafka port] *********************************************
    ok: [sansible_kafka-xenial] => (item=Initial check)
    ok: [sansible_kafka-bionic] => (item=Initial check)
    ok: [sansible_kafka-xenial] => (item=Second check)
    ok: [sansible_kafka-bionic] => (item=Second check)

@dennisconrad dennisconrad merged commit e1ed14c into sansible:develop Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants