GithubHelp home page GithubHelp logo

kuldeepsingh99 / redis-cluster Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 33 KB

Spring boot My SQL with Redis Cache

Dockerfile 2.23% Java 97.77%
spring-boot redis-cluster redis-cache mysql lettuce

redis-cluster's Introduction

How to set up Redis Cluster

Pull Redis Image

$docker pull redis

Create redis configuration file

port 6379
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes

Create network

$docker create network java_backend

Create Redis Instances

$ docker run -d --net java_backend -v /home/ubuntu/redis/redis.conf:/usr/local/etc/redis/redis.conf --name redis-1 redis redis-server /usr/local/etc/redis/redis.conf
$ docker run -d --net java_backend -v /home/ubuntu/redis/redis.conf:/usr/local/etc/redis/redis.conf --name redis-2 redis redis-server /usr/local/etc/redis/redis.conf
$ docker run -d --net java_backend -v /home/ubuntu/redis/redis.conf:/usr/local/etc/redis/redis.conf --name redis-3 redis redis-server /usr/local/etc/redis/redis.conf
$ docker run -d --net java_backend -v /home/ubuntu/redis/redis.conf:/usr/local/etc/redis/redis.conf --name redis-4 redis redis-server /usr/local/etc/redis/redis.conf
$ docker run -d --net java_backend -v /home/ubuntu/redis/redis.conf:/usr/local/etc/redis/redis.conf --name redis-5 redis redis-server /usr/local/etc/redis/redis.conf
$ docker run -d --net java_backend -v /home/ubuntu/redis/redis.conf:/usr/local/etc/redis/redis.conf --name redis-6 redis redis-server /usr/local/etc/redis/redis.conf

Executing these command will create 6 Redis instances, for demo purpose i am create container in one machine, on production environment we should container in different instances.

Create Cluster

$ docker exec redis-1 redis-cli --cluster create 172.29.0.2:6379 172.29.0.3:6379 172.29.0.4:6379 172.29.0.5:6379 172.29.0.6:6379 172.29.0.7:6379 --cluster-replicas 1

This command will create cluster with 3 master node and 3 slaves

Set up Spring boot MYSQL Instance

Exceute the docker compose yaml file to create spring boot and mysql instance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.