0

I am banging my head for the past two days on this one. I have setup an elasticsearch cluster of two nodes. The configuration of each node is pretty simple:

node.name: "server1"
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: 192.168.1.212,192.168.1.213
index.store.compress.stored: True
index.store.compress.tv: True
index.number_of_shards: 5
compress.default.type: lzf
cluster.name: mycluster
discovery.zen.minimum_master_nodes: 1
discovery.zen.ping.timeout: 60
index.number_of_replicas: 1

The cluster nodes "See" each other and expected shards are generated, however not the replicas. When I use the "head" plugin (web UI for elasticsearch) I cannot see only primary shards not replicas. This is also confirmed from the status of elasticsearch:

 curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'
 {
  "cluster_name" : "server1",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 2,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 10,
  "active_shards" : 10,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0
}

Also something else i noticed on the running settigns of elasticsearch is that replicas are set 0:

curl -XGET 'http://localhost:9200/_settings?pretty=true'
{
  "date" : {
    "settings" : {
      "index" : {
        "refresh_interval" : "1s",
        "number_of_shards" : "5",
        "creation_date" : "1447756143035",
        "store" : {
          "type" : "fs"
        },
        "uuid" : "mpVS_BB9R0WvoF0h8pFVfQ",
        "version" : {
          "created" : "1040299"
        },
        "number_of_replicas" : "0"
      }
    }
  },
  "scores" : {
    "settings" : {
      "index" : {
        "refresh_interval" : "1s",
        "number_of_shards" : "5",
        "creation_date" : "1447756144186",
        "store" : {
          "type" : "fs"
        },
        "uuid" : "KUlfG4UhQfmMP1L3xQiJOQ",
        "version" : {
          "created" : "1040299"
        },
        "number_of_replicas" : "0"
      }
    }
  }
}

Any ideas why no replicas are created?

1 Answer 1

1

Based on the output of the last command, your two indices don't have replicas because you haven't told them to.

You'll need to update your index settings, changing the "number_of_replicas" to whatever number of replicas you want.

The Update Indices Settings page of the ES docs has an example of exactly this.

This will change all indices to 1 replicas:

curl -XPUT 'localhost:9200/_settings' -d '
{
  "index" : {
    "number_of_replicas" : 1
  }
}'

This will change just the scores index to 4 replicas:

curl -XPUT 'localhost:9200/scores/_settings' -d '
{
  "index" : {
    "number_of_replicas" : 4
  }
}'
2
  • Thanks for the reply. Thing is, why the indices have no replicas since i have explicitly state that on my config "index.number_of_replicas: 1"
    – giomanda
    Nov 18, 2015 at 13:02
  • 1
    Not sure. Might be caused by templates if you have them, or that setting is being overwritten by a later config. Either way, that should probably be asked in another question.
    – GregL
    Nov 18, 2015 at 13:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .