val conf = new SparkConf()
conf .setAppName( "wow,my first spark app")
conf .setMaster( "local")
val sc = new SparkContext(conf)
var jd = new Jedis( "172.171.51.154", 6379)
var str = jd .get( "chengshi")
var strList = str .split( ",")
val a = sc .parallelize(strList, 3)
val b = a .keyBy(_ .length)
b .collect() .foreach(s => println(s._1 + ":" + s._2))
public static void main(String[] args) throws FileNotFoundException, IOException {
SparkConf conf = new SparkConf() .setAppName( "Spark Read From Redis written by Java") .setMaster( "local") ;
JavaSparkContext sc = new JavaSparkContext(conf) ;
Jedis jedis = new Jedis( "172.171.51.154", 6379) ;
String s = jedis .get( "chengshi") ;
String[] strList = s .split( ",") ;