Connecting to REDIS - alphagov/notifications-manuals GitHub Wiki
Sometimes it might be necessary to connect to REDIS via cli to troubleshoot.
Note: if you are connecting to the production environment a cyber request must be requested and approved.
Ensure you have the redis cli installed. Typically this will be:
brew install redis
From the notifications-aws repo run the following command:
gds aws notify-<env>-admin -- ./scripts/redis-connect/redis-connect.sh
- where is the environment name you wish to connect to.
This should give you a redis prompt where redis commands will work.
Follow this link to get a list of commands available.
- Go 'inside' the admin ecs container (please see Running commands inside ECS containers)
- Type the following commands
flask shell
from app.extensions import redis_client
(optional) To check if redis has connected successfully you can use the command
redis_client.redis_store.ping()
(if you get a 'True', then it is ok to continue)
You can then use any redis-cli commands listed in this link https://redis-py.readthedocs.io/en/latest/commands.html. For example:
redis_client.redis_store.keys("*")
redis_client.redis_store.get("your-key-name")
redis_client.redis_store.delete("your-key-name)