gpt4 book ai didi

java - Storm redis spout元组无一异常(exception)地丢失

转载 作者:IT王子 更新时间:2023-10-29 06:10:42 26 4
gpt4 key购买 nike

我已经设置了 storm 拓扑(1 个工作人员),其中 spout(在 java 中)使事件从 redis 中出列(使用 blpop)并传输到 bolt 。但一个观察结果是,当队列超过 200 万并且在 storm nimbus/supervisor/zookeeper/worker 日志中没有发现警告/异常时,一些事件没有收到 bolt(在 clojure 中,6-spout 线程,50-bolt 线程)。

在本地,此场景不会使用虚拟数据进行复制。集群中没有网络延迟/数据包丢失。平均处理延迟为 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 启用调试日志记录.

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

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

关于java - Storm redis spout元组无一异常(exception)地丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52186638/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com