我使用Spark Streaming从Twitter接收推文。
我经常会收到许多警告,内容如下:
replicated to only 0 peer(s) instead of 1 peers
这个警告是什么意思?
我的代码如下:
SparkConf conf = new SparkConf().setAppName("Test");
JavaStreamingContext sc = new JavaStreamingContext(conf, Durations.seconds(5));
sc.checkpoint("/home/arman/Desktop/checkpoint");
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setOAuthConsumerKey("****************")
.setOAuthConsumerSecret("**************")
.setOAuthAccessToken("*********************")
.setOAuthAccessTokenSecret("***************");
JavaReceiverInputDStream<twitter4j.Status> statuses = TwitterUtils.createStream(sc,
AuthorizationFactory.getInstance(cb.build()));
JavaPairDStream<String, Long> hashtags = statuses.flatMapToPair(new GetHashtags());
JavaPairDStream<String, Long> hashtagsCount = hashtags.updateStateByKey(new UpdateReduce());
hashtagsCount.foreachRDD(new saveText(args[0], true));
sc.start();
sc.awaitTerminationOrTimeout(Long.parseLong(args[1]));
sc.stop();
log4j.loggr.org.apache.spark.storage=ERROR
。在Spark下可能还有其他子包需要静音 - 但最好不要全部都静音。 - WestCoastProjectslog4j.logger.org.apache.spark.storage=ERROR
。 - WestCoastProjects