Redis-stack helm chart

Run Redis Stack on Docker

Docker Pull Command

1
docker pull redis/redis-stack:7.4.0-v0

Getting started with Docker

In the default configuration, Redis does not require a password to authenticate clients. To provide basic security for your Redis Stack server, it is recommended to set a password using the requirepass directive. Configure this using an environment variable when starting the container:

To start Redis Stack server using the redis-stack image, run the following command in your terminal:

1
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 -e REDIS_ARGS="--requirepass mypassword" redis/redis-stack:latest

You can then connect to the server using redis-cli, just as you connect to any Redis instance.

If you don’t have redis-cli installed locally, you can run it from the Docker container:

1
$ docker exec -it redis-stack redis-cli

RedisInsight

The docker run command above also exposes RedisInsight on port 8001. You can use RedisInsight by pointing your browser to http://localhost:8001.

Redis Stack supports the ability to configure multiple named users, each with their own password and access control configuration. Refer to the [Redis Access Control List documentation][https://redis.io/docs/management/security/acl/] for more information.

Environment variables

To pass in arbitrary configuration changes, you can set any of these environment variables:

  • REDIS_ARGS: extra arguments for Redis
  • REDISEARCH_ARGS: arguments for RediSearch
  • REDISJSON_ARGS: arguments for RedisJSON
  • REDISGRAPH_ARGS: arguments for RedisGraph
  • REDISTIMESERIES_ARGS: arguments for RedisTimeSeries
  • REDISBLOOM_ARGS: arguments for RedisBloom

Quickest started

The Quickest way to starting redis-stack with Docker.

1
docker run -p 6379:6379 -p 8001:8001 redis/redis-stack

This launches the redis-stack an extension of Redis that adds all manner of modern data structures to Redis. You’ll also notice that if you open up http://localhost:8001 you’ll have access to the redis-insight GUI, a GUI you can use to visualize and work with your data in Redis.

  • redis/redis-stack contains both Redis Stack server and RedisInsight. This container is best for local development because you can use RedisInsight to visualize your data.
  • redis/redis-stack-server provides Redis Stack but excludes RedisInsight. This container is best for production deployment.

Installation

To add the repo:

1
helm repo add redis-stack https://redis-stack.github.io/helm-redis-stack/

To install redis-stack helm chart with latest images, run:

1
helm install redis-stack redis-stack/redis-stack

To install redis-stack-server helm chart with latest images, run:

1
helm install redis-stack redis-stack/redis-stack-server

To install the helm chart with specific redis tag, just add –set tag:

1
helm install redis-stack redis-stack/redis-stack --set redis_stack.tag="<TAG>"

For example, to run redis stack with redis version 7.0.0, run:

1
helm install redis-stack redis-stack/redis-stack --set redis_stack.tag="7.0.0-RC5"

Usage

To connect to redis-cli run:

1
kubectl get pods -o name | grep redis-stack

Copy the name of the pod (E.g. redis-stack-77d596476d-6j4d2) and run the following command:

1
kubectl exec -it <POD_NAME> -- redis-cli

By default redis-stack will have no password, Redis Stack supports the ability to configure multiple named users, each with their own password and access control configuration. Refer to the Redis Access Control List documentation for more information. Alternatively the configuration file can be modified and the requirepass directive added. This can also be triggered via the REDIS_ARGS environment variable. Examples are available on the docker image page

Redis OM Python

Redis OM Python makes it easy to model Redis data in your Python applications.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import datetime
from typing import Optional

from pydantic import EmailStr

from redis_om import HashModel


class Customer(HashModel):
    first_name: str
    last_name: str
    email: EmailStr
    join_date: datetime.date
    age: int
    bio: Optional[str] = None


# First, we create a new `Customer` object:
andrew = Customer(
    first_name="Andrew",
    last_name="Brookins",
    email="andrew.brookins@example.com",
    join_date=datetime.date.today(),
    age=38,
    bio="Python developer, works at Redis, Inc."
)

# The model generates a globally unique primary key automatically
# without needing to talk to Redis.
print(andrew.pk)
# > "01FJM6PH661HCNNRC884H6K30C"

# We can save the model to Redis by calling `save()`:
andrew.save()

# Expire the model after 2 mins (120 seconds)
andrew.expire(120)

# To retrieve this customer with its primary key, we use `Customer.get()`:
assert Customer.get(andrew.pk) == andrew