Skip to content

ProchazkaDavid/PA195

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PA195 NoSQL Databases - Redis

Go Report Card GitHub

NoSQL Databases, Fall 2019 – Group Projects

Running a single instance

# Create a network for a Redis
docker network create redisnet

# Run a single instance that is automatically removed after being killed
docker run --rm --net redisnet --name redis -d redis

# Now you should see Redis container running
docker ps

# Launch redis-cli that is automatically removed after exit
docker run --rm --net redisnet --name redis-cli -it goodsmileduck/redis-cli redis-cli -h redis.redisnet

# After you are done with experimenting, kill Redis container
docker kill redis

NOTE: You can add -p 127.0.0.1:6379:6379 to your redis container to access port locally and not only through redis-cli in the docker container.

Running a cluster

Redis cluster tutorial

Starting a cluster

docker-compose up

Initialization

docker exec -it redis-1 redis-cli -p 7000 --cluster create \
192.168.0.2:7000 \
192.168.0.3:7001 \
192.168.0.4:7002 \
192.168.0.5:7003 \
192.168.0.6:7004 \
192.168.0.7:7005 \
--cluster-replicas 1

Then type yes and you are ready to go.

Connecting to the cluster

NOTE: use -c to enable cluster mode

docker exec -it redis-1 redis-cli -c -p 7000

Removal of the cluster

docker-compose down

Team

David Procházka Josef Podaný Matěj Tužil
David Procházka Josef Podaný Matěj Tužil
github.com/ProchazkaDavid github.com/josefpodany github.com/xtuzil

Sources