# Redis

{% hint style="info" %}
See the changelog of this Action type [here](/actions/redis.md).
{% endhint %}

## Overview

[Redis](https://redis.io/) is a powerful in-memory data structure store that can be used as a database, cache, and message broker. It provides high performance, scalability, and versatility, making it a popular choice for real-time applications and data processing.

<figure><picture><source srcset="/files/lUcpQcskgs8LPkU3oOBX" media="(prefers-color-scheme: dark)"><img src="/files/BxpsrcutuYR7lhtUfUdZ" alt=""></picture><figcaption></figcaption></figure>

The **Redis** Action allows users to set and retrieve data from a Redis server.

{% hint style="warning" %}
In order to configure this action, you must first link it to a Listener. Go to [Building a Pipeline ](/the-workspace/pipelines/building-a-pipeline.md)to learn how to link.
{% endhint %}

## Ports <a href="#ports" id="ports"></a>

These are the input and output ports of this Action:

<details>

<summary>Input ports</summary>

* **Default port** - All the events to be processed by this Action enter through this port.

</details>

<details>

<summary>Output ports</summary>

* **Default port** - Events are sent through this port if no error occurs while processing them.
* **Error port** - Events are sent through this port if an error occurs while processing them.

</details>

## Installing Redis

To use this Action, you must install Redis and Redis CLI.

As installing Redis via a Docker is generally preferable, we will brief you on this procedure. To install it locally, check [this article](https://redis.io/docs/latest/operate/oss_and_stack/install/).

{% stepper %}
{% step %}
Start your local Redis Docker instance:

{% tabs %}
{% tab title="Using docker file" %}

```docker
FROM redis:latest

EXPOSE 6379

CMD ["redis-server"]

## build

docker build -t my-redis-image

## run

docker run -d --name my-redis my-redis-image
```

{% endtab %}

{% tab title="Using one line command" %}

```
docker run -d --name my-redis -p 6379:6379 redis/redis-stack-server:latest
```

{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}
Now, connect to the Redis container:

```docker
docker exec -it {{ContainerID}} sh

> redis-cli
```

{% endstep %}

{% step %}
Use this command to get the IP:

```docker
# Read Value

127.0.0.1:6379> GET key

# Set Value

SET key value
```

{% endstep %}

{% step %}
Paste this IP in the **Redis endpoint** field of your **Redis** Action.
{% endstep %}
{% endstepper %}

For more help and in-depth detail, see [these use cases](https://www.simplehomelab.com/redis-docker-compose-example/).

## Configuration

{% stepper %}
{% step %}
Find **Redis** in the **Actions** tab (under the **Advanced** group) and drag it onto the canvas. Link it to the required [Listener](https://docs.onum.com/the-workspace/listeners) and [Data sink](https://docs.onum.com/the-workspace/pipelines/data-sinks).
{% endstep %}

{% step %}
To open the configuration, click the Action in the canvas and select **Configuration**.
{% endstep %}

{% step %}
Enter the required parameters:

**Connection Settings**

<table><thead><tr><th width="170.3984375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Endpoint</strong><mark style="color:red;"><strong>*</strong></mark></td><td>Enter the endpoint used to establish the connection to the Redis server.</td></tr></tbody></table>

**Network Timeout**

<table><thead><tr><th width="170.3984375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Read Timeout</strong><mark style="color:red;"><strong>*</strong></mark></td><td>Enter the maximum amount of milliseconds to wait to receive data after the connection has been established and the request has been sent.</td></tr><tr><td><strong>Write Timeout</strong><mark style="color:red;"><strong>*</strong></mark></td><td>Enter the maximum amount of milliseconds to wait while trying to send data to the server.</td></tr></tbody></table>

**Command**

<table><thead><tr><th width="170.3984375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Commands</strong><mark style="color:red;"><strong>*</strong></mark></td><td><p>The command to read or write data from the Redis server. </p><ul><li><p><strong>SET</strong> </p><ul><li><strong>Redis Key</strong><mark style="color:red;"><strong>*</strong></mark>- Choose the input field that contains it the model version.</li><li><strong>Value</strong><mark style="color:red;"><strong>*</strong></mark> - Choose the field that contains the events you want to input to Redis.</li><li><strong>Expiration in seconds</strong> - Optionally, enter how long the key will be available in the Redis server.  The minimum value is <code>0</code>.</li></ul></li><li><p><strong>HSET</strong></p><ul><li><strong>Redis Key</strong><mark style="color:red;"><strong>*</strong></mark>- Choose the input field that contains it the model version.</li><li><strong>Field/Value pairs -</strong> Add as many fields and pipeline values as required.</li></ul></li><li><p><strong>GET</strong></p><ul><li><strong>Redis Key</strong><mark style="color:red;"><strong>*</strong></mark>- Choose the input field that contains it the model version.</li><li><strong>Output field</strong><mark style="color:red;"><strong>*</strong></mark> - Enter a name for the output field that will store the output data.</li></ul></li><li><p><strong>HGET</strong> </p><ul><li><strong>Redis Key</strong><mark style="color:red;"><strong>*</strong></mark>- Choose the input field that contains it the model version.</li><li><strong>Redis field</strong><mark style="color:red;"><strong>*</strong></mark> - Select the field from the Listener or Action that serves as the HGET field. </li><li><strong>Output field</strong><mark style="color:red;"><strong>*</strong></mark> - Enter a name for the output field that will store the output data.</li></ul></li></ul></td></tr></tbody></table>
{% endstep %}

{% step %}
Click **Save** to complete.
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onum.com/the-workspace/pipelines/actions/advanced/redis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
