Search in sources :

Example 6 with LocalCluster

use of backtype.storm.LocalCluster in project storm-hbase by ypf412.

the class StormTestUtil method createLocalStormCluster.

/**
 * Create Storm local cluster
 *
 * @param conf
 * @return
 * @throws Exception
 */
public static StormTestUtil createLocalStormCluster(Config conf) throws Exception {
    conf.setDebug(true);
    conf.setMaxTaskParallelism(4);
    LocalCluster cluster = new LocalCluster();
    StormTestUtil info = new StormTestUtil(conf, cluster);
    return info;
}
Also used : LocalCluster(backtype.storm.LocalCluster)

Example 7 with LocalCluster

use of backtype.storm.LocalCluster in project avro-kafka-storm by ransilberman.

the class AvroTopology method main.

public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
    // Add those lines to prevent too much logging noise in the console
    Logger.getLogger("storm.kafka.PartitionManager").setLevel(Level.ERROR);
    Logger.getLogger("backtype.storm").setLevel(Level.ERROR);
    Logger.getLogger("storm.kafka").setLevel(Level.ERROR);
    TopologyBuilder builder = new TopologyBuilder();
    int partitions = 1;
    final String offsetPath = "/liveperson-avro-test";
    final String consumerId = "v1";
    final String topic = "avro-test";
    List<String> hosts = new ArrayList<String>();
    hosts.add("tlvwhale1");
    hosts.add("tlvwhale2");
    hosts.add("tlvwhale3");
    SpoutConfig kafkaConfig = new SpoutConfig(KafkaConfig.StaticHosts.fromHostString(hosts, partitions), topic, offsetPath, consumerId);
    KafkaSpout kafkaSpout = new KafkaSpout(kafkaConfig);
    builder.setSpout("spout", kafkaSpout);
    builder.setBolt("bolt", new AvroBolt()).shuffleGrouping("spout");
    Config conf = new Config();
    conf.setDebug(true);
    if (args != null && args.length > 0) {
        conf.setNumWorkers(3);
        StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
    } else {
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology("avroTopology", conf, builder.createTopology());
        Utils.sleep(100000);
        cluster.killTopology("avroTopology");
        cluster.shutdown();
    }
}
Also used : LocalCluster(backtype.storm.LocalCluster) TopologyBuilder(backtype.storm.topology.TopologyBuilder) KafkaConfig(storm.kafka.KafkaConfig) SpoutConfig(storm.kafka.SpoutConfig) Config(backtype.storm.Config) SpoutConfig(storm.kafka.SpoutConfig) ArrayList(java.util.ArrayList) KafkaSpout(storm.kafka.KafkaSpout)

Example 8 with LocalCluster

use of backtype.storm.LocalCluster in project avro-kafka-storm by ransilberman.

the class AvroTopology2 method main.

public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
    // Add those lines to prevent too much logging noise in the console
    Logger.getLogger("storm.kafka.PartitionManager").setLevel(Level.ERROR);
    Logger.getLogger("backtype.storm").setLevel(Level.ERROR);
    Logger.getLogger("storm.kafka").setLevel(Level.ERROR);
    TopologyBuilder builder = new TopologyBuilder();
    int partitions = 1;
    final String offsetPath = "/liveperson-avro-test";
    final String consumerId = "v1";
    final String topic = "avro-test";
    List<String> hosts = new ArrayList<String>();
    hosts.add("tlvwhale1");
    hosts.add("tlvwhale2");
    hosts.add("tlvwhale3");
    SpoutConfig kafkaConfig = new SpoutConfig(KafkaConfig.StaticHosts.fromHostString(hosts, partitions), topic, offsetPath, consumerId);
    KafkaSpout kafkaSpout = new KafkaSpout(kafkaConfig);
    builder.setSpout("spout", kafkaSpout);
    builder.setBolt("bolt", new AvroBolt()).shuffleGrouping("spout");
    Config conf = new Config();
    conf.setDebug(true);
    if (args != null && args.length > 0) {
        conf.setNumWorkers(3);
        StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
    } else {
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology("avroTopology", conf, builder.createTopology());
        Utils.sleep(1000000);
        cluster.killTopology("avroTopology");
        cluster.shutdown();
    }
}
Also used : LocalCluster(backtype.storm.LocalCluster) TopologyBuilder(backtype.storm.topology.TopologyBuilder) KafkaConfig(storm.kafka.KafkaConfig) SpoutConfig(storm.kafka.SpoutConfig) Config(backtype.storm.Config) SpoutConfig(storm.kafka.SpoutConfig) ArrayList(java.util.ArrayList) KafkaSpout(storm.kafka.KafkaSpout)

Example 9 with LocalCluster

use of backtype.storm.LocalCluster in project storm-hbase by jrkinley.

the class HBaseExampleTopology method main.

/**
 * @param args
 */
public static void main(String[] args) {
    TopologyBuilder builder = new TopologyBuilder();
    // Add test spout
    builder.setSpout("spout", new TestSpout(), 1);
    // Build TupleTableConifg
    TupleTableConfig config = new TupleTableConfig("shorturl", "shortid");
    config.setBatch(false);
    config.addColumn("data", "url");
    config.addColumn("data", "user");
    config.addColumn("data", "date");
    // Add HBaseBolt
    builder.setBolt("hbase", new HBaseBolt(config), 1).shuffleGrouping("spout");
    Config stormConf = new Config();
    stormConf.setDebug(true);
    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("hbase-example", stormConf, builder.createTopology());
    Utils.sleep(10000);
    cluster.shutdown();
}
Also used : LocalCluster(backtype.storm.LocalCluster) TopologyBuilder(backtype.storm.topology.TopologyBuilder) Config(backtype.storm.Config) TupleTableConfig(backtype.storm.contrib.hbase.utils.TupleTableConfig) TupleTableConfig(backtype.storm.contrib.hbase.utils.TupleTableConfig) HBaseBolt(backtype.storm.contrib.hbase.bolts.HBaseBolt)

Example 10 with LocalCluster

use of backtype.storm.LocalCluster in project storm-hbase by jrkinley.

the class HBaseCountersTopology method main.

/**
 * @param args
 */
public static void main(String[] args) {
    TopologyBuilder builder = new TopologyBuilder();
    // Add test spout
    builder.setSpout("spout", new TestSpout(), 1);
    // Build TupleTableConifg
    TupleTableConfig config = new TupleTableConfig("shorturl", "shortid");
    config.setBatch(false);
    /*
     * By default the HBaseCountersBolt will use the tuple output fields value
     * to set the CQ name. For example if the 'date' output field exists in the
     * tuple then its value (e.g. "YYYYMMDD") will be used to set the counters
     * CQ. However, the 'clicks' output field does not exist in the tuple so in
     * this case the counters CQ will be set to the given field name 'clicks'.
     */
    config.addColumn("data", "clicks");
    config.addColumn("daily", "date");
    // Add HBaseBolt
    builder.setBolt("hbase-counters", new HBaseCountersBolt(config), 1).shuffleGrouping("spout");
    Config stormConf = new Config();
    stormConf.setDebug(true);
    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("hbase-example", stormConf, builder.createTopology());
    Utils.sleep(10000);
    cluster.shutdown();
}
Also used : LocalCluster(backtype.storm.LocalCluster) TopologyBuilder(backtype.storm.topology.TopologyBuilder) Config(backtype.storm.Config) TupleTableConfig(backtype.storm.contrib.hbase.utils.TupleTableConfig) HBaseCountersBolt(backtype.storm.contrib.hbase.bolts.HBaseCountersBolt) TupleTableConfig(backtype.storm.contrib.hbase.utils.TupleTableConfig)

Aggregations

LocalCluster (backtype.storm.LocalCluster)38 Config (backtype.storm.Config)31 TopologyBuilder (backtype.storm.topology.TopologyBuilder)23 Fields (backtype.storm.tuple.Fields)12 LocalDRPC (backtype.storm.LocalDRPC)3 TupleTableConfig (backtype.storm.contrib.hbase.utils.TupleTableConfig)3 TridentConfig (backtype.storm.contrib.hbase.utils.TridentConfig)2 LinearDRPCTopologyBuilder (backtype.storm.drpc.LinearDRPCTopologyBuilder)2 StormTopology (backtype.storm.generated.StormTopology)2 MemoryTransactionalSpout (backtype.storm.testing.MemoryTransactionalSpout)2 TransactionalTopologyBuilder (backtype.storm.transactional.TransactionalTopologyBuilder)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 KafkaConfig (storm.kafka.KafkaConfig)2 KafkaSpout (storm.kafka.KafkaSpout)2 SpoutConfig (storm.kafka.SpoutConfig)2 TridentTopology (storm.trident.TridentTopology)2 FixedBatchSpout (storm.trident.testing.FixedBatchSpout)2 HBaseBolt (backtype.storm.contrib.hbase.bolts.HBaseBolt)1 HBaseCountersBatchBolt (backtype.storm.contrib.hbase.bolts.HBaseCountersBatchBolt)1