JStorm平台搭建

简易版可以参考
http://www.jstorm.io/QuickStart/Deploy/Standalone.html

下载源代码

在github下下载JStorm 2.2.1的源代码。因为Storm on yarn模块在编译时报错而我们又不需要,删除该模块

mvn package assembly:assembly

会在工程目录下生成一个文件,打包在服务器上解压缩,按照上述步骤执行即可。

******************************************
The jstorm client can only be run from within a release. You appear to be trying to run the client from a checkout of JStorm's source code.

You can download a JStorm release
******************************************

出现上述问题是因为我们的目录下缺少RELEASE文件。放一个进去就好。
请不要忘记修改storm.yaml文件。

########### These MUST be filled in for a storm configuration
 storm.zookeeper.servers:
     - "10.237.65.11"
     - "10.237.65.12"
     - "10.237.65.13"

 storm.zookeeper.root: "/your_cluster_name"

否则在集群启动topo时可能会报告

Connection timed out for connection string (localhost:2181) and timeout (15000) / elapsed (16540)
shade.storm.org.apache.curator.CuratorConnectionLossException: KeeperErrorCode = ConnectionLoss

启动命令为

##Nimbus
nohup jstorm nimbus & 
##Supervisor
nohup jstorm supervisor >/dev/null 2>&1 &

压测

我们使用了下面的压测代码。测试Storm的极限在哪里。

public class PressureMain {
    private static class PressureSpout extends BaseRichSpout{
        private SpoutOutputCollector collector;
        public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
            this.collector = collector;
        }
        public void nextTuple() {
            this.collector.emit(new Values("test-msg"));
        }
        public void declareOutputFields(OutputFieldsDeclarer declarer) {
            declarer.declare(new Fields("str"));
        }
    }

    private static class PressureBolt extends BaseBasicBolt{
        public void execute(Tuple input, BasicOutputCollector collector) {
            System.out.println("RECEIVE");
        }
        public void declareOutputFields(OutputFieldsDeclarer declarer) {

        }
    }

    public static void main(String[] args) {
        TopologyBuilder tp = new TopologyBuilder();
        tp.setSpout("PressureSpout",  new PressureSpout());
        tp.setBolt("PressureBolt", new PressureBolt(),2).shuffleGrouping("PressureSpout");
        Config conf = new Config();
        conf.setNumWorkers(4);
        conf.setNumAckers(1);
        conf.put("spout.single.thread", true);
        conf.setMessageTimeoutSecs(60);
        conf.setMaxSpoutPending(20);
        //提交job
        if (args != null && args.length > 0) {
            try {
                StormSubmitter.submitTopology(args[0], conf, tp.createTopology());
            }catch (Exception e){
                e.printStackTrace();
            }
        } else {
            LocalCluster cluster = new LocalCluster();
            conf.setMaxTaskParallelism(1);
            cluster.submitTopology("KafkaStormDemo", conf, tp.createTopology());
        }
        System.out.println("GDL finish");
    }
}

测试结果显示我们的集群能扛住百万级别的TPS。Storm可能会产生堆积。

Topo处理速度测试

我们接下来测试最慢的处理速度。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值