Storm UnresolvedAddressException异常

记录一个storm在运行的一个错误case:

当使用storm接入kafka的时候,本地测试环境都正常,但是将storm的jar放到cluster中运行失败,一直报错 UnresolvedAddressException.

很显然这是一个hostname转换的问题,马上定位开始查找 /etc/hosts, 发现storm连接的kafka的zookeerer信息正确,也能ping通。但是问题仍然持续。

后来通过查询上下文的log发现了系统多了一个kafka.broker1 和 kafka.broker2 的地址,这两个地址是host没有配置的,为什么会有这两个地址呢。

后来经过分析发现:原来storm当连接kafka需要消费消息的时候,首先通过我自己的配置文件(就是host里面配置的kafka zookeeper 地址)找到zookeeper,

然后根据这个zookeeper的kafka 的topic节点找到消费的topic对应的partition,通过partiton找到真正的机器进行消费。 很不幸的是这里partition存储的主机

地址是域名,而不是IP,这个域名应该是消息Producer的时候写进去的。 所以我集群消费的时候读取到这个kafka.broker1 的时候根本服务转换成IP地址,所以

出现这个问题。 


解决方法: 将 /etc/hosts 把kafka.broker1 和 kafka.broker2 的IP地址也配置全就OK了


2015-11-09T15:42:39.122+0800 s.k.DynamicBrokersReader [INFO] Read partition info from zookeeper: GlobalPartitionInformation{partitionMap={0=kafka.broker1:9092, 1=kafka.broker2:9092}}

2015-11-09T15:42:39.123+0800 s.k.DynamicBrokersReader [INFO] Read partition info from zookeeper: GlobalPartitionInformation{partitionMap={0=kafka.broker1:9092, 1=kafka.broker2:9092}}

......


015-11-09T15:33:07.503+0800 b.s.d.executor [INFO] Prepared bolt $spoutcoord-spout0:(2)

2015-11-09T15:33:07.818+0800 b.s.util [ERROR] Async loop died!

java.lang.RuntimeException: java.nio.channels.UnresolvedAddressException

         at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:128) ~[storm-core-0.9.5.jar:0.9.5]

         at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:99) ~[storm-core-0.9.5.jar:0.9.5]

         at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) ~[storm-core-0.9.5.jar:0.9.5]

         at backtype.storm.daemon.executor$fn__6647$fn__6659$fn__6706.invoke(executor.clj:748) ~[storm-core-0.9.5.jar:0.9.5]

         at backtype.storm.util$async_loop$fn__459.invoke(util.clj:463) ~[storm-core-0.9.5.jar:0.9.5]

         at clojure.lang.AFn.run(AFn.java:24) [clojure-1.5.1.jar:na]

         at java.lang.Thread.run(Thread.java:745) [na:1.7.0_76]

Caused by: java.nio.channels.UnresolvedAddressException: null

         at sun.nio.ch.Net.checkAddress(Net.java:127) ~[na:1.7.0_76]

         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:644) ~[na:1.7.0_76]

         at kafka.network.BlockingChannel.connect(BlockingChannel.scala:57) ~[stormjar.jar:na]

         at kafka.consumer.SimpleConsumer.connect(SimpleConsumer.scala:44) ~[stormjar.jar:na]

         at kafka.consumer.SimpleConsumer.getOrMakeConnection(SimpleConsumer.scala:142) ~[stormjar.jar:na]

         at kafka.consumer.SimpleConsumer.kafka$consumer$SimpleConsumer$$sendRequest(SimpleConsumer.scala:69) ~[stormjar.jar:na]

         at kafka.consumer.SimpleConsumer.getOffsetsBefore(SimpleConsumer.scala:124) ~[stormjar.jar:na]

         at kafka.javaapi.consumer.SimpleConsumer.getOffsetsBefore(SimpleConsumer.scala:79) ~[stormjar.jar:na]

         at storm.kafka.KafkaUtils.getOffset(KafkaUtils.java:77) ~[stormjar.jar:na]

         at storm.kafka.KafkaUtils.getOffset(KafkaUtils.java:67) ~[stormjar.jar:na]

         at storm.kafka.trident.TridentKafkaEmitter.doEmitNewPartitionBatch(TridentKafkaEmitter.java:111) ~[stormjar.jar:na]

         at storm.kafka.trident.TridentKafkaEmitter.failFastEmitNewPartitionBatch(TridentKafkaEmitter.java:72) ~[stormjar.jar:na]

         at storm.kafka.trident.TridentKafkaEmitter.emitNewPartitionBatch(TridentKafkaEmitter.java:79) ~[stormjar.jar:na]

         at storm.kafka.trident.TridentKafkaEmitter.access$000(TridentKafkaEmitter.java:46) ~[stormjar.jar:na]

         at storm.kafka.trident.TridentKafkaEmitter$1.emitPartitionBatch(TridentKafkaEmitter.java:204) ~[stormjar.jar:na]

         at storm.kafka.trident.TridentKafkaEmitter$1.emitPartitionBatch(TridentKafkaEmitter.java:194) ~[stormjar.jar:na]

         at storm.trident.spout.OpaquePartitionedTridentSpoutExecutor$Emitter.emitBatch(OpaquePartitionedTridentSpoutExecutor.java:127) ~[storm-core-0.9.5.jar:0.9.5]

         at storm.trident.spout.TridentSpoutExecutor.execute(TridentSpoutExecutor.java:82) ~[storm-core-0.9.5.jar:0.9.5]

         at storm.trident.topology.TridentBoltExecutor.execute(TridentBoltExecutor.java:369) ~[storm-core-0.9.5.jar:0.9.5]

         at backtype.storm.daemon.executor$fn__6647$tuple_action_fn__6649.invoke(executor.clj:633) ~[storm-core-0.9.5.jar:0.9.5]

         at backtype.storm.daemon.executor$mk_task_receiver$fn__6570.invoke(executor.clj:401) ~[storm-core-0.9.5.jar:0.9.5]

         at backtype.storm.disruptor$clojure_handler$reify__1605.onEvent(disruptor.clj:58) ~[storm-core-0.9.5.jar:0.9.5]

         at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:125) ~[storm-core-0.9.5.jar:0.9.5]

         ... 6 common frames omitted

2015-11-09T15:33:07.819+0800 b.s.d.executor [ERROR]

java.lang.RuntimeException: java.nio.channels.UnresolvedAddressException

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值