标签:href message image table env environ word div contain
redis fdw 封装的redis 操作功能还是比较强大的,同时支持通过insert 的方式publish messag
以下是一个简单的学习(但是按照原理应该也是可以sub的 (select message,细节可以看看源码))
version: "3"
services:
redis:
image: redis
ports:
- "6379:6379"
pg-redis:
image: dalongrong/pgspider:redis
ports:
- "5432:5432"
environment:
- "POSTGRES_PASSWORD:dalong"
docker-compose up -d
// 创建扩展
CREATE EXTENSION redis_fdw;
// 创建server
CREATE SERVER redis_server
FOREIGN DATA WRAPPER redis_fdw
OPTIONS (host ‘redis‘, port ‘6379‘);
// 创建用户映射
CREATE USER MAPPING FOR postgres
SERVER redis_server
OPTIONS (password ‘demo‘);
// 创建表映射
CREATE FOREIGN TABLE rft_pub(
channel TEXT,
message TEXT,
len INT
) SERVER redis_server
OPTIONS (tabletype ‘publish‘);
redis-cli
SUBSCRIBE demoapps
插入数据:
insert into rft_pub(channel,message) values(‘demoapp‘,‘dalong‘);
redis fdw 的扩展功能还是比较强大,后边可以仔细研究下代码的实现
https://github.com/nahanni/rw_redis_fdw
https://github.com/rongfengliang/pgspider-docker
https://hub.docker.com/repository/docker/dalongrong/pgspider
pgspider redis fdw pub && sub 试用
标签:href message image table env environ word div contain
原文地址:https://www.cnblogs.com/rongfengliang/p/12294035.html