Elasticsearch discovery.seed_hosts Setting

Pulse - Elasticsearch Operations Done Right

On this page

Example Common Issues Do's and Don'ts Frequently Asked Questions

The discovery.seed_hosts setting in Elasticsearch is crucial for initial cluster formation and node discovery. It specifies a list of other nodes in the cluster that are likely to be live and contactable.

  • Default Value: ["127.0.0.1", "[::1]"]
  • Possible Values: List of hostnames, IP addresses, or IP ranges
  • Recommendations:
    • Configure this setting with a list of master-eligible nodes in your cluster
    • Use stable addresses to avoid frequent reconfiguration
    • Include more than the minimum number of master-eligible nodes to ensure cluster formation

Example

The discovery.seed_hosts static setting should be set in the elasticsearch.yml file when setting up a cluster:

discovery.seed_hosts: ["10.0.0.1", "10.0.0.2", "10.0.0.3"]

If your master-eligible nodes do not have fixed names or addresses, use an alternative hosts provider to find their addresses dynamically.

Common Issues

  • Misconfiguration leading to split-brain scenarios
  • Using dynamic IP addresses, causing frequent cluster reconfigurations
  • Including non-master-eligible nodes, which can slow down the discovery process

Do's and Don'ts

  • Do use stable, static IP addresses or hostnames
  • Do include all master-eligible nodes in the list
  • Don't use public IP addresses if nodes are in a private network
  • Don't include client nodes or data-only nodes in this list
  • Don't leave this setting empty in a production environment

Frequently Asked Questions

Q: How many hosts should I include in discovery.seed_hosts?
A: Include all master-eligible nodes in your cluster. At a minimum, include enough to form a quorum (majority) of master-eligible nodes.

Q: Can I use hostnames instead of IP addresses?
A: Yes, you can use hostnames, but ensure they are resolvable by all nodes in the cluster.

Q: What happens if a seed host is unreachable?
A: Elasticsearch will attempt to contact other seed hosts. As long as it can reach enough hosts to form a quorum, the cluster will form successfully.

Q: Do I need to update discovery.seed_hosts when adding new nodes?
A: It's not strictly necessary for existing nodes, but it's a good practice to keep it updated, especially for new nodes joining the cluster.

Q: Is discovery.seed_hosts used after the cluster is formed?
A: This setting is primarily used during initial cluster formation and when a node restarts. Once a node joins the cluster, it maintains its own list of live nodes.

Subscribe to the Pulse Newsletter

Get early access to new Pulse features, insightful blogs & exclusive events , webinars, and workshops.