๐Ÿ“—
smiley book
  • Smiley Books
  • AI
    • Readme
    • openai-whisper
      • ์ƒ˜ํ”Œ ์‹คํ–‰ํ•ด๋ณด๊ธฐ
      • GPU ์„œ๋ฒ„ ์ค€๋น„ํ•˜๊ธฐ
      • API๋กœ whisper๋ฅผ ์™ธ๋ถ€์— ์˜คํ”ˆํ•˜๊ธฐ
      • ํ”„๋กฌํ”„ํŠธ ์ง€์›
      • ์‹ค์‹œ๊ฐ„ message chat
      • ํ™”๋ฉด ์ด์˜๊ฒŒ ๋งŒ๋“ค๊ธฐ์™€ ๋กœ๊ทธ์ธ
      • ํŒŒ์ด์ฌ ๊ฐ€์ƒํ™˜๊ฒฝ
      • ์‹ค์‹œ๊ฐ„ voice chat
      • fine tunning(๋ฏธ์„ธ ์กฐ์ •) ์œผ๋กœ ์„ฑ๋Šฅ ์˜ฌ๋ฆฌ๊ธฐ
      • app์—์„œ api๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์‹ค์‹œ๊ฐ„์œผ๋กœ ํ…์ŠคํŠธ๋กœ ๋ฐ”๊ฟ”๋ณด๊ธฐ
    • ollama - llm์„ ์‰ฝ๊ฒŒ ๋‚ด์ปด์—์„œ ์‹คํ–‰
      • ollama webui
      • ollama docker
    • stable diffusion
      • SDXL - text to image
      • SD-webui
    • ChatGPT
      • ๋‹ต๋ณ€์ด ๋Š๊ธธ๋•Œ
      • ์—ญํ• ์„ ์ •ํ•˜์ž
      • ๊ตฌ์ฒด์ ์ธ ์งˆ๋ฌธ
      • ๊ฒฐ๊ณผํ˜•ํƒœ๋ฅผ ์ง€์ •
      • ํ”„๋กฌํ”„ํŠธ๋ฅผ ์—ฌ๋Ÿฌ์ค„๋กœ ์‚ฌ์šฉํ•˜์ž.
      • ๋งˆํ‹ด ํŒŒ์šธ๋Ÿฌ ๊ธ€ ๋ฒˆ์—ญ๋ณธ
    • Prompt Engineering
    • Auto-GPT
    • Gemini
      • google ai studio
      • gemini-api
      • embedding guide
    • Huggingface
      • huggingface ์‚ฌ์šฉ๋ฒ•
      • huggingface nlp ๊ณต๋ถ€์ค‘
    • kaggle
      • download dataset
    • langchain
      • langchain์„ ๊ณต๋ถ€ํ•˜๋ฉฐ ์ •๋ฆฌ
      • basic
      • slackbot
      • rag
      • document-loader
      • website-loader
      • confluence
      • memory
      • function-call
      • langsmith
      • agent-toolkit
  • Ansible
    • templates vs files and jinja2
    • dynamic inventory
    • limit ์˜ต์…˜ ๊ฐ•์ œํ•˜๊ธฐ
    • limit ์‚ฌ์šฉํ›„ gather_fact ๋ฌธ์ œ
  • AWS
    • AWS CLI
    • EKS
      • cluster manage
      • ALB Controller
      • external-dns
      • fargate
    • ECR
    • S3
    • Certificate Manager
  • Azure
    • Azure AD OAuth Client Flow
  • Container
    • Registry
    • ๋นŒ๋“œ์‹œ์— env๊ฐ’ ์„ค์ •ํ•˜๊ธฐ
  • DB
    • PXC
      • Operator
      • PMM
      • ์‚ญ์ œ
      • GTID
      • Cross Site Replication
    • Mssql
    • Mysql
  • dotnet
    • Thread Pool
    • Connection Pool
    • Thread Pool2
  • Devops
    • Recommendation
  • GIT
    • Basic
    • Submodule
  • GitHub
    • Repository
    • GitHub Action
    • GitHub PR
    • Self Hosted Runner
    • GitHub Webhook
  • GitLab
    • CI/CD
    • CI/CD Advance
    • Ssl renew
    • CI/CD Pass env to other job
  • Go Lang
    • ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ๊ตฌ์ถ•
    • multi os binary build
    • kubectl๊ฐ™์€ cli๋งŒ๋“ค๊ธฐ
    • azure ad cli
    • embed static file
    • go study
      • pointer
      • module and package
      • string
      • struct
      • goroutine
  • Kubernetes
    • Kubernetes๋Š” ๋ฌด์—‡์ธ๊ฐ€
    • Tools
    • Install with kubespray
    • Kubernetes hardening guidance
    • 11 ways not to get hacked
    • ArgoCD
      • Install
      • CLI
      • Repository
      • Apps
      • AWS ALB ์‚ฌ์šฉ
      • Notification slack
      • Backup / DR
      • Ingress
      • 2021-11-16 Github error
      • Server Config
      • auth0 ์ธ์ฆ ์ถ”๊ฐ€(oauth,OIDC)
    • Extension
      • Longhorn pvc
      • External dns
      • Ingress nginx
      • Cert Manager
      • Kube prometheus
    • Helm
      • Subchart
      • Tip
    • Loki
    • Persistent Volume
    • TIP
      • Job
      • Pod
      • Log
  • KAFKA
    • raft
  • KVM
    • kvm cpu model
  • Linux
    • DNS Bind9
      • Cert-Manager
      • Certbot
      • Dynamic Update
      • Log
    • Export and variable
    • Grep ์‚ฌ์šฉ๋ฒ•
  • Modeling
    • C4 model introduce
    • Mermaid
    • reference
  • Monitoring
    • Readme
    • 0. What is Monitoring
    • 1. install prometheus and grafana
    • 2. grafana provisioning
    • 3. grafana dashboard
    • 4. grafana portable dashboard
    • 5. prometheus ui
    • 6. prometheus oauth2
    • Prometheus
      • Metric type
      • basic
      • rate vs irate
      • k8s-prometheus
    • Grafana
      • Expolorer
    • Node Exporter
      • advance
      • textfile collector
  • Motivation
    • 3 Simple Rule
  • OPENNEBULA
    • Install(ansible)
    • Install
    • Tip
    • Windows vm
  • Reading
    • comfort zone
    • ๋ฐฐ๋ ค
    • elon musk 6 rule for insane productivity
    • Feynman Technique
    • how to interview - elon musk
    • ๊ฒฝ์ฒญ
    • Readme
  • Redis
    • Install
    • Master-slave Architecture
    • Sentinel
    • Redis Cluster
    • Client programming c#
  • SEO
    • Readme
  • Security
    • criminalip.io
      • criminalip.io
  • Stock
    • robinhood-python
  • Terraform
    • moved block
    • output
  • vault
    • Readme
  • VS Code
    • dev container
    • dev container on remote server
  • Old fashione trend
    • curity
    • MAAS
      • Install maas
      • Manage maas
      • Tip
