Configuring discovery.seed_hosts gives Elasticsearch nodes a reliable set of peers to contact during startup, reducing discovery delays and avoiding isolated nodes after restarts or brief network interruptions.
Elasticsearch discovers peers and elects a master over the transport protocol, using addresses in discovery.seed_hosts as the first contact points. Each node reads discovery.seed_hosts from /etc/elasticsearch/elasticsearch.yml and connects to those transport hosts to find master-eligible nodes and retrieve the current cluster state.
Seed hosts must be reachable on the transport port (typically 9300) between nodes, and every node in the cluster must share the same cluster.name value. Brand new clusters also require bootstrap settings such as cluster.initial_master_nodes, which is separate from seed host configuration.
Steps to set Elasticsearch discovery seed hosts:
- Open the Elasticsearch configuration file.
$ sudo nano /etc/elasticsearch/elasticsearch.yml
- Set the cluster.name value for the cluster.
Nodes with different cluster.name values form separate clusters, never joining each other.
cluster.name: search-cluster
- Set the discovery.seed_hosts list to transport addresses of master-eligible nodes.
Use stable IPs or DNS names; entries use the transport port, typically 9300.
discovery.seed_hosts: ["node-01:9300", "node-02:9300", "node-03:9300"]
- Restart the Elasticsearch service.
$ sudo systemctl restart elasticsearch
Restarting elasticsearch stops the node briefly, which can trigger shard recovery on small clusters.
- Confirm the Elasticsearch service is running after the restart.
$ sudo systemctl status elasticsearch ● elasticsearch.service - Elasticsearch Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; preset: enabled) Active: active (running) since Tue 2026-01-06 11:49:39 UTC; 5s ago ##### snipped #####Use journalctl -u elasticsearch when the service does not reach active (running).
- List cluster nodes from the local Elasticsearch HTTP endpoint.
$ curl -s "http://localhost:9200/_cat/nodes?v&h=ip,name,node.role,master" ip name node.role master 192.0.2.40 node-01 cdfhilmrstw - 192.0.2.41 node-02 cdfhilmrstw * 192.0.2.42 node-03 cdfhilmrstw -
Secured clusters require https, a trusted CA (--cacert), and authentication.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
