使用kafka
生成消息时,我有ruby-kafka
异常。有时会发生。
Kafka 1.1.0,Scala 2.12,ruby-kafka 0.7.4
Kafka日志:
[2019-03-27 02:11:51,879] ERROR Exception while processing request from <ip-here>:9092-<ip-here>:47916-105818 (kafka.network.Processor)
org.apache.kafka.common.errors.InvalidRequestException: Error getting request for apiKey: PRODUCE, apiVersion: 796, connectionId: <ip-here>:9092-<ip-here>:47916-105818, listenerName: ListenerName(PLAINTEXT), principal: User:ANONYMOUS
Caused by: java.lang.IllegalArgumentException: Invalid version for API key PRODUCE: 796
at org.apache.kafka.common.protocol.ApiKeys.schemaFor(ApiKeys.java:312)
at org.apache.kafka.common.protocol.ApiKeys.requestSchema(ApiKeys.java:282)
at org.apache.kafka.common.protocol.ApiKeys.parseRequest(ApiKeys.java:290)
at org.apache.kafka.common.requests.RequestContext.parseRequest(RequestContext.java:63)
at kafka.network.RequestChannel$Request.<init>(RequestChannel.scala:89)
at kafka.network.Processor.$anonfun$processCompletedReceives$1(SocketServer.scala:646)
at kafka.network.Processor.$anonfun$processCompletedReceives$1$adapted(SocketServer.scala:638)
at scala.collection.Iterator.foreach(Iterator.scala:929)
at scala.collection.Iterator.foreach$(Iterator.scala:929)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1417)
at scala.collection.IterableLike.foreach(IterableLike.scala:71)
at scala.collection.IterableLike.foreach$(IterableLike.scala:70)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at kafka.network.Processor.processCompletedReceives(SocketServer.scala:638)
at kafka.network.Processor.run(SocketServer.scala:546)
at java.lang.Thread.run(Thread.java:748)
跟踪日志:
D, [2019-03-27T02:02:26.845499 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Current leader for upinus-shopify-order/32 is node <ip-here>:9092 (node_id=1) [23/1201]
I, [2019-03-27T02:02:26.845549 #5309] INFO -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Sending 1 messages to <ip-here>:9092 (node_id=1)
D, [2019-03-27T02:02:26.845631 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Sending produce API request 3 to <ip-here>:9092
D, [2019-03-27T02:02:26.845897 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Waiting for response 3 from <ip-here>:9092
E, [2019-03-27T02:02:27.847095 #5309] ERROR -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Timed out while waiting for response 7
D, [2019-03-27T02:02:27.847357 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Closing socket to <ip-here>:9092
E, [2019-03-27T02:02:27.847511 #5309] ERROR -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Could not connect to broker <ip-here>:9092 (node_id=1): Connection error Errno::ETIMEDOUT: Connection timed out
W, [2019-03-27T02:02:27.847548 #5309] WARN -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Failed to send all messages; attempting retry 1 of 2 after 1s
I, [2019-03-27T02:02:28.847796 #5309] INFO -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Fetching cluster metadata from kafka://<ip-here>:9092
D, [2019-03-27T02:02:28.848021 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Opening connection to <ip-here>:9092 with client id ruby-kafka...
D, [2019-03-27T02:02:28.932217 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Sending topic_metadata API request 1 to <ip-here>:9092
D, [2019-03-27T02:02:28.932509 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Waiting for response 1 from <ip-here>:9092
D, [2019-03-27T02:02:29.017700 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Received response 1 from <ip-here>:9092
I, [2019-03-27T02:02:29.017869 #5309] INFO -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Discovered cluster metadata; nodes: <ip-here>:9092 (node_id=2), <ip-here>:9092 (node_id=1), <ip-here>:90$
2 (node_id=3)
D, [2019-03-27T02:02:29.017919 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Closing socket to <ip-here>:9092
D, [2019-03-27T02:02:29.018122 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Current leader for upinus-shopify-order/25 is node <ip-here>:9092 (node_id=2)
I, [2019-03-27T02:02:29.018207 #5309] INFO -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Sending 1 messages to <ip-here>:9092 (node_id=2)
D, [2019-03-27T02:02:29.018317 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Opening connection to <ip-here>:9092 with client id ruby-kafka...
D, [2019-03-27T02:02:29.102729 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Sending produce API request 1 to <ip-here>:9092
D, [2019-03-27T02:02:29.103614 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Waiting for response 1 from <ip-here>:9092
E, [2019-03-27T02:02:30.104998 #5309] ERROR -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Timed out while waiting for response 1
D, [2019-03-27T02:02:30.105443 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Closing socket to <ip-here>:9092
D, [2019-03-27T02:02:30.105562 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Closing socket to <ip-here>:9092
E, [2019-03-27T02:02:30.105748 #5309] ERROR -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Could not connect to broker <ip-here>:9092 (node_id=2): Connection error Errno::ETIMEDOUT: Connection timed out
W, [2019-03-27T02:02:30.105795 #5309] WARN -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Failed to send all messages; attempting retry 2 of 2 after 1s
I, [2019-03-27T02:02:31.106013 #5309] INFO -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Fetching cluster metadata from kafka://<ip-here>:9092
D, [2019-03-27T02:02:31.106228 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Opening connection to <ip-here>:9092 with client id ruby-kafka...
D, [2019-03-27T02:02:31.191020 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Sending topic_metadata API request 1 to <ip-here>:9092
D, [2019-03-27T02:02:31.191544 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Waiting for response 1 from <ip-here>:9092
D, [2019-03-27T02:02:31.277732 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Received response 1 from <ip-here>:9092
I, [2019-03-27T02:02:31.277865 #5309] INFO -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Discovered cluster metadata; nodes: <ip-here>:9092 (node_id=2), <ip-here>:9092 (node_id=1), <ip-here>:909
2 (node_id=3)
D, [2019-03-27T02:02:31.277907 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Closing socket to <ip-here>:9092
D, [2019-03-27T02:02:31.278365 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Current leader for upinus-shopify-order/48 is node <ip-here>:9092 (node_id=3)
D, [2019-03-27T02:02:31.278442 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Current leader for upinus-shopify-order/13 is node <ip-here>:9092 (node_id=2)
I, [2019-03-27T02:02:31.278477 #5309] INFO -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Sending 1 messages to <ip-here>:9092 (node_id=3)
D, [2019-03-27T02:02:31.278591 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Opening connection to <ip-here>:9092 with client id ruby-kafka...
D, [2019-03-27T02:02:31.362539 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Sending produce API request 1 to <ip-here>:9092
D, [2019-03-27T02:02:31.362978 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Waiting for response 1 from <ip-here>:9092
D, [2019-03-27T02:02:31.447673 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Received response 1 from <ip-here>:9092
D, [2019-03-27T02:02:31.447791 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Successfully appended 1 messages to upinus-shopify-order/48 on <ip-here>:9092 (node_id=3)
I, [2019-03-27T02:02:31.447831 #5309] INFO -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Sending 1 messages to <ip-here>:9092 (node_id=2)
D, [2019-03-27T02:02:31.447905 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Opening connection to <ip-here>:9092 with client id ruby-kafka...
D, [2019-03-27T02:02:31.532073 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Sending produce API request 1 to <ip-here>:9092
D, [2019-03-27T02:02:31.532353 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Waiting for response 1 from <ip-here>:9092
D, [2019-03-27T02:02:31.617054 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Received response 1 from <ip-here>:9092
D, [2019-03-27T02:02:31.617153 #5309] DEBUG -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Successfully appended 1 messages to upinus-shopify-order/13 on <ip-here>:9092 (node_id=2)
E, [2019-03-27T02:02:31.617187 #5309] ERROR -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Failed to send all messages; keeping remaining messages in buffer
F, [2019-03-27T02:02:31.617290 #5309] FATAL -- : [2e31f466-71c9-49b4-a7a6-2749f5792778] Delivery message failed