国内最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2
您当前位置:首页 > 服务器 > 一个spark receiver 或多个spark receiver 接收 多个flume agent

一个spark receiver 或多个spark receiver 接收 多个flume agent

来源:程序员人生   发布时间:2015-04-30 09:08:41 阅读次数:2586次
  1. 利用1个spark receiver 接收多个flume agent
String host = args[0]; int port = Integer.parseInt(args[1]); String host1 = args[2]; int port1 = Integer.parseInt(args[3]); InetSocketAddress address1 = new InetSocketAddress(host,port); InetSocketAddress address2 = new InetSocketAddress(host1,port1); InetSocketAddress[] InetSocketAddressArray = {address1,address2}; JavaStreamingContext jssc = new JavaStreamingContext(new SparkConf().setAppName("JavaFlumeEventHandle_1"), Durations.seconds(2)); JavaReceiverInputDStream<SparkFlumeEvent> flumeStream = FlumeUtils.createPollingStream(jssc, InetSocketAddressArray, StorageLevel.MEMORY_AND_DISK_SER_2());
  1. 2个spark receiver接收多个flume agent
String host = args[0]; int port = Integer.parseInt(args[1]); String host1 = args[2]; int port1 = Integer.parseInt(args[3]); InetSocketAddress address1 = new InetSocketAddress(host,port); InetSocketAddress address2 = new InetSocketAddress(host1,port1); InetSocketAddress[] InetSocketAddressArray = {address1,address2}; JavaStreamingContext jssc = new JavaStreamingContext(new SparkConf().setAppName("JavaFlumeEventHandle_1"), Durations.seconds(2)); // JavaReceiverInputDStream<SparkFlumeEvent> flumeStream = FlumeUtils.createPollingStream(jssc, InetSocketAddressArray, StorageLevel.MEMORY_AND_DISK_SER_2()); JavaReceiverInputDStream<SparkFlumeEvent> flumeStream = FlumeUtils.createPollingStream(jssc,host,port); JavaReceiverInputDStream<SparkFlumeEvent> flumeStream1 = FlumeUtils.createPollingStream(jssc, host1, port1); JavaDStream<SparkFlumeEvent> union = flumeStream.union(flumeStream1);

性能参照:
http://blog.sina.com.cn/s/blog_13122bdbc0102vay7.html

生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
程序员人生
------分隔线----------------------------
分享到:
------分隔线----------------------------
关闭
程序员人生