繁体   English   中英

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

[英]storm redis spout tuples lost with no exception

我已经建立了风暴拓扑(1个工作程序),其中spout(在Java中)使redis的事件从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)))

如果它不会使您的拓扑速度减慢太多,则可以使用Config.setDebug(true) https://github.com/apache/storm/blob/f2ced23fa4e3f699558663baef4ee582ee148fa2/storm-client/src/jvm/org/ apache / storm / Config.java#L1763

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM