Skip to content

[Bug]: Make Elasticsearch service restart after config change more graceful #343

Description

@frankhetterich

Describe the feature request

We updated our Elasticsearch instances to Version 8.15.0 using the Rolling update feature of the collection, which works good. The cluster was available all the time.

With the update we changed some parameters in the Elasticsearch config. Now the Collection performs the parameter change as part of the "normal" installation process, after all Nodes where updated. This means the config is changed on all nodes and all Nodes are restarted at once using a handler. This full cluster restart causes that the cluster is unavailable for some time.

For us it makes no sense to perform a rolling update with a lot of tasks to make shure that the Cluster is available all the time and perform afterwards a full cluster restart which leads to the opposite.

Please implement a "graceful" cluster restart (with rolling restarts and cluster health checks) after a config change of Elasticsearch

Activity

  1. ivareri commented on Aug 29, 2024

    @ivareri
    Contributor

    ouch.

    I'd say this is a bug and not a feature. Should be easy enough to create a handler for a rolling cluster restart (all the code is in the repo already), but I'm not sure how to best handle it without duplicating most of the code from elasticsearch-rolling-upgrade.yml in a handler.

    Is there a way to inject tasks into a handler? have two tasks files, one with all the tasks to gracefully stop a node, and one with everything to bring it back online and wait for cluster to become green. They could then be included in both a cluster restart handler and the rolling-upgrade file?

    So the handler would look something like this:

     - name: Gracefully stop node
          ansible.builtin.include_tasks:
            file: cluster_restart_stop_node.yaml
            
     - name: Start node and wait for green cluster
          ansible.builtin.include_tasks:
            file: cluster_restart_start_node.yaml        

    And the Be careful about upgrade when Elasticsearch is running block in elasticsearch-rolling-upgrade.yml would be reduced to something like this

     - name: Gracefully stop node
          ansible.builtin.include_tasks:
            file: cluster_restart_stop_node.yaml
    
    # Tasks to upgrade packages        
    
     - name: Start node and wait for green cluster
          ansible.builtin.include_tasks:
            file: cluster_restart_start_node.yaml        
    
  2. widhalmt commented on Sep 25, 2024

    @widhalmt
    Member

    Good find and sorry for your bad experience. Yes, definitely a bug. We'll look into it. Thanks also for the suggestions, @ivareri .

  3. added
    bugExisting behaviour is wrong or broken
    and removed
    featureNew capability or new variable for users
    on Sep 25, 2024
  4. self-assigned this
    on Sep 25, 2024
  5. added a commit that references this issue on Oct 24, 2024
    b57009e
  6. widhalmt commented on Oct 24, 2024

    @widhalmt
    Member

    This problem gave me a real headache. I pushed a Draft PR with your idea. That should actually work, but I'm afraid this will need quite extensive testing.

  7. added a commit that references this issue on Jun 17, 2025
    bcaa1a1
  8. removed
    bugExisting behaviour is wrong or broken
    on Sep 24, 2025
  9. changed the title [-][Feature]: Make Elasticsearch service restart after config change more graceful[/-] [+][Bug]: Make Elasticsearch service restart after config change more graceful[/+] on Sep 24, 2025
  10. added theissue type on Sep 24, 2025
  11. added a commit that references this issue on Sep 26, 2025
    2fa1134
  12. modified the milestones: 1.0.0, 2.0.0 on Jun 24, 2026
  13. modified the milestones: 2.0.0, 1.0.0 on Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions