docker elasticsearch 单节点状态yellow解决方法
kibana+elasticsearch使用ik分词器发现同一个请求,有时会报错,有时成功
原因是单节点状态下无法分配replicas节点,所以单节点下需要将replicas设置为0.
1. 查看
GET /_cluster/health
查看结果:"unassigned_shards" : 5,
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 8,
"active_shards" : 8,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 5,
"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" : 61.53846153846154
}
2. 设置现有的index的副本数量为0个
PUT /_settings"
{
"index": {
"number_of_replicas": 0
}
}
3. 设置新建的index副本数量为0个,(创建模板匹配所有index,并设置副本数量为0)
PUT /_template/template_log"
{
"index_patterns": [
"*"
],
"order": 0,
"settings": {
"number_of_replicas": 0
}
}
参考链接:https://www.jianshu.com/p/947954e4ce88