메뉴 건너뛰기

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()
  }
}

번호 제목 날짜 조회 수
630 hbase CustomFilter만들기 (0.98.X이상) 2015.05.08 4664
629 hbase가 기동시키는 zookeeper에서 받아드리는 ip가 IPv6로 사용되는 경우가 있는데 이를 IPv4로 강제적용하는 방법 2015.05.08 4539
628 secureCRT에서 backspace키가 작동하지 않는 경우 해결방법 2015.05.11 4465
627 Nodes of the cluster (unhealthy)중 1/1 log-dirs are bad: 오류 해결방법 2015.05.17 4497
626 Permission denied: user=hadoop, access=EXECUTE, inode="/tmp":root:supergroup:drwxrwx--- 오류해결방법 2015.05.17 3409
625 java.lang.ClassNotFoundException: org.apache.hadoop.util.ShutdownHookManager 오류조치사항 2015.05.20 4262
624 flume 1.5.2 설치및 테스트(source : file, sink : hdfs) in HA 2015.05.21 4413
623 hbase shell 필드 검색 방법 2015.05.24 5689
622 HAX is not working and emulator runs in emulation mode 메세지가 나오는 경우 file 2015.05.25 2267
621 apk 파일 위치 file 2015.05.25 4320
620 센서테스트 file 2015.05.25 2391
619 Error: Could not find or load main class nodemnager 가 발생할때 해결하는 방법 2015.06.05 4448
618 Error: E0501 : E0501: Could not perform authorization operation, User: hadoop is not allowed to impersonate hadoop 해결하는 방법 2015.06.07 4248
617 "File /user/hadoop/share/lib does not exist" 오류 해결방법 2015.06.07 4146
616 hadoop 2.6.0에 sqoop2 (1.99.5) server및 client설치 == fail 2015.06.11 4525
615 Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.http.HttpConfig.getSchemePrefix()Ljava/lang/String; 해결->실패 2015.06.14 2613
614 hortonworks에서 제공하는 메모리 설정값 계산기 사용법 file 2015.06.14 4274
613 java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error: Unable to deserialize reduce input key from...오류해결방법 2015.06.16 5943
612 Tracking URL = N/A 가발생하는 경우 - 환경설정값을 잘못설정하는 경우에 발생함 2015.06.17 4595
611 바나나 파이의 /tmp폴더를 외장하드로 변경하기 2015.07.24 3072
위로