πββοΈ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val sparkConf = new SparkConf() | |
| .setAppName("App") | |
| .set("spark.yarn.maxAppAttempts", "1") | |
| .set("spark.yarn.am.attemptFailuresValidityInterval", "2h") | |
| val ssc = new StreamingContext(sparkConf, Seconds(2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val checkpointDirectory = "hdfs://..." // define checkpoint directory | |
| // Function to create and setup a new StreamingContext | |
| def functionToCreateContext(): StreamingContext = { | |
| val ssc = new StreamingContext(...) // new context | |
| val lines = ssc.socketTextStream(...) // create DStreams | |
| ... | |
| ssc.checkpoint(checkpointDirectory) // set checkpoint directory | |
| ssc // Return the StreamingContext | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var TRIGGER_STOP = false | |
| var ssc: StreamingContext = β¦ | |
| // Define Stream Creation, Transformations and Actions here. | |
| ssc.start() | |
| var isStopped = false | |
| while (!isStopped) { | |
| isStopped = ssc.awaitTerminationOrTimeout(SPARK_SHUTDOWN_CHECK_MILLIS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val sparkConf = new SparkConf().setAppName("DirectKafkaWordCount") | |
| val ssc = new StreamingContext(sparkConf, Seconds(2)) | |
| // Create direct kafka stream with brokers and topics | |
| val topicsSet = topics.split(",").toSet | |
| val kafkaParams = Map[String, Object]( | |
| ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG -> brokers, | |
| ConsumerConfig.GROUP_ID_CONFIG -> groupId, | |
| ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG -> classOf[StringDeserializer], | |
| ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG -> classOf[StringDeserializer]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd /opt | |
| sudo wget --no-check-certificate https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz | |
| tar xf Python-2.7.9.tar.xz | |
| cd Python-2.7.9 | |
| ./configure --prefix=/usr/local | |
| make && make altinstall | |
| ls -ltr /usr/local/bin/python* | |
| vi ~/.bashrc |
NewerOlder