discovery-file.asciidoc 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. [[discovery-file]]
  2. === File-Based Discovery Plugin
  3. The file-based discovery plugin uses a list of hosts/ports in a `unicast_hosts.txt` file
  4. in the `config/discovery-file` directory for unicast discovery.
  5. :plugin_name: discovery-file
  6. include::install_remove.asciidoc[]
  7. [[discovery-file-usage]]
  8. [float]
  9. ==== Using the file-based discovery plugin
  10. The file-based discovery plugin provides the ability to specify the
  11. unicast hosts list through a simple `unicast_hosts.txt` file that can
  12. be dynamically updated at any time. To enable, add the following in `elasticsearch.yml`:
  13. [source,yaml]
  14. ----
  15. discovery.zen.hosts_provider: file
  16. ----
  17. This plugin simply provides a facility to supply the unicast hosts list for
  18. zen discovery through an external file that can be updated at any time by a side process.
  19. For example, this gives a convenient mechanism for an Elasticsearch instance
  20. that is run in docker containers to be dynamically supplied a list of IP
  21. addresses to connect to for zen discovery when those IP addresses may not be
  22. known at node startup.
  23. Note that the file-based discovery plugin is meant to augment the unicast
  24. hosts list in `elasticsearch.yml` (if specified), not replace it. Therefore,
  25. if there are valid unicast host entries in `discovery.zen.ping.unicast.hosts`,
  26. they will be used in addition to those supplied in `unicast_hosts.txt`.
  27. Anytime a change is made to the `unicast_hosts.txt` file, even as Elasticsearch
  28. continues to run, the new changes will be picked up by the plugin and the
  29. new hosts list will be used for the next pinging round for master election.
  30. Upon installation of the plugin, a default `unicast_hosts.txt` file will
  31. be found in the `$CONFIG_DIR/discovery-file` directory. This default file
  32. will contain some comments about what the file should contain. All comments
  33. for this file must appear on their lines starting with `#` (i.e. comments
  34. cannot start in the middle of a line).
  35. [[discovery-file-format]]
  36. [float]
  37. ==== unicast_hosts.txt file format
  38. The format of the file is to specify one unicast host entry per line.
  39. Each unicast host entry consists of the host (host name or IP address) and
  40. an optional transport port number. If the port number is specified, is must
  41. come immediately after the host (on the same line) separated by a `:`.
  42. If the port number is not specified, a default value of 9300 is used.
  43. For example, this is an example of `unicast_hosts.txt` for a cluster with
  44. four nodes that participate in unicast discovery, some of which are not
  45. running on the default port:
  46. [source,txt]
  47. ----------------------------------------------------------------
  48. 10.10.10.5
  49. 10.10.10.6:9305
  50. 10.10.10.5:10005
  51. # an IPv6 address
  52. [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:9301
  53. ----------------------------------------------------------------
  54. Host names are allowed instead of IP addresses (similar to
  55. `discovery.zen.ping.unicast.hosts`), and IPv6 addresses must be
  56. specified in brackets with the port coming after the brackets.