spark(9)
-
데이터 레이크하우스의 개념
(Data lakehouse in action의 1, 2장을 요약한 글입니다.) Data Lakehouse in Action - 저자 Pradeep Menon 출판 Packt Publishing 출판일 2022.03.17 1. 데이터 분석 패턴의 진화 엔터프라이즈 데이터 웨어하우스(EDW) 시대 EDW 시대가 시작된 배경은 다음과 같았습니다. 분석은 리포팅과 같은 말이었습니다. 데이터베이스 구조를 리포팅하는데 최적화하는 것이 최우선 목표였습니다. Ralph Kimball, Bill Inmon에 의해 1990, 2000년대에 활성화되었습니다. EDW의 패턴은 다음과 같았습니다. Flat Files, Databases -> ETL -> EDW -> Data Marts -> BI EDW는 오랜 시간동안 자리를..
2024.01.15 -
[🔥Spark] java.lang.AssertionError: assertion failed: Concurrent update to the log. Multiple streaming jobs detected 해결방법
에러 메세지 java.lang.AssertionError: assertion failed: Concurrent update to the log. Multiple streaming jobs detected for 53 at scala.Predef$.assert(Predef.scala:223) 원인 로그에 대한 동시 업데이트, 여러 스트리밍 작업이 발견되었습니다. 스파크 스트리밍에서 동일한 체크포인트를 사용하는 두 개의 싱크 작업(writeStream)이 동시에 실행되면 발생하는 문제이다. checkpointLocation을 다른 위치로 사용하면 해결할 수 있다. Zeppelin에서 코드를 실행하고 같은 스트리밍 스크립트를 사용할 때 오류가 발생할 수 있다. 기존 같은 location을 사용한다. 동시에 같..
2021.11.04 -
[🔥Spark] StreamingQueryException: Cannot find earliest offsets of Set(topic-name-0)
전체 에러 메세지 StreamingQueryException: Cannot find earliest offsets of Set(topic-name-0). Some data may have been missed. Some data may have been lost because they are not available in Kafka any more; either the data was aged out by Kafka or the topic may have been deleted before all the data in the topic was processed. If you don't want your streaming query to fail on such cases, set the source opt..
2021.11.02 -
[🔥Spark] 스파크 설정하는 방법(Spark Configuration, SparkConf)
About 세 가지 위치에서 스파크 설정을 할 수 있다. Spark properties: SparkConf 객체 사용, Java system properties 사용 val conf = new SparkConf() .setMaster("local[2]") .setAppName("CountingSheep") val sc = new SparkContext(conf) Environment variables: conf/spark-env.sh 환경 변수를 통하여 시스템별 설정 가능 # Options read when launching programs locally with # ./bin/run-example or ./bin/spark-submit # - HADOOP_CONF_DIR, to point Spark t..
2021.11.01 -
[🔥Spark] Spark Streaming + Kafka Option
Spark Streaming Kafka Option Example df = spark \ .readStream \ .format("kafka") \ .option("option name", "option value") \ .load() startingTimestamp 구독중인 주제의 모든 파티션에 대한 시작 타임스탬프를 지정한다. 타입: timestamp string e.g. "1000" 기본값: none (next preference is startingOffsetsByTimestamp) startingOffsetsByTimestamp 쿼리가 시작될 때 타임스탬프의 시작점 타입: json string """ {"topicA":{"0": 1000, "1": 1000}, "topicB": {"0": 200..
2021.11.01 -
[🔥Spark] Spark Streaming + Kafka 연동하기
개요 카프카를 사용하는 경우 데이터를 가공해서 다시 카프카로 넣거나 다른 곳으로 보내는 등의 처리를 해줄 곳이 반드시 필요하다. Spark Streaming을 사용하면 문제를 쉽게 해결할 수 있다. 자체적으로 kafka에서 읽고 처리 후 kafka로 보내는 기능이 포함되어 있으며 Spark에서는 1.2버전부터 파이썬에서 Spark Streaming을 사용할 수 있게 되었다. Spark Streaming에는 DStreams라는 기능이 있고, 그 위에 DataFrame을 사용하여 더 쉽게 처리를 할 수 있는 Structed Streaming이 있다. 여기에서는 Structed Streaming을 사용하려고 한다. 방법 spark.readStream을 사용하여 카프카의 어떤 토픽에서 데이터를 가져올지 정한다...
2021.10.29