ElasticSearch所有分片都保持未分配状态(将routing.allocation设置为all)

时间:2016-06-17 07:25:35

标签: elasticsearch

为什么没有分配我的分片? (ES 2.3)

创建索引:

PUT 'host:9200/entities?pretty' -d ' {
  "mappings": {
      x
    }
  },
  "settings" : {
    "index" : {
        "number_of_shards" : 6, 
        "number_of_replicas" : 1
    }
  }
}'

群集设置:

GET 'host:9200/_cluster/settings?pretty'
{
  "persistent" : {
    "cluster" : {
      "routing" : {
        "allocation" : {
          "enable" : "all"
        }
      }
    }
  },
  "transient" : {
    "cluster" : {
      "routing" : {
        "allocation" : {
          "enable" : "all"
        }
      }
    }
  }
}

集群:

host          master 
node3         m  
node2         m
node1         * 

碎片

GET 'host:9200/_cat/shards?v'
index    shard prirep state      docs store ip node 
entities 5     p      UNASSIGNED                    
entities 5     r      UNASSIGNED                    
entities 1     p      UNASSIGNED                    
entities 1     r      UNASSIGNED                    
entities 4     p      UNASSIGNED                    
entities 4     r      UNASSIGNED                    
entities 2     p      UNASSIGNED                    
entities 2     r      UNASSIGNED                    
entities 3     p      UNASSIGNED                    
entities 3     r      UNASSIGNED                    
entities 0     p      UNASSIGNED                    
entities 0     r      UNASSIGNED 

我可以通过路由API直接分配节点,但这似乎不是等待的时间。

如果我以不同方式设置群集,使用1个主节点和2个数据节点,则不会出现此问题。但是

1 个答案:

答案 0 :(得分:0)

原来我错误解释了node.masternode.data设置。我认为它必须是或者。

将所有三个节点设置为node.master: truenode.data: true,现在它就像魅力一样。