서버구축이야기!!

닫기 검색결과 전체 보기

    Redis - Cluster Node Slot 분배하기

    Linux Server/Redis 2023. 2. 8. 09:00

    Redis - Cluster Node Slot 분배하기

     

     

    이번 포스팅에서는 Redis Cluster reshard 명령을 통한 Master Node 추가 방법을 알아보도록 하겠습니다.

     

     

     

     

       Redis 이전글

     

     

     

     

    https://server-talk.tistory.com/471 - Redis - In-Memory - 알아보기​

     

     

    https://server-talk.tistory.com/472 - Redis - 서버 설치 및 기본설정 알아보기

     

     

    https://server-talk.tistory.com/473 - Redis - Redis-cli 기본 사용법

     

     

    https://server-talk.tistory.com/474 - Redis - Redis Desktop Manager Tool

     

     

    https://server-talk.tistory.com/475 - phpredis 설치 알아보기

     

     

    https://server-talk.tistory.com/502 - Cluster 알아보기

     

     

    https://server-talk.tistory.com/503 - Redis - Cluster Master Node 구성하기

     

     

    https://server-talk.tistory.com/504 - Redis - Cluster Master Node 관련 설정 알아보기

     

     

    https://server-talk.tistory.com/505 - Redis - Master Node - Cluster 상태정보 확인

     

     

    https://server-talk.tistory.com/506 - Redis - Slave Note Cluster 구성하기

     

     

    https://server-talk.tistory.com/507 - Redis - Master Note와 Slave Cluster 연동 상태 알아보기

     

     

    https://server-talk.tistory.com/508 - Redis - Cluster - hash slot 알아보기

     

     

     

     

       Redis - Cluster Reshard 란?

     

     

     

     

    Redis 에서 Cluster 를 이용하다가 서비스가 더 커진다면 Master Node를 더 추가해야됩니다 이때 reshard 명령을 사용하여 Node 를 추가할 수 있는데 reshard 명령은 다음과 같이 장/단점이 있으므로 참고하셔야 됩니다.

     

     

     

     

     

     

    Redis Cluster의 Reshard 명령은 추가한 Cluster Node의 Slot 을 할당하거나 다른 Master Node로 Slot을 이동할 수 있습니다 그리고 특정 Node의 ID를 지정하여 운영 중인 Node에서 Slot을 분배할 수 있습니다.

     

    그러나 Redis Cluster의 reshard 명령은 추가한 Cluster Node 의 Slot의 범위를 지정할 수 없고 Master Node에서만 지정할 수 있는점이 있습니다.

     

     

     

     

       Redis - Cluster Node Slot 분배 - RESHARD

     

     

     

     

    1. Redis - Cluster Node Slot 할당정보 확인

     

    CLUSTER SLOTS

     

    Cluster의 Master Node와 Slave Node 할당되어 있는 Node IP, Node Port, Node ID, Node Slot 정보를 확인합니다.

     

     

     

     

    2. Redis - Cluster Master Node 설정파일 생성

     

    cp /etc/redis/redis.conf 7300-cluster.conf

     

     

     

     

    3. Redis - Cluster 추가 Master Node 설정파일 수정

     

    vi 7300-cluster.conf
    
    port 7300
    daemonize yes
    cluster-enabled yes 
    cluster-config-file nodes-7300.conf 
    cluster-node-timeout 3000 
    appendonly yes 
    appendfilename appendonly_7300.aof 
    pidfile /var/run/redis_7300.pid
    logfile logs/redis_7300.log

     

     

     

     

    4. Redis - Cluster 추가 Master Node 실행

     

    명령어 redis-server [New Cluster Master Node]

     

    redis-server 7300-cluster.conf

     

     

     

     

    5. Redis - Cluster Master Node 추가하기

     

    명령어 : redis-cli --cluster add-node [생성한 Master Node] [기존 Master Node]

     

    redis-cli --cluster add-node 127.0.0.1:7300 127.0.0.1:7000

     

     

     

     

    6. Redis - 추가된 Cluster Master Node 확인하기

     

    명령어 : redis-cli --cluster check [기존 Master Node]

     

    redis-cli --cluster check 127.0.0.1:7000
    127.0.0.1:7000 (52f11541...) -> 3 keys | 5461 slots | 1 slaves.
    127.0.0.1:7200 (41018c69...) -> 1 keys | 5461 slots | 1 slaves.
    127.0.0.1:7100 (d1e5ba49...) -> 1 keys | 5462 slots | 1 slaves.
    127.0.0.1:7300 (a77e022d...) -> 0 keys | 0 slots | 0 slaves.

     

    추가된 마스터 노드 정보를 확인합니다(하지만 슬롯이 지정되지 않아 0으로 표시됩니다)

     

     

     

     

    7. Redis - Cluster Master Node - 슬롯의 나누기

     

    명령어 : redis-cli --cluster reshard [기존 Master Node] --cluster-yes

     

    redis-cli --cluster reshard 127.0.0.1:7000 --cluster-yes

     

    Slot을 나눌 Master Node를 지정하는 부분 입니다

     

     

     

     

    8. Redis - Cluster Master Node - 슬롯 할당 개수

     

    How many slots do you want to move (from 1 to 16384)? 2000

     

    지정한 Master Node의 Slot 의 개수를 몇개를 할당할지의 개수를 지정하는 부분 입니다.

     

     

     

     

    9. Redis - Cluster Master Node - 슬롯을 이동하게될 Master ID 입력

     

    What is the receiving node ID? [생성한 Master Node ID]

     

    What is the receiving node ID? a77e022d669e3bc8f0fc1b0099fb606b67b55f44

     



     

    10. Redis - Cluster Master Node - 슬롯을 삭제하게될 Master ID 입력

     

    Source node  #1: [기존 Master Node(슬롯을 나눌 Node)]
    Source node  #2: done

     

    Source node  #1: 52f11541320cab2ef73954a2de65da19f10c6099
    Source node  #2: done

     

    all을 지정할경우 전체에서 재분배하게 됩니다.

     

     

     

     

    11. Redis - Cluster Master Node - 분배된 슬롯확인

     

    # redis-cli --cluster check 127.0.0.1:7000 -a foobared
    Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
    127.0.0.1:7000 (52f11541...) -> 3 keys | 3461 slots | 1 slaves.
    127.0.0.1:7200 (41018c69...) -> 1 keys | 5461 slots | 1 slaves.
    127.0.0.1:7100 (d1e5ba49...) -> 1 keys | 5462 slots | 1 slaves.
    127.0.0.1:7300 (a77e022d...) -> 0 keys | 2000 slots | 0 slaves.

     

    저작자표시 (새창열림)
    'Linux Server/Redis' 관련 글 more
    • thumbnail
      Redis - Cluster Master Node 삭제하기 2023.02.22
    • thumbnail
      Redis - Cluster Node Slot 재분배하기 - REBALANCE 2023.02.15
    • thumbnail
      Redis - Cluster - hash slot 알아보기 2023.02.01
    • thumbnail
      Redis - Master Note와 Slave Cluster 연동 상태 알아보기 2023.01.25
    Posted by 서버이야기
