Connect to Redis, the world’s fastest in-memory database

August 29, 2024

A powerful in-memory data structure store that can be used as a database, cache, and message broker.

Post content

Redis provides high performance, scalability, and versatility, making it a popular choice for real-time applications and data processing. With its support for various data structures, persistence options, and clustering capabilities. Redis is a valuable tool for improving data storage and retrieval.

Installing Redis

Redis is available to install in two ways:

On the Cloud

As it is generally preferable to install Redis via a Docker, we will brief you on this procedure.

  • Start your local Redis docker instance

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

    Copy the container ID and use it in the following command

    docker exec -it {{ContainerID}} sh > redis-cli

    If you are using a docker file:

    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

    Connect to Redis Container

    docker exec -it {{ContainerID}} sh> redis-cli

    Redis commands

    # Read Value

    127.0.0.1:6379> GET key

    # Set Value

    SET key value

For more help and in-depth detail, see these use cases.

In Onum

In Onum, paste this IP in the Redis endpoint field of your Redis action.

redis endpoint