记一次spark写入redis

  • Post author:
  • Post category:其他



jedis api中文文档_CYY941027的博客-CSDN博客_jedis文档

背景:每天批量同步800W左右数据到redis,需覆盖之前的数据

maven 引用:

<dependency>
    <groupId>com.redislabs</groupId>
    <artifactId>spark-redis</artifactId>
    <version>2.3.1-RC1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
<dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
    <version>3.1.0</version>
</dependency>

方式一: 大数据量导致redis集群cpu100%

   case class Weather(adcode: Int, weather: String, temp:Int, humidity:Int)
  def main(args: Array[String]): Unit = {
    val spark = SparkSession.builder()
      .appName("SparkReadRedis



版权声明:本文为weixin_43442298原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。