How to add a new node to my Elasticsearch cluster

后端 未结 5 1211

My cluster has a yellow health as it has only one single node, so the replicas remain unasigned simply because no other node is available to contain them.

5条回答
  •  臣服心动
    2020-12-14 02:08

    Complete steps on Windows Box are:

    1. unzip elastic, say, to C:\ELK\elastic\ run command bin\service install elastic-search-x64-node01 which will create service named elastic-search-x64-node01
    2. edit elasticsearch.yml config file:

      cluster.name: Animals
      node.name: Snake
      node.master: true
      node.data: true
      path.data: C:\ELK\storage\data
      path.logs: C:\ELK\storage\logs
      http.port: 9200
      discovery.zen.ping.multicast.enabled: false
      discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
      
    3. run service manager elastic-search-x64-node01 and set-up your services rules and start the service

    4. unzip elastic, say, to C:\ELK\elastic2\ run command bin\service install elastic-search-x64-node02 which will create service named elastic-search-x64-node02

    5. edit elasticsearch.yml config file:

      cluster.name: Animals
      node.name: Baboon
      node.master: false
      node.data: true
      path.data: C:\ELK\storage\data
      path.logs: C:\ELK\storage\logs
      http.port: 9201
      discovery.zen.ping.multicast.enabled: false
      discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
      
    6. run service manager elastic-search-x64-node02 and set-up your services rules and start the service

    At this point you have 2 separate nodes (they store data in the same folder, but I'm too laze to edit path.data for second node) 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
    }
    

提交回复
热议问题