Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Updating unicast_hosts.txt without pod restart #14

Open
balbirthomas opened this issue Oct 16, 2020 · 1 comment
Open

Updating unicast_hosts.txt without pod restart #14

balbirthomas opened this issue Oct 16, 2020 · 1 comment
Labels
question Further information is requested

Comments

@balbirthomas
Copy link

Is it possible to have unicast_hosts.txt updated without restarting the pod.

@balbirthomas balbirthomas added the question Further information is requested label Oct 19, 2020
@justinmclark
Copy link
Contributor

I can confirm that unicast_hosts.txt can be updated without restarting the pod. Here are the steps I took:

  1. In __init__(), configure the starting self._stored.nodes to only have one hostname, rather than SEED_SIZE. [1]
  2. Remove the unicast_hosts.txt string from _config_hash() so pod restarts aren't triggered by changes to the file. [2]
  3. Add a unit to the cluster and _on_elasticsearch_unit_joined() will add a new hostname to self._stored.nodes.
  4. kubectl exec -n lma <leader-pod> -- cat /usr/share/elasticsearch/config/unicast_hosts.txt and see that the new host has been added to the file without the pod resetting.

One thing to be aware of is that unicast_hosts.txt is only updated in the leader pod and new pods.

[1]
Change

self._stored.set_default(nodes=[self._host_name(i)
                                for i in range(SEED_SIZE)])

to

self._stored.set_default(nodes=[self._host_name(0)])

[2]
Change

config_string = self._seed_hosts() + self._elasticsearch_config() +\
    self._jvm_config() + self._logging_config() + self._log4j_config()

to

config_string = self._elasticsearch_config() +\
    self._jvm_config() + self._logging_config() + self._log4j_config()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants