将数据从Storm上传到ElasticSearch时出错

时间:2017-08-19 20:06:28

标签: java elasticsearch apache-storm elasticsearch-5

我正在使用Storm 1.1.0和Elasticsearch 5.5。 我想在ES中存储来自Storm的元组,为此我使用了本机Storm库来获取Elastic。

我的POM.xml条目:

    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-elasticsearch</artifactId>
        <version>1.1.0</version>
    </dependency>       

我按如下方式启动ElasticBolt:

EsConfig esConfig = new EsConfig("elasticseach", new String[]{"localhost:9200"});
EsTupleMapper tupleMapper = new MyMapper(); //custom mapper
EsIndexBolt indexBolt = new EsIndexBolt(esConfig, tupleMapper);

当我运行拓扑时,存储螺栓会向我抛出此错误:

    20101 [Thread-24-EsPersistence-executor[1 1]] ERROR o.a.s.d.executor - 
org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
    at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:305) ~[elasticsearch-1.6.0.jar:?]
    at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:200) ~[elasticsearch-1.6.0.jar:?]
    at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106) ~[elasticsearch-1.6.0.jar:?]
    at org.elasticsearch.client.support.AbstractClient.index(AbstractClient.java:102) ~[elasticsearch-1.6.0.jar:?]
    at org.elasticsearch.client.transport.TransportClient.index(TransportClient.java:340) ~[elasticsearch-1.6.0.jar:?]
    at org.elasticsearch.action.index.IndexRequestBuilder.doExecute(IndexRequestBuilder.java:266) ~[elasticsearch-1.6.0.jar:?]
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91) ~[elasticsearch-1.6.0.jar:?]
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65) ~[elasticsearch-1.6.0.jar:?]
    at org.apache.storm.elasticsearch.bolt.EsIndexBolt.process(EsIndexBolt.java:65) [storm-elasticsearch-1.1.0.jar:1.1.0]
    at org.apache.storm.topology.base.BaseTickTupleAwareRichBolt.execute(BaseTickTupleAwareRichBolt.java:38) [storm-core-1.1.0.jar:1.1.0]
    at org.apache.storm.daemon.executor$fn__5044$tuple_action_fn__5046.invoke(executor.clj:727) [storm-core-1.1.0.jar:1.1.0]
    at org.apache.storm.daemon.executor$mk_task_receiver$fn__4965.invoke(executor.clj:459) [storm-core-1.1.0.jar:1.1.0]
    at org.apache.storm.disruptor$clojure_handler$reify__4480.onEvent(disruptor.clj:40) [storm-core-1.1.0.jar:1.1.0]
    at org.apache.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:472) [storm-core-1.1.0.jar:1.1.0]
    at org.apache.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:451) [storm-core-1.1.0.jar:1.1.0]
    at org.apache.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:73) [storm-core-1.1.0.jar:1.1.0]
    at org.apache.storm.daemon.executor$fn__5044$fn__5057$fn__5110.invoke(executor.clj:846) [storm-core-1.1.0.jar:1.1.0]
    at org.apache.storm.util$async_loop$fn__557.invoke(util.clj:484) [storm-core-1.1.0.jar:1.1.0]
    at clojure.lang.AFn.run(AFn.java:22) [clojure-1.7.0.jar:?]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]

乍一看,似乎该库不支持Elastic 5.5并且它需要Elastic 1.6但是在查看storm-elasticsearch库的pom.xml之后,它们实际上使用了ES 5.X

<properties>
    <elasticsearch.version>5.2.2</elasticsearch.version>
    <elasticsearch.test.version>2.4.4</elasticsearch.test.version>
</properties>

请参阅https://github.com/apache/storm/blob/master/external/storm-elasticsearch/pom.xml

我的设置中缺少什么? storm-elasticsearch真的支持Elastic 5.5吗?

编辑:

从ES自己的日志中我收到以下错误消息:

[2017-08-19T22:21:01,093][WARN ][o.e.t.n.Netty4Transport  ] [node-1] exception caught on transport layer [[id: 0xfe71a901, L:/10.0.4.70:9300 - R:/10.0.200.6:36344]], closing connection
java.lang.IllegalStateException: Received message from unsupported version: [1.0.0] minimal compatible version is: [5.0.0]
        at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport.java:1379) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:74) ~[transport-netty4-5.5.0.jar:5.5.0]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [netty-codec-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:297) [netty-codec-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:413) [netty-codec-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265) [netty-codec-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.11.Final.jar:4.1.11.Final]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [netty-transport-4.1.11.Final.jar:4.1.11.Final]

1 个答案:

答案 0 :(得分:1)

使用端口9300 insteed(默认控制端口)。 9200是REST调用的默认端口。