Powered by GitBook
On this page
  • ๊ฒฐ๋ก 
  • ์ถ”๊ฐ€ ๋…ธ๋“œ ์‹คํŒจ
  • sentinel ์ฟผ๋Ÿผ
  • ๊ฒฐ๋ก 2
  • ์ถ”๊ฐ€์ž‘์—…
  • ๊ฒฐ๋ก 3
  • ๊ฒฐ๋ก 4

Was this helpful?

  1. Redis

Sentinel

PreviousMaster-slave ArchitectureNextRedis Cluster

Last updated 1 year ago

Was this helpful?

์•ž๊ธ€์—์„œ ์ˆ˜๋™์œผ๋กœ failover๋ฅผ ํ•œ๊ฒƒ์„ sentinel์„ ์ด์šฉํ•˜์—ฌ ์ž๋™์œผ๋กœ failover๋ฅผ ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

๊ธฐ์กด ํด๋Ÿฌ์Šคํ„ฐ์— sentinel์„ ์ถ”๊ฐ€ํ•˜์—ฌ ์‹คํ–‰ํ•ด๋ณด์ž.

cd redis/replica-multi-node-sentinel
docker-compose up

1 - main 3 - secondary 3 - sentinel

replication์ด ์ž˜ ๋˜๋Š”๊ฒƒ์„ ์•Œ์ˆ˜ ์žˆ๋‹ค.

์ด์ œ role์„ ํ™•์ธํ•ด๋ณด์ž.

role

์ด์ œ main์„ ์ฃฝ์—ฌ๋ณด์ž.

docker-compose stop redis-main

์ž๋™์œผ๋กœ redis-secondary-1์ด master๋กœ failover๊ฐ€ ๋œ๊ฒƒ์„ ์•Œ์ˆ˜ ์žˆ๋‹ค.

์ด์ œ ๋‹ค์‹œ main์„ ์‚ด๋ ค๋ณด์ž.

slave๋กœ ์—ญํ• ์ด ๋ฐ”๋€Œ์–ด ์žˆ๋Š”๊ฑธ ์•Œ์ˆ˜ ์žˆ๋‹ค.

