【问题标题】:Storm spout directly from MySQL?Storm 直接从 MySQL 喷出?
【发布时间】:2014-07-08 08:12:26
【问题描述】:

我想使用 Storm 集群实时监控用户活动。目前,用户活动日志保存在 MySQL 中。每分钟大约有 100,000 条记录记录到 MySQL 中,每天有 20,000,000 条记录。我想每 N 分钟做一个 topN 查看项目排名。如何为此设计喷口?我应该在 spout 中直接从 MySQL 查询还是使用像 Kafka 这样的消息队列?我想要实时性能,所以更喜欢第一种方式。但我发现很少有生产实现选择这种方式。为什么?

【问题讨论】:

  • 我会把它们写入kafka,然后被storm消耗掉,如果需要的话,在storm bolt中写入mysql。
  • 如何拖尾mysql日志并将其保存到消息队列,然后让storm从这个队列中消费消息并处理它们

标签: mysql database hadoop real-time apache-storm


【解决方案1】:

要直接从 MySql Bin Logs 发出元组,您可能可以在 github(https://github.com/flipkart-incubator/storm-mysql) 上使用这个 mysql spout。 此 spout 会将您的行更新作为流发出。这个 spout 使用出色的 Open Replicator(https://github.com/whitesock/open-replicator) 来尾箱日志。

对于你的用例,那么可能写一个类似这样的螺栓: https://github.com/nathanmarz/storm-starter/blob/master/src/jvm/storm/starter/RollingTopWords.java

这种方法消除了对消息队列和更多移动部件的需求。

免责声明:上述 Mysql Spout 的作者。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-02
    • 2013-11-11
    • 2015-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多