作者:火影魂XJ_710 | 来源:互联网 | 2023-10-17 15:46
Elastic Search成功安装完毕。
测试数据添加出现
{
"error": {
"root_cause": [
{
"type": "cluster_block_exception",
"reason": "blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];[SERVICE_UNAVAILABLE/2/no master];",
"suppressed": [
{
"type": "master_not_discovered_exception",
"reason": null
}
]
}
],
"type": "cluster_block_exception",
"reason": "blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];[SERVICE_UNAVAILABLE/2/no master];",
"suppressed": [
{
"type": "master_not_discovered_exception",
"reason": null
}
]
},
"status": 503
}
Elastic Search 日志:
[2019-05-23T23:07:10,500][WARN ][o.e.c.c.ClusterFormationFailureHelper] [wei] master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes [node-1] to bootstrap a cluster: have discovered []; discovery will continue using [127.0.0.1:9300, 127.0.0.1:9301, 127.0.0.1:9302, 127.0.0.1:9303, 127.0.0.1:9304] from hosts providers and [{wei}{PRIUiwNlS3iosprI-SrhAg}{y4smTin2RZipIaDS7cc6qQ}{172.21.0.11}{172.21.0.11:9300}{ml.machine_memory=1928081408, xpack.installed=true, ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted version 0 in term 0
##################################################################################################
解决办法:
1、先关闭Elastic,【只有一个java服务,所以直接killall 】
killall java
2、释放下内存,查看内存是否释放成功
echo 3 > /proc/sys/vm/drop_caches
free -m
3、找到elastic的config 目录
mv elasticsearch.yml elasticsearch.yml.bak
4、尝试启动一下Elastic Search,启动完成之后看下9200和9300是否占用
bin/elasticsearch &
5、然后再把Elastic Search关闭 【:捂脸】
killall java
6、再把备份的文件还原一下【:捂脸】
cp elasticsearch.yml.bak elasticsearch.yml
7、尝试重新启动一下【:捂脸】
bin/elasticsearch &
8、查看端口是否启用,浏览器输入 ip:9200,在使用postman测试一下,成功添加
{
"_index": "shopuser",
"_type": "_doc",
"_id": "1",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 0,
"_primary_term": 1
}
####################################################################################################
具体没有找到,这样走了一遍,问题解决了,感觉可能是缓存导致的,需要下次在验证一下