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

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

Restart the eKuiper server to activate the plugin.

Properties

Property name Optional Description
addr false The addr of the Redis,example: 10.122.48.17:6379
password true The Redis login password
db false The database of the Redis,example: 0
key false Select one of the Key, Key and field of Redis data and give priority to field
field true This 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
dataType false The 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”
expiration false Timeout 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

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

/tmp/redis.txt

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