package com.prince.demo.test
import java.util.UUID
import com.typesafe.config.{Config, ConfigFactory}
import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.client.Put
import org.apache.hadoop.hbase.io.ImmutableBytesWritable
import org.apache.hadoop.hbase.mapred.TableOutputFormat
import org.apache.hadoop.hbase.util.Bytes
import org.apache.hadoop.mapred.JobConf
import org.apache.kafka.common.serialization.StringDeserializer
import org.apache.log4j.{Level, Logger}
import org.apache.spark.sql.SparkSession
import org.apache.spark.streaming.kafka010.ConsumerStrategies.Subscribe
import org.apache.spark.streaming.kafka010.KafkaUtils
import org.apache.spark.streaming.kafka010.LocationStrategies.PreferConsistent
import org.apache.spark.streaming.{Seconds, StreamingContext}
/**
* Created by prince on 2018/5/17.
*/
object ReadKafka {
Logger.getLogger("org").setLevel(Level.WARN)
implicit val conf: Config = ConfigFac
spark读取kafka数据写入hbase
最新推荐文章于 2024-09-01 11:13:23 发布
这篇博客介绍了如何使用Spark从Kafka消费数据,解析JSON格式的消息,然后将处理后的数据写入到HBase数据库中。内容涵盖了Kafka数据传输的格式以及模拟写入Kafka的步骤。
摘要由CSDN通过智能技术生成