apache-storm

How to send output of two different Spout to the same Bolt?

雨燕双飞 提交于 2019-12-01 06:41:38
I have two Kafka Spouts whose values I want to send to the same bolt. Is it possible ? Yes it is possible: TopologyBuilder b = new TopologyBuilder(); b.setSpout("topic_1", new KafkaSpout(...)); b.setSpout("topic_2", new KafkaSpout(...)); b.setBolt("bolt", new MyBolt(...)).shuffleGrouping("topic_1").shuffleGrouping("topic_2"); You can use any other grouping, too. Update: In order to distinguish tuples (ie, topic_1 or topic_2) in consumer bolt, there are two possibilities: 1) You can use operator IDs (as suggested by @user-4870385): if(input.getSourceComponent().equalsIgnoreCase("topic_1")) { /

How to send output of two different Spout to the same Bolt?

微笑、不失礼 提交于 2019-12-01 04:19:45
问题 I have two Kafka Spouts whose values I want to send to the same bolt. Is it possible ? 回答1: Yes it is possible: TopologyBuilder b = new TopologyBuilder(); b.setSpout("topic_1", new KafkaSpout(...)); b.setSpout("topic_2", new KafkaSpout(...)); b.setBolt("bolt", new MyBolt(...)).shuffleGrouping("topic_1").shuffleGrouping("topic_2"); You can use any other grouping, too. Update: In order to distinguish tuples (ie, topic_1 or topic_2) in consumer bolt, there are two possibilities: 1) You can use

Graphite/Carbon how to get per-second metrics

旧街凉风 提交于 2019-12-01 01:07:24
I've dockerized graphite and am working with this library to get metrics from an Apache Storm topology. I'm getting metrics data, but no matter what I do I can only get data per minute where I really need the points to be per second. As per this SO post I've set the retention policy to grab data every second. I've also set conf.put("topology.builtin.metrics.bucket.size.secs", 1); and void initMetrics(TopologyContext context) { messageCountMetric = new CountMetric(); context.registerMetric("digest_count", messageCountMetric, 1); } in the class that's setting up the topology and the bolt itself,

Graphite/Carbon how to get per-second metrics

╄→尐↘猪︶ㄣ 提交于 2019-11-30 20:34:53
问题 I've dockerized graphite and am working with this library to get metrics from an Apache Storm topology. I'm getting metrics data, but no matter what I do I can only get data per minute where I really need the points to be per second. As per this SO post I've set the retention policy to grab data every second. I've also set conf.put("topology.builtin.metrics.bucket.size.secs", 1); and void initMetrics(TopologyContext context) { messageCountMetric = new CountMetric(); context.registerMetric(

Storm : Spout for reading data from a port

拥有回忆 提交于 2019-11-30 20:24:11
I need to write a storm spout for reading data from a port. Wanted to know if that was logically possible. With that in mind, I had designed a simple topology designed for the same with one spout and one bolt. The spout would gather HTTP requests sent using wget and the bolt would display the request-Just that. My spout structure is as follows: public class ProxySpout extends BaseRichSpout{ //The O/P collector SpoutOutputCollector sc; //The socket Socket clientSocket; //The server socket ServerSocket sc; public ProxySpout(int port){ this.sc=new ServerSocket(port); try{ clientSocket=sc.accept()

Testing java HBase connection

痴心易碎 提交于 2019-11-30 17:33:43
问题 I am trying to use the HBase Java APIs to write data into HBase. I installed Hadoop/HBase through Ambari. Here is how the configuration is currently set up: final Configuration CONFIGURATION = HBaseConfiguration.create(); final HBaseAdmin HBASE_ADMIN; HBASE_ADMIN = new HBaseAdmin(CONFIGURATION) When I try to write to HBase, I check to make sure that the table exists !HBASE_ADMIN.tableExists(tableName) If not, create a new one. However, it appears that when attempting to check if the table

java.lang.ClassNotFoundException: TopologyMain

泄露秘密 提交于 2019-11-30 15:39:01
问题 I am trying to submit a simple word count topology to my local storm cluster. First, i tried using maven and then using storm command line client. I created the JAR file using eclipse. But, it throws main class not found exception. Can anyone tell me what could be the problem? I am attaching the code and exception below. package com.test.newpackage; import com.test.newpackage.WordReader; import backtype.storm.Config; import backtype.storm.LocalCluster; import backtype.storm.topology

java.lang.ClassNotFoundException: TopologyMain

╄→尐↘猪︶ㄣ 提交于 2019-11-30 14:39:06
I am trying to submit a simple word count topology to my local storm cluster. First, i tried using maven and then using storm command line client. I created the JAR file using eclipse. But, it throws main class not found exception. Can anyone tell me what could be the problem? I am attaching the code and exception below. package com.test.newpackage; import com.test.newpackage.WordReader; import backtype.storm.Config; import backtype.storm.LocalCluster; import backtype.storm.topology.TopologyBuilder; import backtype.storm.tuple.Fields; import com.test.newpackage.WordCounter; import com.test

how to tune the parallelism hint in storm

雨燕双飞 提交于 2019-11-30 12:44:55
问题 "parallelism hint" is used in storm to parallelise a running storm topology. I know there are concepts like worker process, executor and tasks. Would it make sense to make the parallelism hint as big as possible so that your topologies are parallelised as much as possible? My question is How to find a perfect parallelism hint number for my storm topologies. Is it depending on the scale of my storm cluster or it's more like a topology/job specific setting, it varies from one topology to

Storm fields grouping

梦想与她 提交于 2019-11-30 09:26:34
问题 I'm having the following situation: There is a number of bolts that calculate different values This values are sent to visualization bolt Visualization bolt opens a web socket and sends values to be visualized somehow The thing is, visualization bolt is always the same, but it sends a message with a different header for each type of bolt that can be its input. For example: BoltSum calculates sum BoltDif calculates difference BoltMul calculates multiple All this bolts use VisualizationBolt for