大数据学习之PB级百战出行网约车二
21.订单监控_Redis工具类

package com . itbaizhan . utils ;
import redis . clients . jedis . Jedis ;
import redis . clients . jedis . JedisPool ;
import redis . clients . jedis . JedisPoolConfig ;
/**
* 操作 redis 数据库
62 */
public class RedisUtils {
private static JedisPool jedisPool ;
static {
JedisPoolConfig jedisPoolConfig =
new JedisPoolConfig ();
// 最大连接数 默认 8
jedisPoolConfig . setMaxTotal ( 10000 );
// 最大空闲连接数 默认 8
jedisPoolConfig . setMaxIdle ( 2000 );
jedisPool = new JedisPool (
jedisPoolConfig , "node4" ,
6379 , 10000
);
}
/**
* 从 jedis 连接池中获取获取 jedis 对象
*
* @return
*/
public static Jedis getJedis () {
return jedisPool . getResource ();
}
/**
* 回收链接
9
63 订单监控 _ 保存数据到 Redis 中
*/
public void returnRedis ( Jedis jedis ){
jedisPool . returnResource ( jedis );
}
public static void main ( String [] args ) {
Jedis instance =
RedisUtils . getJedis ();
String a = instance . get ( "a" );
System . out . println ( a );
}
}
22.订单监控_保持数据到Redis中


23.虚拟车站_需求分析

24.虚拟车站_虚拟车站实现思路

25.虚拟车站_UBER h3介绍

26.虚拟车站_H3算法试用

H3 索引 Long 类型
val h3 = H3Core . newInstance
/**
* 经纬度转 h3 地址
* @param lat 经度
* @param lon 纬度
* @param res 边长
* @return
*/
def locationToH3 ( lat : Double , lon : Double ,
res : Int ): Long = {
h3 . geoToH3 ( lat , lon , res )
}
1
2
3
4
5
6
7
8
9
10
11
12
def main ( args : Array [ String ]): Unit = {
println ( locationToH3 ( 31.920523 ,
119.168182 , 6 ))
println ( locationToH3 ( 31.920524 ,
119.168188 , 6 ))
println ( locationToH3 ( 31.920525 ,
119.168189 , 6 ))
println ( locationToH3 ( 31.920526 ,
119.168180 , 6 ))
println ( locationToH3 ( 31.920527 ,
119.168184 , 6 ))
}
27.虚拟车站_Hbase工具类上



28.虚拟车站_Hbase工具类下




29.虚拟车站_KAFKA消费订单数据





30.虚拟车站_存储订单数据至HBASE




31.虚拟车站_SPARKSQL读取HBASE订单数据

32.虚拟车站_创建订单数据DATAFRAME



33.虚拟车站_SPARKSQL集成H3



34.虚拟车站_虚拟车站站点统计


35.虚拟车站_保存虚拟车站信息













