报错一:
elasticsearch报 NoNodeAvailableException[None of the configured nodes are available: [{#transpor...
解决方案:
yml配置文件和项目中保持节点名称一致,例如:cluster.name: elasticsearch
报错二:
集群健康值: 未连接
http.port: 9200
transport.tcp.port: 9300
network.host: 0.0.0.0
cluster.name: elasticsearch
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"
报错三:
集群健康值: yellow (15 of 30)
Elasticsearch采用默认配置(5分片,1副本),但实际只部署了单节点集群。由于只有一个节点,因此群集无法放置副本,因此处于黄色状态。
elasticsearch 索引的默认配置如下:
index.number_of_shards:5
index.number_of_replicas:1
因此我们在只有一台机器的时候,新建索引要这么建立
PUT /索引名
{
"settings":{
"number_of_shards":1,
"number_of_replicas":0
}
}