Redis is an open-source, in-memory data structure store often used as a database, cache, and message broker.
It supports various data structures like strings, hashes, lists, sets, and sorted sets
- Replication: Supports master-slave replication, making it suitable for high-availability setups.
- Pub/Sub Messaging: Allows message publishing and subscribing, making it useful for real-time messaging applications.
- Redis Cloud https://redis.io/try-free
- Redis on machine https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/ ** Docker
- Docker compose file
version: '3'
services:
redis:
image: redis:latest
container_name: my_redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
restart: unless-stopped
volumes:
redis_data:
- Run docker compose file
docker-compose up -d
- Check status
docker ps -a
- connect to Redis using the Redis CLI
(Redis CLI is part of the Redis package, so installing Redis will also install the CLI)
(Redis CLI is a powerful tool for working with Redis directly from the terminal)
docker exec -it redis_container redis-cli
https://redis.io/docs/latest/develop/connect/cli/
Install Redis Insight (using browser)
(As of RedisInsight version 2.x, the default internal port has changed to 5540 instead of 8001)
version: '3.8'
services:
redisinsight:
image: redis/redisinsight:latest
container_name: redisinsight
ports:
- "8080:5540" # Map host port 8080 to container port 5540
volumes:
- redisinsight_data:/data # Attach the volume to /data in the container
restart: unless-stopped
volumes:
redisinsight_data:
- Add a New Redis Database in RedisInsight
Host: Enter host.docker.internal if you’re using Docker Desktop (for macOS or Windows), or localhost if using Docker on Linux.
Port: Enter 6379, which is the default Redis port.
Client libraries Redis for VS Code