Storm Cassandra 集成项目技术文档
1. 安装指南
1.1 环境准备
在开始安装之前,请确保您已经安装了以下软件:
- Java 开发环境(JDK 8 或更高版本)
- Apache Maven(用于构建项目)
- Apache Cassandra(用于存储数据)
1.2 下载项目
您可以通过以下命令从 GitHub 下载 storm-cassandra 项目:
git clone https://github.com/hmsonline/storm-cassandra.git
1.3 构建项目
进入项目目录并使用 Maven 构建项目:
cd storm-cassandra
mvn install
1.4 配置 Cassandra
确保您已经安装并运行了 Apache Cassandra。您可以通过以下命令启动 Cassandra:
cassandra -f
然后,使用 cassandra-cli 创建示例模式:
cd schema
cat cassandra_schema.txt | cassandra-cli -h localhost
2. 项目的使用说明
2.1 基本使用
CassandraBolt、TridentCassandraLookupFunction 和 TridentCassandraWriteFunction 类需要配置 Cassandra 的主机名、端口和键空间。为了允许多个实例在拓扑中使用,这些配置通过 Storm 配置中的键和映射来设置。
以下是一个基本的使用示例:
Map<String, Object> cassandraConfig = new HashMap<String, Object>();
cassandraConfig.put(StormCassandraConstants.CASSANDRA_HOST, "localhost:9160");
cassandraConfig.put(StormCassandraConstants.CASSANDRA_KEYSPACE, "testKeyspace");
Config config = new Config();
config.put("CassandraLocal", cassandraConfig);
2.2 CassandraBolt 的使用
CassandraBolt 类提供了一个便捷的构造函数,用于指定列族名称和行键字段值:
IRichBolt cassandraBolt = new CassandraBolt("columnFamily", "rowKey");
该构造函数将创建一个 CassandraBolt,它将写入指定的列族,并使用接收到的 Tuple 中的 rowKey 字段作为 Cassandra 的行键。
2.3 示例运行
项目中提供了两个示例:CassandraReachTopology 和 PersistentWordCount。您可以通过以下命令运行这些示例:
2.3.1 运行 CassandraReachTopology
mvn exec:java -Dexec.mainClass=com.hmsonline.storm.cassandra.example.CassandraReachTopology
2.3.2 运行 PersistentWordCount
mvn exec:java -Dexec.mainClass=com.hmsonline.storm.cassandra.example.PersistentWordCount
3. 项目 API 使用文档
3.1 CassandraBolt
CassandraBolt 是 Storm 和 Cassandra 集成的核心组件。它负责将 Storm 的 Tuple 数据写入 Cassandra 的列族中。
3.1.1 构造函数
public CassandraBolt(String columnFamily, String rowKeyField)
columnFamily:目标列族名称。rowKeyField:用于指定行键的字段名。
3.1.2 方法
execute(Tuple input):处理输入的Tuple并将其写入 Cassandra。
3.2 TridentCassandraWriteFunction
TridentCassandraWriteFunction 是一个 Trident 函数,用于将数据写入 Cassandra。
3.2.1 构造函数
public TridentCassandraWriteFunction(String columnFamily, String rowKeyField)
columnFamily:目标列族名称。rowKeyField:用于指定行键的字段名。
3.2.2 方法
execute(TridentTuple tuple, TridentCollector collector):处理输入的TridentTuple并将其写入 Cassandra。
4. 项目安装方式
4.1 Maven 依赖
您可以通过在 pom.xml 中添加以下依赖来使用 storm-cassandra:
<dependency>
<groupId>com.hmsonline</groupId>
<artifactId>storm-cassandra</artifactId>
<version>1.0.0</version>
</dependency>
4.2 手动安装
如果您不想通过 Maven 依赖,可以直接下载项目的 JAR 文件并将其添加到您的项目中。
5. 总结
storm-cassandra 项目提供了一个灵活且可配置的方式,将 Storm 的实时数据流与 Cassandra 的持久化存储相结合。通过本文档,您应该能够顺利安装、配置和使用该项目。
Kimi-K2.5Kimi K2.5 是一款开源的原生多模态智能体模型,它在 Kimi-K2-Base 的基础上,通过对约 15 万亿混合视觉和文本 tokens 进行持续预训练构建而成。该模型将视觉与语言理解、高级智能体能力、即时模式与思考模式,以及对话式与智能体范式无缝融合。Python00
GLM-4.7-FlashGLM-4.7-Flash 是一款 30B-A3B MoE 模型。作为 30B 级别中的佼佼者,GLM-4.7-Flash 为追求性能与效率平衡的轻量化部署提供了全新选择。Jinja00
VLOOKVLOOK™ 是优雅好用的 Typora/Markdown 主题包和增强插件。 VLOOK™ is an elegant and practical THEME PACKAGE × ENHANCEMENT PLUGIN for Typora/Markdown.Less00
PaddleOCR-VL-1.5PaddleOCR-VL-1.5 是 PaddleOCR-VL 的新一代进阶模型,在 OmniDocBench v1.5 上实现了 94.5% 的全新 state-of-the-art 准确率。 为了严格评估模型在真实物理畸变下的鲁棒性——包括扫描伪影、倾斜、扭曲、屏幕拍摄和光照变化——我们提出了 Real5-OmniDocBench 基准测试集。实验结果表明,该增强模型在新构建的基准测试集上达到了 SOTA 性能。此外,我们通过整合印章识别和文本检测识别(text spotting)任务扩展了模型的能力,同时保持 0.9B 的超紧凑 VLM 规模,具备高效率特性。Python00
KuiklyUI基于KMP技术的高性能、全平台开发框架,具备统一代码库、极致易用性和动态灵活性。 Provide a high-performance, full-platform development framework with unified codebase, ultimate ease of use, and dynamic flexibility. 注意:本仓库为Github仓库镜像,PR或Issue请移步至Github发起,感谢支持!Kotlin07
compass-metrics-modelMetrics model project for the OSS CompassPython00