Skip to content
Fernanda Scovino edited this page Sep 6, 2022 · 5 revisions

Connect to Redis local

  • In your shell, access your Redis server on k8s by running:
kubectl port-forward svc/redis -n <your-namespace> 6379:6379

We use redis namespace by default on k8s

  • Then you can access Redis on your localhost:6379

Get Redis client (Python)

# first, make sure to install:
# pip install redis-pal
from redis_pal import RedisPal
redis_client = RedisPal(host="...", port=XXXX)
  • If running local, set:
redis_client = RedisPal(host="localhost", port=6379)

Manage Redis keys (Python)

  • Get value by key:
redis_client.get(key)
  • Set new value/key (or change value already set on that key):
redis_client.set(key, value)
Clone this wiki locally