1 Star 0 Fork 0

GitHubImage / flink-connector-redis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

项目说明请见: https://www.jianshu.com/p/550bb43c0c0f

使用方法: mvn package -DskipTests=true 将生成的包flink-connector-redis_2.12-1.11.1.jar引入flink引擎中无需设置即可直接使用

SQL示例解析:

create table redis_table (appid varchar, accountid varchar, channel varchar, level varchar , PRIMARY KEY (appid, accountid) not enforced) with ( 'connector'='redis', 'cluster-nodes'='redis1:6379, redis2:6379, redis3:6379', 'redis-mode'='cluster', 'additional-key'='new_user', 'password'='*****','command'='HSET', 'maxIdle'='10', 'minIdle'='1','partition-column'='appid' );

insert into redis_table SELECT t.appid, t.accountid, t.channel, t.server from source_table t where t.is_new_account = 1;

additional-key 指定redis key

partition-column 指定了分区字段为appid,appid的值将会被追加到additional-key值后(_为分割符)

PRIMARY KEY 可以指定一个或者多个字段(command需为hset), 不可见字符拼接后的值会被保存成hashmap的hashfield值。定义redis表也可以无主键,command 对应改为set即可

假设测试数据如下:

{"accountid":"jeff","appid":"91000285","channel":"git","level ":"10"}

在redis中保存结果如下:

key: new_user_91000285 hashfield: 91000285\x01jeff value(按顺序拼接非primary key字段值): git\x0110

datastream api示例:RedisDataStreamInsertTest table/sql api示例类:InsertSQLTest

空文件

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/git-hub-image/flink-connector-redis.git
git@gitee.com:git-hub-image/flink-connector-redis.git
git-hub-image
flink-connector-redis
flink-connector-redis
main

搜索帮助