Spark Streaming 收到警告“仅复制到 0 个对等方,而不是 1 个对等体”
2022-09-04 01:07:22
我使用火花流来接收来自Twitter的twitts。我收到许多警告,上面写着:
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();