ElasticSearch~received plaintext http traffic on an https channel, closing connection Netty4HttpChan

一、报错截图

在这里插入图片描述

二、报错代码

[2022-12-29T20:15:12,115][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58029}
[2022-12-29T20:15:12,115][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58028}
[2022-12-29T20:15:12,116][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58030}
[2022-12-29T20:15:13,149][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58031}
[2022-12-29T20:15:13,154][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58032}
[2022-12-29T20:15:13,156][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58033}
[2022-12-29T20:15:18,178][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58034}
[2022-12-29T20:15:18,181][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58035}
[2022-12-29T20:15:20,889][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58036}
[2022-12-29T20:15:20,891][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58037}
[2022-12-29T20:15:50,909][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58069}
[2022-12-29T20:15:50,913][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.10.100:9200, remoteAddress=/192.168.10.1:58070}

三、问题描述

ElasticSearch服务正常启动,但是在浏览器上无法访问http://localhost:9200

四、错误原因

ElasticSearch默认开启了安全认证,需要将安全认证关掉

五、解决办法

将如图所示这两个地方的true修改为false即可在这里插入图片描述

六、成功截图

在这里插入图片描述

  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
在连接ES时,如果出现"javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection"错误,可能是由于尝试在使用SSL/TLS协议的端口上建立非加密的连接导致的。为了解决这个问题,你可以按照以下步骤进行操作: 1. 确保你正在使用正确的端口连接ES。默认情况下,ES使用的是9300端口进行节点间通信,而使用9200端口进行REST API访问。如果你正在使用REST API访问ES,请确保你正在使用9200端口。 2. 确保你的连接代码中使用了正确的SSL/TLS配置。如果你的ES集群启用了SSL/TLS加密,你需要在连接代码中配置正确的SSL/TLS证书和密钥。以下是一个示例代码片段,展示了如何使用Java的RestHighLevelClient连接ES并配置SSL/TLS: ```java import org.apache.http.HttpHost; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.security.user.User; import org.elasticsearch.client.security.user.UserOptions; import org.elasticsearch.client.security.user.UserString; import org.elasticsearch.common.settings.Settings; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; public class ESConnectionExample { public static void main(String[] args) throws Exception { // 配置SSL/TLS信任所有证书 SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, new TrustManager[]{new X509TrustManager() { public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { } public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { } public X509Certificate[] getAcceptedIssuers() { return null; } }}, null); // 配置ES连接 RestClientBuilder builder = RestClient.builder(new HttpHost("localhost", 9200, "https")) .setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder.setSSLContext(sslContext)); RestHighLevelClient client = new RestHighLevelClient(builder); // 使用client进行操作... // 关闭连接 client.close(); } } ``` 请注意,上述代码中的SSLContext配置了一个信任所有证书的TrustManager,这只是为了演示目的。在实际生产环境中,你应该配置正确的证书和密钥以确保安全性。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值