首页 > 其他分享 >es:curl访问es时返回为空(elasticsearch 8.14.2)

es:curl访问es时返回为空(elasticsearch 8.14.2)

时间:2024-07-08 13:53:19浏览次数:11  
标签:9200 blog elasticsearch 为空 lhdop curl es

一,返回为空:

[lhdop@blog ~]$ curl localhost:9200/_cluster/health?pretty
curl: (52) Empty reply from server
[lhdop@blog ~]$ curl localhost:9200
curl: (52) Empty reply from server
[lhdop@blog ~]$ curl http://localhost:9200
curl: (52) Empty reply from server

查看日志:

[2024-07-08T13:14:29,123][WARN ][o.e.c.r.a.DiskThresholdMonitor] [blog] flood stage disk watermark [95%] 
exceeded on [xcmI6v6SSFKqLp5qXM-sOw][blog][/usr/local/soft/elasticsearch/data] free: 1.7gb[1.7%],
all indices on this node will be marked read-only

得知磁盘使用率超出阈值,es索引模式变为只读,无法写入数据,从而返回数据失败 

解决:

  • 清理磁盘空间

因为Elasticsearch 会对磁盘空间进行监控,当磁盘剩余空间达到了 floodstage 阈值,会将所有相关索引强制置为只读。

需要清理磁盘空间后,才能写入数据。

 

二,返回为空,日志中报错:

[2024-07-08T13:29:32,165][WARN ][o.e.h.n.Netty4HttpServerTransport] 
[blog] received plaintext http traffic on an https channel, 
closing connection Netty4HttpChannel{localAddress=/127.0.0.1:9200, remoteAddress=/127.0.0.1:60490}

错误原因:ES8默认开启了 ssl 认证。
解决方案:elasticsearch.yml配置文件
xpack.security.enabled设置为false

修改配置文件:

[lhdop@blog logs]$ cd /usr/local/soft/elasticsearch/config/
[lhdop@blog config]$ vi elasticsearch.yml 

修改内容:

# xpack.security.enabled: true
xpack.security.enabled: false

修改完成重启服务,
可以正常返回数据了:

[lhdop@blog config]$ curl localhost:9200
{
  "name" : "blog",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "aAr5708zRyS0wQZ9FcNdkA",
  "version" : {
    "number" : "8.14.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "2afe7caceec8a26ff53817e5ed88235e90592a1b",
    "build_date" : "2024-07-01T22:06:58.515911606Z",
    "build_snapshot" : false,
    "lucene_version" : "9.10.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

 

三,查看es的版本:

[lhdop@blog config]$ /usr/local/soft/elasticsearch/bin/elasticsearch --version
warning: ignoring JAVA_HOME=/usr/local/soft/jdk-15; using bundled JDK
Version: 8.14.2, Build: tar/2afe7caceec8a26ff53817e5ed88235e90592a1b/2024-07-01T22:06:58.515911606Z, JVM: 22.0.1

 

标签:9200,blog,elasticsearch,为空,lhdop,curl,es
From: https://www.cnblogs.com/architectforest/p/18289737

相关文章