๊ฒฐ๋ก 

auto failover๊ฐ€ ์ž˜ ๋™์ž‘ํ•œ๋‹ค.

์ถ”๊ฐ€ ๋…ธ๋“œ ์‹คํŒจ

์œ„์— ์„ค๋ช…ํ•œ๋Œ€๋กœ replication์ด 3์ด๋ฉด 1๊ฐœ์˜ ๋…ธ๋“œ๋Š” ์ฃฝ์–ด๋„ ๋ฌธ์ œ๊ฐ€ ์—†๋‹ค ๊ทธ๋Ÿฌ๋‚˜ 2๊ฐœ๊ฐ€ ์ฃฝ์œผ๋ฉด ๋ฌธ์ œ๊ฐ€ ๋œ๋‹ค.

5๊ฐœ๋ฉด 2๊ฐœ๊ฐ€ ์ฃฝ์–ด๋„ ๋ฌธ์ œ๊ฐ€ ์—†๋‹ค. ๊ทธ๋Ÿฌ๋ฏ€๋กœ ์ผ๋‹จ 1๊ฐœ๋ฅผ ๋” ์ถ”๊ฐ€ํ•ด๋ณด์ž.

redis-secondary-4:
  image: 'bitnami/redis:7.2'
  container_name: redis-secondary-4
  depends_on:
    - redis-main
  ports:
    - 6383:6379
  environment:
    - REDIS_REPLICATION_MODE=slave
    - REDIS_MASTER_HOST=redis-main
    - ALLOW_EMPTY_PASSWORD=yes

์˜ฌ๋ ค๋ณด์ž.

docker-compose up -d
get mykey
> myvalue

์—ฌ๊ธฐ์—์„œ 2๊ฐœ ๋…ธ๋“œ๋ฅผ ์ฃฝ์—ฌ๋ณด์ž.

docker-compose stop redis-secondary-1
docker-compose stop redis-secondary-2

2๊ฐœ์˜ ๋…ธ๋“œ๊ฐ€ ๋ง๊ฐ€์ก‹๋Š”๋ฐ๋„ ๋ฌธ์ œ์—†์ด ์‹คํ–‰๋œ๋‹ค.

ํ•˜๋‚˜๋ฅผ ๋” ๋ง๊ฐ€๋œจ๋ ค๋ณด์ž.

docker-compose stop redis-secondary-3

์—ฌ์ „ํžˆ ๋™์ž‘ํ•œ๋‹ค. ์Œ ๋ญ์ง€?

ํ•˜๋‚˜๋ฅผ ๋” ๋ง๊ฐ€๋œจ๋ ค๋ณด์ž.

docker-compose stop redis-secondary-4

๊ทธ๋ž˜๋„ ๋œ๋‹ค..

๋…ธ๋“œ๊ฐ€ ํ•œ๊ฐœ๋ผ๋„ ์žˆ๊ธฐ๋งŒ ํ•˜๋ฉด ๋œ๋‹ค. ์ด์ƒํ•˜๋„ค..

๋ชจ๋“  ๋…ธ๋“œ๋ฅผ ๋‹ค ์˜ฌ๋ฆฌ์ž.

docker-compose up -d

์ด์ œ ๋ชจ๋“  ๋…ธ๋“œ์—์„œ ๋‹ค ๋™์ž‘ํ•œ๋‹ค.

redis replica๋Š” 1๊ฐœ๋งŒ ์žˆ์–ด๋„ ๋™์ž‘์„ ํ•œ๋‹ค.

sentinel ์ฟผ๋Ÿผ

sentinel์„ ์ฃฝ์—ฌ๋ณด์ž. ๊ทธ๋Ÿฌ๋ฉด ์–ด๋–ป๊ฒŒ ๋ ๊นŒ?

docker-compose stop redis-sentinel-1

์ด์ œ main์„ ์ฃฝ์—ฌ๋ณด์ž.

docker-compose stop redis-secondary-4

master๊ฐ€ ๋‹ค๋ฅธ๊ณณ์œผ๋กœ ์ด์ „์ด ์ž˜๋จ.

๋‹ค์‹œ sentinel์„ ํ•˜๋‚˜๋” ์ฃฝ์—ฌ๋ณด์ž. ์ด๋ก ์ ์œผ๋กœ๋ผ๋ฉด 3๊ฐœ์˜ sentinel์ด๋ฏ€๋กœ 1๊ฐœ์˜ ์—๋Ÿฌ๋งŒ ํ—ˆ์šฉํ•จ. 2๊ฐœ๊ฐ€ ๋˜๋ฉด main์ด ๋‹ค๋ฅธ๊ณณ์œผ๋กœ ์•ˆ๋„˜์–ด๊ฐ€์•ผํ•จ.

