Description
elasticsearch-7.9.2 是集群并带有密码 使用 elasticsearch-sql-jdbc-7.9.2 连接时有问题
es是集群,并带有密码
elasticsearch.yml中
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12
elasticsearch版本为7.9.2
elasticsearch-sql插件版本为 elasticsearch-sql-plugin.zip(7.9.2)
jdbc版本为: elasticsearch-sql-core-7.9.2.jar、elasticsearch-sql-jdbc-7.9.2.jar
使用样例中conn1()方式
多个地址:
private String ES_DB_URL = "jdbc:es://192.168.182.229:9350,192.168.182.230:9350,192.168.182.231:9350/alarm-20211117?useSSL=true&mode=cluster";
报如下错;
Caused by: java.net.UnknownHostException: 192.168.182.229:9350,192.168.182.230:9350,192.168.182.231: invalid IPv6 address
at java.net.InetAddress.getAllByName(InetAddress.java:1169)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$InternalAddressResolver.resolveRemoteAddress(PoolingNHttpClientConnectionManager.java:664)
18:56:55.119 [main] DEBUG org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager - Connection request failed
java.net.UnknownHostException: 192.168.182.229:9350,192.168.182.230:9350,192.168.182.231: invalid IPv6 address
at java.net.InetAddress.getAllByName(InetAddress.java:1169)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$InternalAddressResolver.resolveRemoteAddress(PoolingNHttpClientConnectionManager.java:664)
单个地址:
private String ES_DB_URL = "jdbc:es://192.168.182.230:9350/alarm-20211117?useSSL=true&mode=cluster"
报错如下:
19:13:14.906 [I/O dispatcher 2] DEBUG org.apache.http.impl.nio.client.InternalIODispatch - http-outgoing-1 [ACTIVE] Exception
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.EngineInputRecord.bytesInCompletePacket(EngineInputRecord.java:156)
at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:868)
at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)
19:13:14.910 [main] DEBUG org.elasticsearch.client.RestClient - request [POST https://192.168.182.230:9350/alarm-20211117/_search?typed_keys=true&max_concurrent_shard_requests=5&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled=true&scroll=1m&search_type=query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true] failed
java.util.concurrent.ExecutionException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at org.apache.http.concurrent.BasicFuture.getResult(BasicFuture.java:71)
at org.apache.http.concurrent.BasicFuture.get(BasicFuture.java:84)
at org.apache.http.impl.nio.client.FutureWrapper.get(FutureWrapper.java:70)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:255)
使用的依赖
io.github.iamazy.elasticsearch.dsl
elasticsearch-sql-core
7.9.2
io.github.iamazy.elasticsearch.dsl
elasticsearch-sql-jdbc
7.9.2