# Redis Sink

The sink will publish the result into redis.

# Compile & deploy plugin

The plugin source code put in the extensions directory, but need build in the ekuiper root path

# cd $eKuiper_src
# go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/sinks/Redis.so extensions/sinks/redis/redis.go
# zip redis.zip plugins/sinks/Redis.so
# cp redis.zip /root/tomcat_path/webapps/ROOT/
# bin/kuiper create plugin sink redis -f /tmp/redisPlugin.txt
# bin/kuiper create rule redis -f /tmp/redisRule.txt
1
2
3
4
5
6

Restart the eKuiper server to activate the plugin.

# Properties

Property nameOptionalDescription
addrfalseThe addr of the Redis,example: 10.122.48.17:6379
passwordtrueThe Redis login password
dbfalseThe database of the Redis,example: 0
keyfalseSelect one of the Key, Key and field of Redis data and give priority to field
fieldtrueThis field must exist and be of type string. Otherwise, use the field character as the key. Note: Do not use a data template to configure this value
dataTypefalseThe default Redis data type is string. Note that the original key must be deleted after the Redis data type is changed. Otherwise, the modification is invalid. now only support "list" and "string"
expirationfalseTimeout duration of Redis data. This parameter is valid only for string data in seconds. The default value is -1

# Sample usage

Below is a sample for selecting temperature great than 50 degree, and some profiles only for your reference.

# /tmp/redisRule.txt

{
  "id": "redis",
  "sql": "SELECT * from  demo_stream where temperature > 50",
  "actions": [
    {
      "log": {},
      "redis":{
       "addr": "tcp://10.122.48.17:6379",
       "password": "123456",
       "db": "1",
       "dataType": "string",
       "expire": "10000",
       "field": "temperature"
      }
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# /tmp/redis.txt

{
   "file":"http://localhost:8080/redis.zip"
 }
1
2
3