一.节点退役当集群中个别节点出现故障预警等情况,需要进行退役工作,即让所有位于该退役节点上的分片的数据分配到其他节点上后,再将此节点关闭并从集群中移除. 1.ES提供了让某个节点上所有数据都移走的功能如下: ElasticSearch集群就会自动把这个节点上的所有分片,都自动转移到其他节点上,等到转移完成,这个空节点就可以毫无影响的下线. curl -XPUT 127.0.0.1:9200/_cluster/settings -d '{ "transient" :{ "clu…
一.精确定位到有问题的shards 1.查看哪些分片未被分配 curl -XGET localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED 2.如果您运行的是Elasticsearch的5+版本,您还可以使用群集分配说明API来尝试获取有关分片分配问题的更多信息: curl -XGET localhost:9200/_cluster/allocation/explain?pr…
Recovering unassigned shards on elasticsearch 2.x 摘自:https://z0z0.me/recovering-unassigned-shards-on-elasticsearch/ I got accross the problem when decided to add a node to the elasticsearch cluster and that node was not able to replicate the indexes…
How to resolve unassigned shards in Elasticsearch 转自:https://www.datadoghq.com/blog/elasticsearch-unassigned-shards/   In Elasticsearch, a healthy cluster is a balanced cluster: primary and replica shards are distributed across all nodes for durable…
Red Cluster! 摘自:http://blog.kiyanpro.com/2016/03/06/elasticsearch/reroute-unassigned-shards/ There are 3 cluster states: green: All primary and replica shards are active yellow: All primary shards are active, but not all replica shards are active red…
在生产环境下,如果不修改elasticsearch节点的角色信息,在高数据量,高并发的场景下集群容易出现脑裂等问题. 默认情况下,elasticsearch集群中每个节点都有成为主节点的资格,也都存储数据,还可以提供查询服务.这些功能是由两个属性控制的.node.master和node.data默认情况下这两个属性的值都是true. 下面详细介绍一下这两个属性的含义以及不同组合可以达到的效果.node.master:这个属性表示节点是否具有成为主节点的资格注意:此属性的值为true,并不意味着这…
一.datanode添加新节点 1 在dfs.include文件中包含新节点名称,该文件在名称节点的本地目录下 [白名单] [s201:/soft/hadoop/etc/hadoop/dfs.include] 2  在hdfs-site.xml文件中添加属性 <property> <name>dfs.hosts</name> <value>/soft/hadoop/etc/dfs.include.txt</value> </property…
根本原因: 是因为集群存在没有启用的副本分片,我们先来看一下官网给出的副本分片的介绍: 副本分片的主要目的就是为了故障转移,正如在 集群内的原理 中讨论的:如果持有主分片的节点挂掉了,一个副本分片就会晋升为主分片的角色. 那么可以看出来副本分片和主分片是不能放到一个节点上面的,可是在只有一个节点的集群里,副本分片没有办法分配到其他的节点上,所以出现所有副本分片都unassigned得情况.因为只有一个节点,如果存在主分片节点挂掉了,那么整个集群理应就挂掉了,不存在副本分片升为主分片的情况. 解决…
先通过命令查看节点的shard分配整体情况 curl -X GET "ip:9200/_cat/allocation?v" 说明:有16个索引未分片 2.查看未分片的索引 curl -XGET ip:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED 说明:第一列索引名称.第二列分片名称.第三列主分片还是副本分片(p:主分片,r:副分片).第四列分片状态.第五列未分片原因(DANG…
查看ES各个分片的状态 $ curl -XGET http://127.0.0.1:9200/_cluster/health?pretty { "cluster_name" : "elasticsearch_brew", "status" : "yellow", "timed_out" : false, "number_of_nodes" : 1, "number_of_dat…