https://github.com/mongoexpuser/ubuntu-redis-stack-server-image-and-containers
Redis Stack Servers with Auto Failover on Docker
https://github.com/mongoexpuser/ubuntu-redis-stack-server-image-and-containers
apps bash docker docker-compose iot middlewares nodejs redis redis-stack routes sentinel ubuntu
Last synced: about 2 months ago
JSON representation
Redis Stack Servers with Auto Failover on Docker
- Host: GitHub
- URL: https://github.com/mongoexpuser/ubuntu-redis-stack-server-image-and-containers
- Owner: MongoExpUser
- License: mit
- Created: 2023-06-15T01:39:24.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-09T07:52:35.000Z (over 2 years ago)
- Last Synced: 2025-01-26T19:37:22.337Z (over 1 year ago)
- Topics: apps, bash, docker, docker-compose, iot, middlewares, nodejs, redis, redis-stack, routes, sentinel, ubuntu
- Language: JavaScript
- Homepage:
- Size: 3.82 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ubuntu-Redis-Stack-Server-Image-and-Containers
## Redis Stack Servers with Auto Failover
Create Image and Deploy Containers for Redis Stack Servers (1 Primary and 2 Replicas) with Auto Failover for an IOT Application.
## Architectural Diagram

### 1) Build Image:
* Build
sudo docker build --no-cache -t iot/ubuntu-22.04-redis-stack-server-6.2.6-v7:latest .
### 2) Deploy Containers with Docker Compose:
* Deploy containers
set PWD=%cd% && sudo docker compose -f docker-compose-redis.yml --project-directory $PWD --project-name "iot-app" up -d
* stop and remove containers with related network
set PWD=%cd% && sudo docker compose -f docker-compose-redis.yml --project-directory $PWD --project-name "iot-app" down
* stop services
set PWD=%cd% && sudo docker compose -f docker-compose-redis.yml --project-directory $PWD --project-name "iot-app" stop
* start services
set PWD=%cd% && sudo docker compose -f docker-compose-redis.yml --project-directory $PWD --project-name "iot-app" start
* logs: view output from containers
set PWD=%cd% && sudo docker compose -f docker-compose-redis.yml --project-directory $PWD --project-name "iot-app" logs
### 3) Check Logs From Inside the Host - First Check After Deployment:
* Redis Nodes
sudo docker exec -it redis-node1 /bin/bash -c "sudo tail -n 600 /var/log/redis.log"
sudo docker exec -it redis-node2 /bin/bash -c "sudo tail -n 600 /var/log/redis.log"
sudo docker exec -it redis-node3 /bin/bash -c "sudo tail -n 600 /var/log/redis.log"
* Sentinel Nodes
sudo docker exec -it sentinel-node1 /bin/bash -c "sudo tail -n 600 /var/log/redis/redis-sentinel.log"
sudo docker exec -it sentinel-node2 /bin/bash -c "sudo tail -n 600 /var/log/redis/redis-sentinel.log"
sudo docker exec -it sentinel-node3 /bin/bash -c "sudo tail -n 600 /var/log/redis/redis-sentinel.log"
### 4) Interact with Containers/Connect to Containers:
* Redis Nodes
sudo docker exec -it redis-node1 /bin/bash
sudo docker exec -it redis-node2 /bin/bash
sudo docker exec -it redis-node3 /bin/bash
* Sentinel Nodes
sudo docker exec -it sentinel-node1 /bin/bash
sudo docker exec -it sentinel-node2 /bin/bash
sudo docker exec -it sentinel-node3 /bin/bash
### 5) Connect to Redis and Sentinel Servers Inside the Containers:
* Redis Nodes
redis-cli --raw -h localhost -p 6379 --tls --cert /etc/ssl/certs/server.crt --key /etc/ssl/certs/server.key --cacert /etc/ssl/certs/root.crt -a
* Sentinel Nodes
redis-cli --raw -h localhost -p 26379 --tls --cert /etc/ssl/certs/server.crt --key /etc/ssl/certs/server.key --cacert /etc/ssl/certs/root.crt -a
### 6) Check Configuration Information: Run Directly with Bash
* Redis Nodes
sudo docker exec -it redis-node1 /bin/bash -c "sudo redis-cli --raw -h localhost -p 6379 --tls --cert /etc/ssl/certs/server.crt --key /etc/ssl/certs/server.key --cacert /etc/ssl/certs/root.crt -a password INFO"
sudo docker exec -it redis-node2 /bin/bash -c "sudo redis-cli --raw -h localhost -p 6379 --tls --cert /etc/ssl/certs/server.crt --key /etc/ssl/certs/server.key --cacert /etc/ssl/certs/root.crt -a password INFO"
sudo docker exec -it redis-node3 /bin/bash -c "sudo redis-cli --raw -h localhost -p 6379 --tls --cert /etc/ssl/certs/server.crt --key /etc/ssl/certs/server.key --cacert /etc/ssl/certs/root.crt -a password INFO"
* Sentinel Nodes
sudo docker exec -it sentinel-node1 /bin/bash -c "sudo redis-cli --raw -h localhost -p 26379 --tls --cert /etc/ssl/certs/server.crt --key /etc/ssl/certs/server.key --cacert /etc/ssl/certs/root.crt -a password INFO"
sudo docker exec -it sentinel-node2 /bin/bash -c "sudo redis-cli --raw -h localhost -p 26379 --tls --cert /etc/ssl/certs/server.crt --key /etc/ssl/certs/server.key --cacert /etc/ssl/certs/root.crt -a password INFO"
sudo docker exec -it sentinel-node3 /bin/bash -c "sudo redis-cli --raw -h localhost -p 26379 --tls --cert /etc/ssl/certs/server.crt --key /etc/ssl/certs/server.key --cacert /etc/ssl/certs/root.crt -a password INFO"
# License
Copyright © 2023. MongoExpUser
Licensed under the MIT license.