메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

Cloudera CDH/CDP 및 Hadoop EcoSystem, Semantic IoT등의 개발/운영 기술을 정리합니다. gooper@gooper.com로 문의 주세요.


spark Scala를 이용한 Streaming예제

총관리자 2018.03.08 09:59 조회 수 : 462


object StreamingRequestCount {
  def main(args: Array[String]) {
    val ssc = new StreamingContext(new SparkContext(),Seconds(2))
    val mystream = ssc.socketTextStream(hostname, port)
    val userreqs = mystream.map(line => (line.split(' ')(2),1))
        .reduceByKey((x,y) => x+y)
    userreqs.print()
    ssc.start()
    ssc.awaitTermination()
  }
}


번호 제목 날짜 조회 수
501 compile할때와 exclude할때 대상을 표현하는 명칭이 다르므로 주의할것 2016.08.10 667
500 Kafka Offset Monitor로 kafka 상태 모니터링 하기 file 2016.11.08 654
499 동시에 많은 요청이 endpoint로 몰려서java.net.NoRouteToHostException가 발생하는 경우의 처리방법 2016.10.17 654
498 Job이 끝난 log을 볼수 있도록 설정하기 2016.05.30 651
497 kudu table와 impala(hive) table정보가 틀어져서 테이블을 읽지 못하는 경우(Error Loading Metadata) 조치방법 2023.11.10 649
496 Error: Could not find or load main class nodemnager 가 발생할때 해결하는 방법 2015.06.05 646
495 [Kudu]ERROR: Unable to advance iterator for node with id '2' for Kudu table 'impala::core.pm0_abdasubjct': Network error: recv error from unknown peer: Transport endpoint is not connected (error 107) 2023.03.16 644
494 db를 통째로 새로운 이름의 db로 복사하는 방법/절차 2017.11.14 638
493 Impala Admission Control 설정시 쿼리가 사용하는 메모리 사용량 판단 방법 2023.05.19 637
492 Container killed by the ApplicationMaster. Container killed on request. Exit code is 143 Container exited with a non-zero exit code 143 TaskAttempt killed because it ran on unusable node 오류시 조치방법 2017.04.06 632
491 Error: java.lang.RuntimeException: java.lang.OutOfMemoryError 오류가 발생하는 경우 2018.09.20 631
490 spark-submit 실행시 "java.lang.OutOfMemoryError: Java heap space"발생시 조치사항 2018.02.01 631
489 spark-shell실행시 "A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection."오류가 발생하는 경우 해결방법 2016.05.20 625
488 Scala에서 countByWindow를 이용하기(예제) 2018.03.08 612
487 spark client프로그램 기동시 "Error initializing SparkContext"오류 발생할때 조치사항 2016.05.27 610
486 java.util.NoSuchElementException발생시 조치 2014.08.27 610
485 외부 기기(usb, 하드)등 mount(연결)하기 2014.08.03 610
484 hive기동시 Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D 오류 발생시 조치사항 2016.09.25 608
483 Query 1234:1234 expired due to client inactivity(timeout is 5m)및 invalid query handle 2022.06.10 600
482 [Hive canary]Hive에 Metastore canary red alert및 hive log파일에 Duplicate entry '123456' for key 'NOTIFICATION_LOG_EVENT_ID'가 발생시 조치사항 2023.03.10 594
위로