spark操作geoip的domain数据库

本小妞迷上赌 提交于 2020-03-03 09:42:15
val ipv4 = sc.textFile("hdfs://hbase11:9000/sparkTsData/GeoIP2-Domain-Blocks-IPv4.csv").map(_.split(",")).map(p=> (p(1),p(0)))
 
val ipv6 = sc.textFile("hdfs://hbase11:9000/sparkTsData/GeoIP2-Domain-Blocks-IPv6.csv").map(_.split(",")).map(p=> (p(1),p(0)))

val ip = ipv4 union ipv6

ip.saveAsTextFile("hdfs://hbase11:9000/sparkTsData/combineIp")
val ipSorted = ip.countByKey()
 
val ipSortedRdd = sc.parallelize(ipSorted.toList)
ipSortedRdd.collect
ipSortedRdd.filter(p=> p._2.toLong > 1).count
val ipSortedRddDup = ipSortedRdd.filter(p=> p._2.toLong > 1)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!