블로그 이미지

서버구축의 대한 이야기 입니다.

by 서버이야기

공지사항

    최근...

  • 포스트
  • 댓글
  • 더 보기

태그

글 보관함

«   2025/07   »
일 월 화 수 목 금 토
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

링크

카테고리

서버이야기 (491)
Windows Server (77)
IIS 8 (23)
IIIS 7 (9)
Database (14)
보안 (10)
네임서버 (6)
로그 (2)
에러 (1)
기타 응용프로그램 (9)
Linux Server (266)
CentOS (17)
Ubuntu (20)
Linux 명령어 (65)
Apache (2)
PHP (13)
MYSQL (30)
LAPM (4)
SNMP (1)
RAID (4)
보안 (3)
에러 (2)
모니터링 (15)
DNS(네임서버) (1)
MariaDB (5)
Nginx (14)
방화벽 (13)
Zabbix (10)
Redis (40)
부하분산 (4)
서비스 (1)
로드밸런싱 (2)
Alteon (1)
웹언어 (41)
HTML (10)
PHP (22)
CSS (9)
유용한 정보 (39)
보안 (2)
서버 접속장애 (1)
개발툴-유틸리티 (30)
용어 (25)
네트워크 (9)
디스크 (5)
보안 (1)
데이터베이스 (2)
Programing (25)
Python (25)
NAS (4)
Synology (4)

카운터

Total
Today
Yesterday
방명록 : 관리자 : 글쓰기
서버이야기's Blog is powered by daumkakao
Skin info material T Mark5.2 by 뭐하라
favicon

서버구축이야기!!

서버구축의 대한 이야기 입니다.

  • 태그
  • 링크 추가
  • 방명록

관리자 메뉴

  • 관리자 모드
  • 글쓰기
  • 서버이야기 (491)
    • Windows Server (77)
      • IIS 8 (23)
      • IIIS 7 (9)
      • Database (14)
      • 보안 (10)
      • 네임서버 (6)
      • 로그 (2)
      • 에러 (1)
      • 기타 응용프로그램 (9)
    • Linux Server (266)
      • CentOS (17)
      • Ubuntu (20)
      • Linux 명령어 (65)
      • Apache (2)
      • PHP (13)
      • MYSQL (30)
      • LAPM (4)
      • SNMP (1)
      • RAID (4)
      • 보안 (3)
      • 에러 (2)
      • 모니터링 (15)
      • DNS(네임서버) (1)
      • MariaDB (5)
      • Nginx (14)
      • 방화벽 (13)
      • Zabbix (10)
      • Redis (40)
    • 부하분산 (4)
      • 서비스 (1)
      • 로드밸런싱 (2)
      • Alteon (1)
    • 웹언어 (41)
      • HTML (10)
      • PHP (22)
      • CSS (9)
    • 유용한 정보 (39)
      • 보안 (2)
      • 서버 접속장애 (1)
      • 개발툴-유틸리티 (30)
    • 용어 (25)
      • 네트워크 (9)
      • 디스크 (5)
      • 보안 (1)
      • 데이터베이스 (2)
    • Programing (25)
      • Python (25)
    • NAS (4)
      • Synology (4)

카테고리

PC화면 보기 티스토리 Daum

티스토리툴바