docker-compose stop redis-sentinel-1
docker-compose stop redis-main

ํ•˜๋‚˜ ๋” ์ฃฝ์—ฟ๊ณ  main์ด ๋‹ค๋ฅธ๊ณณ์œผ๋กœ ๋„˜์–ด๊ฐ€๋Š”์ง€ ํ™•์ธํ•ด๋ณด์ž.

sentinel์ด ์ตœ์†Œ 2๊ฐœ๋Š” ์ž‡์–ด์•ผ failover๋ฅผ ์‹œํ‚ฌ์ˆ˜ ์žˆ๋‹ค.

๊ฒฐ๋ก 2

sentinel์€ ๊ฐ€๊ธ‰์ ์ด๋ฉด 5๊ฐœ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ 2๊ฐœ์˜ ์—๋Ÿฌ๋ฅผ ํ—ˆ์šฉํ•˜๋„๋ก ํ•˜์ž.

์ถ”๊ฐ€์ž‘์—…

์ด์ œ ๋ชจ๋“  ๋…ธ๋“œ๋ฅผ ๋‹ค ์˜ฌ๋ฆฌ๋ฉด ์–ด๋ฏ๊ฒŒ ๋ ๊ฐ€ ํด๋Ÿฌ์Šคํ„ฐ๋Š” ๋ณต๊ตฌ๊ฐ€ ๋ ๊ฒƒ์ธ๊ฐ€?

docker-compose up -d

๋งˆ์ง€๋ง‰์œผ๋กœ ๋ฌธ์ œ๋ฅผ ๋งŒ๋“ค์—‡๋˜ redis-main์€ ๋ณต๊ตฌ๊ฐ€ ๋˜์—ˆ๋‹ค ๊ทธ๋Ÿฌ๋‚˜ secondary-4๋Š” ๋ณต๊ตฌ๊ฐ€ ์•ˆ๋จ.

์™„์ „ ์ง€์šฐ๊ณ  ๋‹ค์‹œ ์‹œ์ž‘ํ•ด๋ณด์ž.

docker-compose stop redis-secondary-4
docker-compose rm redis-secondary-4
docker-compose up -d

main์— ์ž˜ ์—ฐ๊ฒฐ๋œ๊ฑธ ์•Œ์ˆ˜์žˆ๋‹ค.

๊ฒฐ๋ก 3

sentinel์„ ๋‹ค ์˜ฌ๋ฆฌ๊ณ  ๋‹ค์‹œ ์˜ฌ๋ฆฌ๋ฉด ๋งˆ์ง€๋ง‰ master๊ฐ€ ๋ณต๊ตฌ๊ฐ€ ๋˜๋ฉด์„œ ๋ชจ๋“ ๊ฒƒ์ด ์ •์ƒ์œผ๋กœ๋Œ์•„์˜จ๋‹ค.

๊ธฐ์กด์— ๋งˆ์Šคํ„ฐ์—ญํ• ์„ ํ–ˆ๋˜ ๋…ธ๋“œ๋Š” ์—๋Ÿฌ ๋…ธ๋“œ๋กœ ๋‚จ๋Š”๋‹ค.

์ด๊ฑธ ์™„์ „ํžˆ ์ง€์šฐ๊ณ  ์ƒˆ๋กœ์šด ๋…ธ๋“œ๋กœ ์˜ฌ๋ ค์ฃผ๋ฉด ๋‹ค์‹œ ํด๋Ÿฌ์Šคํ„ฐ์— ์ ‘์†์ด ๋œ๋‹ค.

๊ฒฐ๋ก 4

์ƒˆ๋กœ์šด ๋งˆ์Šคํ„ฐ ๋…ธ๋“œ ์„ ์ถœ๊นŒ์ง€ ์•ฝ 2์ดˆ ์ด๋‚ด์— ์ฒ˜๋ฆฌ๋˜์—ˆ์œผ๋ฉฐ, ๊ทธ ๋™์•ˆ client์—์„œ๋Š” ๋งˆ์Šคํ„ฐ๋…ธ๋“œ ์ ‘๊ทผ์— ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•จ.

๊ทธ๋ ‡๋‹ค ์•ˆ๋„˜์–ด๊ฐ„๋‹ค.

alt text
alt text
alt text
alt text
alt text
alt text
alt text
alt text
alt text
alt text
alt text