How to Run Multiple Elasticsearch Nodes on a Single Server (Step‑by‑Step Guide)
This tutorial explains how to set up two Elasticsearch nodes on one machine by copying the installation directory, adjusting configuration files, starting each node, verifying cluster health with curl or Kibana, and addressing common pitfalls such as port conflicts and master‑node settings.
Usually a single server runs one Elasticsearch node, but for learning you may want multiple nodes on the same machine to simulate a distributed cluster.
Step 1: Duplicate the Elasticsearch directory
# cp -R elasticsearch-5.0.2 elasticsearch-5.0.2-node-2
$ ls -l
drwxr-xr-x 12 wuxiwei staff 408 Dec 12 16:23 elasticsearch-5.0.2
drwxr-xr-x 12 wuxiwei staff 408 Dec 12 16:27 elasticsearch-5.0.2-node-2Step 2: Edit elasticsearch.yml for the second instance
Change node.name: node-1 to node.name: node-2 and adjust ports if needed.
Step 3: Start both nodes
# cd ~/software/elasticsearch-5.0.2
$ ./bin/elasticsearch
# cd ../elasticsearch-5.0.2-node-2
$ ./bin/elasticsearchVerify the cluster health:
$ curl -i -XGET 'http://localhost:9200/_cluster/health?pretty'
{
"cluster_name":"my",
"status":"green",
"number_of_nodes":2,
"number_of_data_nodes":2,
"active_primary_shards":20,
"active_shards":40,
"relocating_shards":0,
"initializing_shards":0,
"unassigned_shards":0,
"delayed_unassigned_shards":0,
"number_of_pending_tasks":0,
"number_of_in_flight_fetch":0,
"task_max_waiting_in_queue_millis":0,
"active_shards_percent_as_number":100.0
}You can also view the nodes in Kibana.
Common pitfalls
If you change http.port or transport.tcp.port, ensure each node uses a different value.
Node‑1 may warn about discovery.zen.minimum_master_nodes. Set node.master: false on the second node or increase the minimum master nodes setting.
Make sure the data directory of the second node is empty; otherwise the node may fail to join because it reuses the first node’s data.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
