Redis
Prerequisites
This node-type requires hiredis (>= 1.0.0) and redis++ (>= 1.2.3).
Implementation
The source code of the node-type is available here: https://github.com/VILLASframework/node/blob/master/lib/nodes/redis.cpp
Configuration
| mode | string Default: "key" Enum: "key" "hash" "channel"
|
| uri | string <uri> A Redis connection URI in the form of: |
| host | string Default: "localhost" The hostname or IP address of the Redis server. You can also connect to Redis server with a URI:
|
| port | integer Default: 6379 The port number of the Redis server to connect to. |
| path | string A path of a Unix socket which should be used for the connection. |
| user | string Default: "default" The username which should be used for authentication. |
| password | string The password which should be used for authentication. |
| db | integer Default: 0 The logical database which should be used by the Redis client. |
object | |
| keepalive | boolean Default: false Enable periodic keepalive packets. |
| key | string Default: "<node-name>" The key which this node will use in the Redis keyspace. |
| channel | string Default: "<node-name>" The channel which this node will use when |
| notify | boolean Default: true Use Redis keyspace notifications to listen for new updates.
This setting is only used if setting |
object | |
object (Input configuration (received by VILLASnode)) | |
| vectorize | integer Default: 1 This setting allows to send multiple samples in a single message to the destination nodes. The value of this setting determines how many samples will be combined into one packet. |
Array of Hook Object (object) or Hook Name (string) (hook_list) | |
| builtin | boolean (Builtin hook functions) Default: true By default, each node and paths has a couple of default hooks attached to them. With this setting the attachment of built-in hooks can be disabled. |
object (Output configuration (sent out by VILLASnode)) |
{- "mode": "key",
- "host": "localhost",
- "port": 6379,
- "path": "string",
- "user": "default",
- "password": "string",
- "db": 0,
- "timeout": {
- "connect": 0,
- "socket": 0
}, - "keepalive": false,
- "key": "<node-name>",
- "channel": "<node-name>",
- "notify": true,
- "ssl": {
- "enabled": true,
- "cacert": "string",
- "cacertdir": "string",
- "cert": "string",
- "key": "string"
}, - "in": {
- "signals": [
- {
- "name": "tap_position",
- "type": "integer",
- "init": 0
}, - {
- "name": "voltage",
- "type": "float",
- "unit": "V",
- "init": 230
}
], - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}, - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
], - "builtin": true,
- "out": {
- "vectorize": 0,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}
}Example
nodes = {
redis_node = {
type = "redis"
# Only valid for mode = 'channel' and 'key'
# With mode = 'hash' we will use a simple human readable format
format = "json"
# The Redis key to be used for mode = 'key' or 'hash' (default is the node name)
key = "my_key"
# The Redis channel tp be used for mode = 'channel' (default is the node name)
channel = "my_channel"
# One of:
# - 'channel' (publish/subscribe)
# - 'key' (set/get)
# - 'hash' (hmset/hgetall)
mode = "key"
# Whether or not to use Redis keyspace event notifications to get notified about updates
notify = false
# The polling rate when notify = false
rate = 1.0
# The Redis connection URI
uri = "tcp://localhost:6379/0"
# Alternatively the connection options can be specified independently
# host = "localhost"
# Note: options here will overwrite the respective part of the URI if both are given
# port = 6379
# db = 0
# path = "/var/run/redis.sock"
# user = "guest"
# password = "guest"
# ssl = {
# enabled = true
# cacert = "/etc/ssl/certs/ca-certificates.crt"
# cacertdir = "/etc/ssl/certs"
# cert = "./my_cert.crt"
# key = "./my_key.key"
# }
}
}