How to create two nodes in a single system

I found the solution @stackoverflow

Complete steps on Windows Box are:

  1. unzip elastic, go to C:\ELK\elastic run the following command bin\elasticsearch-service.bat install enode1 which will create service named enode1
  2. edit elasticsearch.yml config file:

cluster.name: Animals
node.name: Snake
node.master: true
node.data: true
path.data: C:\ELK\storage\snake\data
path.logs: C:\ELK\storage\snake\logs
http.port: 9200

  1. run service manager enode1 and set-up your services rules and start the service
    if service manager fails, start manually use the following command bin/elasticsearch.bat

  2. unzip elastic, go to C:\ELK\elastic2 run the following command bin\elasticsearch-service.bat install enode2 which will create service named enode2

  3. edit elasticsearch.yml config file:

cluster.name: Animals
node.name: Baboon
node.master: true
node.data: true
path.data: C:\ELK\storage\baboon\data
path.logs: C:\ELK\storage\baboon\logs
http.port: 9201

  1. run service manager enode2 and set-up your services rules and start the service
    if service manager fails, start manually use the following command bin/elasticsearch.bat

  2. At this point you have 2 separate nodes as 2 separate Windows Services and GET http://localhost:9200/_cluster/health shows something like:

{
"cluster_name": "Animals",
"status": "green",
"timed_out": false,
"number_of_nodes": 2,
"number_of_data_nodes": 2,
"active_primary_shards": 4,
"active_shards": 8,
"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
}

1 Like