checkout

Redis

  1. start redis in detached mode.
docker run --name my-redis -d -p 6379:6379 redis
  1. connect to your container
docker exec -it contianer_id /bin/bash
  1. Connecting to redis cli
redis-cli
  1. store a key value pair
SET user "tushar"
  1. get a value
GET user
  1. delete a key
DEL user

Tip

HSET/HGET/HDEL - store multiple values for single key - if you want to store different data for user with different id.

Redis as a queue

LPUSH problem 1 
LPUSH problem 2 
RPOP problem 
RPOP problem 
 
// blocking pop - will be blocked for t seconds till a value is pushed (t = 0 for infinite)
BRPOP problem t 

Postgres

  1. start postgres in detached mode
docker run -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres

postgresql://postgres:mysecretpossword@localhost:5432/postgres url to access postgres

Kafka

docker run -d --name kafka-zk \
  -e ALLOW_PLAINTEXT_LISTENER=yes \
  -e KAFKA_CFG_ZOOKEEPER_CONNECT=localhost:2181 \
  -p 9092:9092 -p 2181:2181 \
  bitnami/kafka:latest
docker stop kafka-zk && docker rm kafka-zk