跳到主要内容
版本:Next
input/redisINPUTBUFFERPROCESSOROUTPUT

Redis

Redis 输入(Input)从 Redis 读取数据,同时支持单机(standalone)与集群(cluster)两种连接模式,并提供 Subscribe(频道/模式)与 List 两种消费模式。作为通道型输入,它遵循引擎的取消安全契约:取消一次未完成的 read 不会丢失已解码的消息(参见输入投递语义)。

配置​

FieldTypeRequiredDefault描述
typestringyes—常量值 "redis"
modeobjectyes—连接模式(带标签的枚举),见下表
redis_typeobjectyes—消费模式(带标签的枚举),见下表

mode​

FieldTypeRequired描述
typestringyes"single" 或 "cluster"
urlstringyes (single)单机 URL,如 redis://host:6379
urlsarray<string>yes (cluster)集群节点 URL 列表

redis_type (subscribe)​

FieldTypeRequired描述
typestringyes"subscribe"
subscribeobjectyes订阅配置,见下文

subscribe:

FieldTypeRequired描述
typestringyes"channels" 或 "patterns"
channelsarray<string>yes (channels)频道列表
patternsarray<string>yes (patterns)模式列表

redis_type (list)​

FieldTypeRequired描述
typestringyes"list"
listarray<string>yes要消费的 Redis list 键列表

示例​

input:
type: "redis"
mode:
type: "single"
url: "redis://localhost:6379"
redis_type:
type: "subscribe"
subscribe:
type: "channels"
channels:
- "news"
- "events"
input:
type: "redis"
mode:
type: "single"
url: "redis://localhost:6379"
redis_type:
type: "list"
list:
- "tasks"
- "notifications"