메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

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


import org.apache.spark.SparkContext
import org.apache.spark.streaming.StreamingContext
import org.apache.spark.streaming.Seconds

object StreamingLogsMB {
  def main(args: Array[String]) {
    if (args.length < 2) {

      System.err.println("Usage: stubs.StreamingLogsMB <hostname> <port>")
      System.exit(1)
    }

    // get hostname and port of data source from application arguments
    val hostname = args(0)
    val port = args(1).toInt

    // Create a Spark Context
    val sc = new SparkContext()

    // Set log level to ERROR to avoid distracting extra output
    sc.setLogLevel("ERROR")

    // Configure the Streaming Context with a 1 second batch duration
    val ssc = new StreamingContext(sc,Seconds(1))

    // Create a DStream of log data from the server and port specified
    val logs = ssc.socketTextStream(hostname,port)

    ssc.checkpoint("logcheckpt")

    logs.countByWindow(Seconds(5), Seconds(2)).print

    ssc.start()
    ssc.awaitTermination()
  }
}

번호 제목 날짜 조회 수
227 [DBeaver 4.3.0]import/export시 "Client home is not specified for connection" 오류발생시 조치사항 2017.12.21 4561
226 hadoop cluster에 포함된 노드중에서 문제있는 decommission하는 방법및 절차 file 2017.12.28 5059
225 [2.7.2] distribute-exclude.sh사용할때 ssh 포트변경에 따른 오류발생시 조치사항 2018.01.02 4570
224 [Decommission]시 시간이 많이 걸리면서(수일) Decommission이 완료되지 않는 경우 조치 2018.01.03 10257
223 spark stream처리할때 두개의 client프로그램이 동일한 checkpoint로 접근할때 발생하는 오류 내용 2018.01.16 3537
222 Hadoop의 Datanode를 Decommission하고 나서 HBase의 regionservers파일에 해당 노드명을 지웠는데 여전히 "Dead regionser"로 표시되는 경우 처리 2018.01.25 3737
221 Could not compute split, block input-0-1517397051800 not found형태의 오류가 발생시 조치방법 2018.02.01 3290
220 spark-submit 실행시 "java.lang.OutOfMemoryError: Java heap space"발생시 조치사항 2018.02.01 3712
219 scala application 샘플소스(SparkSession이용) 2018.03.07 4366
218 Scala를 이용한 Streaming예제 2018.03.08 4302
» Scala에서 countByWindow를 이용하기(예제) 2018.03.08 4838
216 update 샘플 2018.03.12 4546
215 HA(Namenode, ResourceManager, Kerberos) 및 보안(Zookeeper, Hadoop) 2018.03.16 2707
214 hadoop 클러스터 실행 스크립트 정리 2018.03.20 4816
213 HDFS Balancer설정및 수행 2018.03.21 3166
212 Components of the Impala Server 2018.03.21 3434
211 cloudera-scm-agent 설정파일 위치및 재시작 명령문 2018.03.29 3968
210 Cloudera가 사용하는 서비스별 디렉토리 2018.03.29 3357
209 Cloudera가 사용하는 서비스별 포트 2018.03.29 3878
208 Cloudera설치중에 "Error, CM server guid updated"오류 발생시 조치방법 2018.03.29 3044
위로