Skip to content

ChickenBenny/Service-with-Redis-cluster-and-Nginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tags: Microservice

Service with Redis cluster

Quick start

  1. Create a directory for this project
$ mkdir service
$ cd service
$ git clone https://github.com/ChickenBenny/Service-with-Redis-cluster-and-Nginx.git
  1. Change the ip of redis cluster

Find your server ip first and go into redis folder change the ip in shell.

After change the ip, you should run the script(needToRun.sh), which will help you create all the redis config.

// needToRun.sh
ip=${change your ip here}
for port in {7001..7006}; 
do 
mkdir -p ./${port}/conf && PORT=${port} IP=${ip} envsubst < ./redis-cluster.tmpl > ./${port}/conf/redis.conf; 
done
  1. Export and compose the project
$ export IP=${your ip}
$ docker-compose up
  1. Service workflow

Technology

  • Nginx (load balancer)
  • Fastapi (backend server)
  • React (frontend server)
  • Redis (NoSQL database)
  • Docker (Container)

Learn more

Nginx

We used Nginx as load balancer. Take a look as following resource.

Fastapi

We used fastapi as backend framework. We create thee workers and a data management app. Take a look as following resource.

Redis

We used redis as our database, because we are solving key-value mapping issue and we want the reponse really quickly. Take a look as following resource.

React

We used React as our db management frontend page. Take a look as following resource.