We use Redis on Spark to cache our key-value pairs.This is the code:
import com.redis.RedisClient
val r = new RedisClient(\"192.168.1.101\", 6379)
val perhit
You're trying to serialize the client. You have one RedisClient
, r
, that you're trying to use inside the map
that will be run across different cluster nodes. Either get the data you want out of redis separately before doing a cluster task, or create the client individually for each cluster task inside your map
block (perhaps by using mapPartitions
rather than map
, as creating a new redis client for each individual row is probably a bad idea).