风暴雷迪斯喷口元组无一例外丢失

时间:2018-09-05 13:42:02

标签: java clojure redis apache-storm

我有一个Storm拓扑(1个工作程序)设置,其中spout(在Java中)使redis中的事件(使用blpop)出队并转移到螺栓上。但是一个观察结果是,当队列超过200万且在风暴灵气/主管/动物园管理员/工人日志中未发现任何警告/异常时,螺栓上没有发生某些事件(clojure,6喷口螺纹,50螺栓螺纹)。

在本地,此方案不复制虚拟数据。在群集中没有看到网络延迟/数据包丢失。平均处理延迟为100毫秒。 如何找到将其修复的原因。

(ns event-processor
  (:import [backtype.storm StormSubmitter LocalCluster]
           java.util.UUID
           storm_jedis.RedisQueueSpout
           )
  (:use [backtype.storm clojure config])
  (:require [clojure.tools.logging :as log])
  (:require [clj-redis.client :as redis])
  (:import (redis.clients.jedis Jedis JedisPool JedisPoolConfig))
  (:gen-class))

(defmacro process-event [tuple]
    (log/info "processing event")
    )

(defbolt execute-ls-closure ["word"] {:prepare true}
  [conf context collector]
  (let [counts (atom {})]

    (bolt
     (execute [tuple]
       (let [
        timestart (. System currentTimeMillis)
        tuple-message (.get (get tuple "message") 0)
        string-to-emit (process-event tuple)
        ]
        (emit-bolt! collector [string-to-emit] :anchor tuple)
        (ack! collector tuple)
        )))))

(defn mk-topology []

  (topology
   ;{"1" (spout-spec sentence-spout)
   {"1" (spout-spec redis-spout :p 6)
                     }
   {"3" (bolt-spec {"1" :shuffle }
                   execute-ls-closure
                   :p 50)
                   }))

(defn run-local! []
  (let [cluster (LocalCluster.)]
    (.submitTopology cluster "word-count" {TOPOLOGY-DEBUG true} (mk-topology))
    (Thread/sleep 10000)
    (.shutdown cluster)
    ))

(defn submit-topology! [name]
  (StormSubmitter/submitTopology
   name
   {TOPOLOGY-DEBUG true
    TOPOLOGY-WORKERS 1}
   (mk-topology)))

(defn -main
  ([]
   (run-local!))
  ([name]
   (submit-topology! name)))

1 个答案:

答案 0 :(得分:2)

如果它不会使您的拓扑结构变慢太多,则可以使用Config.setDebug(true) https://github.com/apache/storm/blob/f2ced23fa4e3f699558663baef4ee582ee148fa2/storm-client/src/jvm/org/apache/storm/Config.java#L1763启用调试日志记录。

否则,我会尝试向您的螺栓添加一些调试日志记录,并为您的Redis喷嘴启用日志记录,以确定元组是否由于Storm或Redis集成而丢失。

我还注意到您正在使用旧的Storm版本。您可以尝试升级。