私はその質問がすでに扱われていることを知っていますが、すべての試みで、問題を解決する方法はありません。
Elasticsearchをインストールして起動しました。ここで、エラスティックのログ:
[2017-05-17T00:05:27,290][INFO ][o.e.n.Node ] [] initializing ...
[2017-05-17T00:05:27,394][INFO ][o.e.e.NodeEnvironment ] [xhkU1rX] using [1] data paths, mounts [[Data (D:)]], net usable_space [25gb], net total_space [138.4gb], spins? [unknown], types [NTFS]
[2017-05-17T00:05:27,395][INFO ][o.e.e.NodeEnvironment ] [xhkU1rX] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-05-17T00:05:28,331][INFO ][o.e.n.Node ] node name [xhkU1rX] derived from node ID [xhkU1rXqQ1OgNhIOdfkifg]; set [node.name] to override
[2017-05-17T00:05:28,332][INFO ][o.e.n.Node ] version[5.4.0], pid[7944], build[780f8c4/2017-04-28T17:43:27.229Z], OS[Windows 7/6.1/AMD64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_101/25.101-b13]
[2017-05-17T00:05:30,421][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded module [aggs-matrix-stats]
[2017-05-17T00:05:30,422][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded module [ingest-common]
[2017-05-17T00:05:30,422][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded module [lang-expression]
[2017-05-17T00:05:30,422][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded module [lang-groovy]
[2017-05-17T00:05:30,422][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded module [lang-mustache]
[2017-05-17T00:05:30,422][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded module [lang-painless]
[2017-05-17T00:05:30,423][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded module [percolator]
[2017-05-17T00:05:30,423][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded module [reindex]
[2017-05-17T00:05:30,423][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded module [transport-netty3]
[2017-05-17T00:05:30,423][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded module [transport-netty4]
[2017-05-17T00:05:30,424][INFO ][o.e.p.PluginsService ] [xhkU1rX] loaded plugin [x-pack]
[2017-05-17T00:05:34,242][DEBUG][o.e.a.ActionModule ] Using REST wrapper from plugin org.elasticsearch.xpack.XPackPlugin
[2017-05-17T00:05:34,804][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/11204] [Main.cc@128] controller (64 bit): Version 5.4.0 (Build 120b96fa7f6fa7) Copyright (c) 2017 Elasticsearch BV
[2017-05-17T00:05:34,863][INFO ][o.e.d.DiscoveryModule ] [xhkU1rX] using discovery type [zen]
[2017-05-17T00:05:36,769][INFO ][o.e.n.Node ] initialized
[2017-05-17T00:05:36,772][INFO ][o.e.n.Node ] [xhkU1rX] starting ...
[2017-05-17T00:05:38,384][INFO ][o.e.t.TransportService ] [xhkU1rX] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2017-05-17T00:05:41,441][INFO ][o.e.c.s.ClusterService ] [xhkU1rX] new_master {xhkU1rX}{xhkU1rXqQ1OgNhIOdfkifg}{Ki_4aUviS3m6n36CQ73tVw}{127.0.0.1}{127.0.0.1:9300}{ml.enabled=true}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-05-17T00:05:43,372][INFO ][o.e.l.LicenseService ] [xhkU1rX] license [78f22813-a953-4397-ab90-d9e057e7647e] mode [trial] - valid
[2017-05-17T00:05:43,399][INFO ][o.e.g.GatewayService ] [xhkU1rX] recovered [28] indices into cluster_state
[2017-05-17T00:05:45,462][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [xhkU1rX] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2017-05-17T00:05:45,474][INFO ][o.e.n.Node ] [xhkU1rX] started
[2017-05-17T00:05:47,834][INFO ][o.e.c.r.a.AllocationService] [xhkU1rX] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[my-index][3]] ...]).
そのため、Elasticはポート9300で完全に実行され、リッスンしています。
クラスター名は「my-application」です。
Elasticsearch.ymlによって確認されました:
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
また、 http:// localhost:9200 / をリクエストすることでも確認できます。
{
"name" : "xhkU1rX",
"cluster_name" : "my-application",
"cluster_uuid" : "ygmbc6k0TpKdJP77OJeG9g",
"version" : {
"number" : "5.4.0",
"build_hash" : "780f8c4",
"build_date" : "2017-04-28T17:43:27.229Z",
"build_snapshot" : false,
"lucene_version" : "6.5.0"
},
"tagline" : "You Know, for Search"
}
ここに私のMavenの依存関係があります(エラスティックとクライアントのバージョンが揃っています):
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>org.Apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
そして、ここで私のJavaコードの一部:
import Java.net.InetAddress;
import Java.net.UnknownHostException;
import Java.util.Collections;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
public class Test {
public static void main(String[] args) throws UnknownHostException {
Settings clusterSettings = Settings.builder()
.put("cluster.name", "my-application")
.build();
TransportClient transportClient = new PreBuiltTransportClient(clusterSettings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
try {
SearchResponse response = transportClient
.prepareSearch()
.execute().actionGet();
System.out.println(response.toString());
} catch (Exception e) {
e.printStackTrace();
} finally {
transportClient.close();
}
}
}
それは私に次のログを提供します:
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{nqelLN69RhSJabcb57_lWQ}{127.0.0.1}{127.0.0.1:9300}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.Java:348)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.Java:246)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.Java:59)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.Java:366)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.Java:408)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.Java:80)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.Java:54)
at Test.main(Test.Java:23)
端末でこのコマンドを実行しようとすると:
telnet 127.0.0.1 9300
プロンプトが表示され、入力できるのは6文字(非表示)とエラスティックコンソールディスプレイのみです(azertyと入力しました):
[2017-05-17T00:30:33,573][WARN ][o.e.x.s.t.n.SecurityNetty4Transport] [xhkU1rX] exception caught on transport layer [[id: 0xda47cab8, L:/127.0.0.1:9300 - R:/127.0.0.1:64226]], closing connection
io.netty.handler.codec.DecoderException: Java.io.StreamCorruptedException: invalid internal transport message format, got (61,7a,65,72)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.Java:442) ~[netty-codec-4.1.9.Final.jar:4.1.9.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.Java:248) ~[netty-codec-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:340) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.Java:86) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:340) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.Java:1334) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.Java:926) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.Java:134) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.Java:624) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.Java:524) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.Java:478) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.Java:438) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.Java:858) [netty-common-4.1.9.Final.jar:4.1.9.Final]
at Java.lang.Thread.run(Thread.Java:745) [?:1.8.0_101]
Caused by: Java.io.StreamCorruptedException: invalid internal transport message format, got (61,7a,65,72)
at org.elasticsearch.transport.TcpTransport.validateMessageHeader(TcpTransport.Java:1257) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.transport.netty4.Netty4SizeHeaderFrameDecoder.decode(Netty4SizeHeaderFrameDecoder.Java:36) ~[?:?]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.Java:411) ~[?:?]
... 19 more
[2017-05-17T00:30:33,577][WARN ][o.e.x.s.t.n.SecurityNetty4Transport] [xhkU1rX] exception caught on transport layer [[id: 0xda47cab8, L:/127.0.0.1:9300 ! R:/127.0.0.1:64226]], closing connection
io.netty.handler.codec.DecoderException: Java.io.StreamCorruptedException: invalid internal transport message format, got (61,7a,65,72)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.Java:442) ~[netty-codec-4.1.9.Final.jar:4.1.9.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.Java:375) ~[netty-codec-4.1.9.Final.jar:4.1.9.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.Java:342) ~[netty-codec-4.1.9.Final.jar:4.1.9.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.Java:325) ~[netty-codec-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.Java:245) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.Java:231) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.Java:224) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.Java:75) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.Java:245) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.Java:231) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.Java:224) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.Java:1329) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.Java:245) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.Java:231) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.Java:908) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.Java:744) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.Java:163) [netty-common-4.1.9.Final.jar:4.1.9.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.Java:403) [netty-common-4.1.9.Final.jar:4.1.9.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.Java:442) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.Java:858) [netty-common-4.1.9.Final.jar:4.1.9.Final]
at Java.lang.Thread.run(Thread.Java:745) [?:1.8.0_101]
Caused by: Java.io.StreamCorruptedException: invalid internal transport message format, got (61,7a,65,72)
at org.elasticsearch.transport.TcpTransport.validateMessageHeader(TcpTransport.Java:1257) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.transport.netty4.Netty4SizeHeaderFrameDecoder.decode(Netty4SizeHeaderFrameDecoder.Java:36) ~[?:?]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.Java:411) ~[?:?]
... 20 more
これは、ポート9300が良いポートであることを意味します。
何が間違っているのか理解できません。
Someoweは私を助けることができますか?
[〜#〜] edit [〜#〜]以下は、org.elasticsearchでTRACEを使用してlog4jを設定した後の完全なログです。
0 [main] TRACE org.elasticsearch.plugins.PluginsService - plugin loaded from classpath [- Plugin information:
Name: org.elasticsearch.transport.Netty3Plugin
Description: classpath plugin
Version: NA
Native Controller: false
* Classname: org.elasticsearch.transport.Netty3Plugin]
21 [main] TRACE org.elasticsearch.plugins.PluginsService - plugin loaded from classpath [- Plugin information:
Name: org.elasticsearch.transport.Netty4Plugin
Description: classpath plugin
Version: NA
Native Controller: false
* Classname: org.elasticsearch.transport.Netty4Plugin]
24 [main] TRACE org.elasticsearch.plugins.PluginsService - plugin loaded from classpath [- Plugin information:
Name: org.elasticsearch.index.reindex.ReindexPlugin
Description: classpath plugin
Version: NA
Native Controller: false
* Classname: org.elasticsearch.index.reindex.ReindexPlugin]
25 [main] TRACE org.elasticsearch.plugins.PluginsService - plugin loaded from classpath [- Plugin information:
Name: org.elasticsearch.percolator.PercolatorPlugin
Description: classpath plugin
Version: NA
Native Controller: false
* Classname: org.elasticsearch.percolator.PercolatorPlugin]
28 [main] TRACE org.elasticsearch.plugins.PluginsService - plugin loaded from classpath [- Plugin information:
Name: org.elasticsearch.script.mustache.MustachePlugin
Description: classpath plugin
Version: NA
Native Controller: false
* Classname: org.elasticsearch.script.mustache.MustachePlugin]
41 [main] INFO org.elasticsearch.plugins.PluginsService - no modules loaded
43 [main] INFO org.elasticsearch.plugins.PluginsService - loaded plugin [org.elasticsearch.index.reindex.ReindexPlugin]
43 [main] INFO org.elasticsearch.plugins.PluginsService - loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
43 [main] INFO org.elasticsearch.plugins.PluginsService - loaded plugin [org.elasticsearch.script.mustache.MustachePlugin]
43 [main] INFO org.elasticsearch.plugins.PluginsService - loaded plugin [org.elasticsearch.transport.Netty3Plugin]
43 [main] INFO org.elasticsearch.plugins.PluginsService - loaded plugin [org.elasticsearch.transport.Netty4Plugin]
112 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [force_merge], size [1], queue size [unbounded]
116 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [fetch_shard_started], core [1], max [8], keep alive [5m]
116 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [listener], size [2], queue size [unbounded]
121 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [index], size [4], queue size [200]
122 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [refresh], core [1], max [2], keep alive [5m]
122 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [generic], core [4], max [128], keep alive [30s]
122 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [warmer], core [1], max [2], keep alive [5m]
123 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [search], size [7], queue size [1k]
123 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [flush], core [1], max [2], keep alive [5m]
123 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [fetch_shard_store], core [1], max [8], keep alive [5m]
124 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [management], core [1], max [5], keep alive [5m]
124 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [get], size [4], queue size [1k]
124 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [bulk], size [4], queue size [200]
124 [main] DEBUG org.elasticsearch.threadpool.ThreadPool - created thread pool: name [snapshot], core [1], max [2], keep alive [5m]
1301 [main] DEBUG org.elasticsearch.common.network.IfConfig - configuration:
lo
Software Loopback Interface 1
inet 127.0.0.1 netmask:255.0.0.0 broadcast:127.255.255.255 scope:Host
inet6 ::1 prefixlen:128 scope:Host
UP MULTICAST LOOPBACK mtu:-1 index:1
[...] other wetwork interfaces [...]
2395 [main] TRACE org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService - parent circuit breaker with settings [parent,type=PARENT,limit=2622960435/2.4gb,overhead=1.0]
2396 [main] TRACE org.elasticsearch.indices.breaker.request - creating ChildCircuitBreaker with settings [request,type=MEMORY,limit=2248251801/2gb,overhead=1.0]
2396 [main] TRACE org.elasticsearch.indices.breaker.fielddata - creating ChildCircuitBreaker with settings [fielddata,type=MEMORY,limit=2248251801/2gb,overhead=1.03]
2396 [main] TRACE org.elasticsearch.indices.breaker.in_flight_requests - creating ChildCircuitBreaker with settings [in_flight_requests,type=MEMORY,limit=3747086336/3.4gb,overhead=1.0]
2538 [main] DEBUG org.elasticsearch.client.transport.TransportClientNodesService - node_sampler_interval[5s]
3373 [main] DEBUG org.elasticsearch.client.transport.TransportClientNodesService - adding address [{#transport#-1}{1hiyV12vSMewRrjSv9ZmmA}{192.168.56.1}{192.168.56.1:9300}]
4016 [main] TRACE org.elasticsearch.indices.breaker.request - [request] Adjusted breaker by [16440] bytes, now [16440]
4059 [elasticsearch[_client_][transport_client_boss][T#1]] TRACE org.elasticsearch.indices.breaker.request - [request] Adjusted breaker by [-16440] bytes, now [0]
4059 [elasticsearch[_client_][transport_client_boss][T#1]] TRACE org.elasticsearch.transport.TransportService.tracer - [1][internal:tcp/handshake] sent to [{#transport#-1}{1hiyV12vSMewRrjSv9ZmmA}{192.168.56.1}{192.168.56.1:9300}] (timeout: [null])
4085 [main] TRACE org.elasticsearch.indices.breaker.request - [request] Adjusted breaker by [16440] bytes, now [16440]
4087 [elasticsearch[_client_][transport_client_boss][T#1]] TRACE org.elasticsearch.indices.breaker.request - [request] Adjusted breaker by [-16440] bytes, now [0]
4217 [main] INFO org.elasticsearch.client.transport.TransportClientNodesService - failed to get node info for {#transport#-1}{1hiyV12vSMewRrjSv9ZmmA}{192.168.56.1}{192.168.56.1:9300}, disconnecting...
RemoteTransportException[[xhkU1rX][192.168.56.1:9300][cluster:monitor/nodes/liveness]]; nested: ElasticsearchSecurityException[missing authentication token for action [cluster:monitor/nodes/liveness]];
Caused by: ElasticsearchSecurityException[missing authentication token for action [cluster:monitor/nodes/liveness]]
at org.elasticsearch.xpack.security.support.Exceptions.authenticationError(Exceptions.Java:39)
at org.elasticsearch.xpack.security.authc.DefaultAuthenticationFailureHandler.missingToken(DefaultAuthenticationFailureHandler.Java:74)
at org.elasticsearch.xpack.security.authc.AuthenticationService$AuditableTransportRequest.anonymousAccessDenied(AuthenticationService.Java:506)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$handleNullToken$14(AuthenticationService.Java:331)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.handleNullToken(AuthenticationService.Java:336)
[...] some additionnal stacktrace [...]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.Java:858)
at Java.lang.Thread.run(Thread.Java:745)
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{1hiyV12vSMewRrjSv9ZmmA}{192.168.56.1}{192.168.56.1:9300}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.Java:348)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.Java:246)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.Java:59)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.Java:366)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.Java:408)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.Java:80)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.Java:54)
at Test.main(Test.Java:22)
さて、私の質問の編集部分にログを提供することで、セキュリティ例外が発生しました。そこで私は、ESのどの部分がセキュリティの側面を提供しているのかを自問しました。
答えは、X-Packプラグインです。
それが本当に問題の原因であるかどうかを確認するために、次のコマンドを使用して削除しました。elasticsearch-plugin.bat remove x-pack
そして...今はうまく機能しています。妖hou!
Java codeの私の部分の結果は次のとおりです。
{
"took" : 21,
"timed_out" : false,
"_shards" : {
"total" : 44,
"successful" : 44,
"failed" : 0
},
"hits" : {
"total" : 306673,
"max_score" : 1.0,
"hits" : [{
"_index" : ".kibana",
"_type" : "config",
"_id" : "5.0.0",
"_score" : 1.0,
"_source" : {
"buildNum" : 14438
}
},
{
"_index" : ".monitoring-alerts-2",
"_type" : "doc",
"_id" : "ygmbc6k0TpKdJP77OJeG9g_elasticsearch_cluster_status",
"_score" : 1.0,
"_source" : {[...]}
},
{
"_index" : ".monitoring-data-2",
"_type" : "kibana",
"_id" : "60fef358-886c-43cb-9ef1-2257ccd2bcbb",
"_score" : 1.0,
"_source" : {[...]}
},
{[...]},
{
"_index" : ".monitoring-es-2-2017.05.11",
"_type" : "index_stats",
"_id" : "AVv3uOacGOX_5IPHNH_2",
"_score" : 1.0,
"_source" : {[...]}
}
]
}
}
このセキュリティトークンの部分を探す必要がありますが、それは別のトピックです。
コメントをありがとう@ andrei-stefanに感謝します;)
私は同じ問題に遭遇しましたが、elasticsearch.ymlファイルにtransport.Host: localhost
プロパティを追加することで、言及された問題を解決しました。
追加すると、期待どおりに機能します。このスレッドの他の読者に役立つことを願っています。
参考のために、7.2を使用しようとしている間に使用しています
org.elasticsearch.client:transport:5.5.1
ローカルクラスタに接続するための次のコードを実行すると、同じエラーが顔に表示されました。
public static void main(String... args) {
TransportClient client = getClient();
SearchResponse response = client.prepareSearch("cars").execute().actionGet();
System.out.println(response);
}
private static TransportClient getClient() {
TransportClient client = null;
try {
client = new PreBuiltTransportClient(
Settings.builder().put("client.transport.sniff", true)
.put("cluster.name", "elasticsearch").build())
.addTransportAddress(new TransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
client.listedNodes();
} catch (UnknownHostException e) {
}
return client;
}
ESコンソールを確認したときに、バージョンの問題について既に警告されています
exception caught on transport layer [Netty4TcpChannel{localAddress=/127.0.0.1:9300, remoteAddress=/127.0.0.1:62723}], closing connection
Java.lang.IllegalStateException: Received handshake message from unsupported version: [5.0.0] minimal compatible version is: [6.8.0]
そのため、新しいバージョンを使用してエラーを修正します。
org.elasticsearch.client:transport:7.2.0
非常に簡単な例を次に示します。 https://github.com/EdersonJunior/ElasticSearch_Java
Elasticsearch.ymlファイルは次のようなものです。
cluster.name: "elasticsearch"
node.name: "myNode"
network.Host: 0.0.0.0
http.port: 9200
プロパティファイルで9300ホストポートを設定することは非常に重要です。
同じ問題がありました。私の問題は、/ etc/elasticsearch.ymlファイルのクラスター名が、アプリケーションで参照していたクラスター名と異なることでした。
名前を一致させてビンゴにしました!
このエラーは、バージョンの不一致が原因で発生する場合があります。エラスティック検索ログを確認します。使用するelasticsearchクライアントの最小バージョンに関する詳細が指定されます。したがって、クライアントjarをアップグレードするか、elasticsearchの以下のバージョンを実行します
dockerイメージを介してエラスティック検索を実行している場合。次に、以下のコマンドを使用してdockerイメージを実行します。
docker run -p 9400:9200 -p 9401:9300 -e "http.Host=0.0.0.0" -e "transport.Host=0.0.0.0" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:5.2.2
-e "transport.Host = 127.0.0.1"は機能しませんでした。
また、設定は次のようになります。 .put( "client.transport.sniff"、true)を追加しないでください。
Settings esSettings = Settings.builder()
.put("cluster.name", EsClusterName)
.build();
ElasticSearch 6.3.1およびSpringboot2.0.0.RELASEを使用して、次の変更を行います。
設定settings = Settings.builder()。put( "cluster.name"、 "farkalit-cluster")。build(); transportClient = new PreBuiltTransportClient(settings).addTransportAddress(new TransportAddress(InetAddress.getByName( "localhost")、9300));
問題を解決します。
私はまさにこの問題を抱えていましたが、私にとっては、ホストで実行中のelasticsearchとIntelliJ pom.xmlのelasticsearchバージョンの間のバージョンでした
両端で同じバージョンを使用すると、機能しました。つまりホストとしてクライアントと同じバージョンをダウンロードし、それが機能しました。
私はそれを理解するためにこの作業サンプルを修正しました: