[Storm] 介绍和 kafka 相关命令脚本。

sddtc 于 2015-06-30 发布

本地运行storm,kafka,zookeeper
storm的lib包下面需要放zookeeper.jar


hdfs可以写入hdfs文件系统,也可以将流直接写入本地文件

You can get the FileSystem by the following way:

Configuration conf = new Configuration();
Path path = new Path(stringPath);
FileSystem fs = FileSystem.get(path.toUri(), conf);

You do not need to judge if the path starts with hdfs:// or file://. This API will do the work.

Kafka常用查看topic的命令

查看某个topic的信息

bin/kafka-topics.sh --describe --zookeeper IP1:2181,IP2:2181,IP3:2181 --topic TOPICNAME

作为consumer从beginning处消费

bin/kafka-console-consumer.sh --from-beginning --topic TOPICNAME --zookeeper IP1:2181,IP2:2181,IP3:2181

list当前的topics

bin/kafka-topics.sh --list --zookeeper IP1:2181,IP2:2181,IP3:2181

storm-hdfs 可以写入本地,只要fsurl指定前缀为file://
另外它的流是org.apache.hadoop.fs.FSDataOutputStream