京东hotkey把热点数据默认缓存在了本地缓存caffeine中,也可以存到redis中,但是京东hotkey的SDK没有redis的实现方法,因此需要自己实现。
官方目录结构下:分别是client客户端(要打包引入到自己的项目)、common工具包(也打包引入到自己项目),dashboard(hotkey可视化面板,自己设置端口启动即可)、sample(实现demo)、worker(也要自己设置端口并且启动,用来和etcd交流信息)
client是hotKey客户端,需要打包引入到我们自己的项目中(在自己项目中建个lib目录),刚开始打包报错,说是找不到某些模块,把父模块clean然后install一下,再打包client模块就好了。
client打成jar包后,要用的是with-dependencies包,并且要改名成hotkey-client-0.0.4-SNAPSHOT.jar,因为我们自己项目的依赖名字就是hotkey-client-0.0.4-SNAPSHOT.jar

另外client的pom文件会加载不到一个plugin,这个时候需要设置一下groupId,去中央仓库看一下就知道了:
自己的项目引入依赖:
<dependency>
<artifactId>hotkey-client</artifactId>
<groupId>com.jd.platform.hotkey</groupId>
<version>0.0.4-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/hotkey-client-0.0.4-SNAPSHOT.jar</systemPath>
</dependency>
dashboard模块,配置启动端口和etcd的地址,默认是http://127.0.0.1:2379,另外resources目录下还有db.sql需要建表,是dashboard运行所必须的。
配置用户:appName和后端yml配置要相同

配置dashboard的热key规则:

worker模块配置端口直接启动即可。
项目成功接入hotKey监控


