SlideShare a Scribd company logo
1 of 26
Download to read offline
REDIS
charsyam@naver.com
Replication&HA
Replication
Master/Slave
Redis 는 M/S 리플리케이션 지원
Redis 는 M/M 은 지원하지 않음
Chained Replication
Master 1st Slave 2nd Slave
1st slave is master of
2nd slave
Replication
Master Slave
replicationCron
Health check
Replication
Master Slave
replicationCron
Health check
Replication
Master Slave
replicationCron
When master reruns,
Resync with Master
Replication
Master Slave
replicationCron
If master has no data.
Slave will has no data after
resyncing
slaveof no one
slaveof ip port 는 ip:port 서버의
slave로 자신을 설정하는 명령
- Master의 상태를 정기적으로 체크함
slaveof no one은 해당 설정을 해제함
Migration
Migration
새로운 Redis 서버를 Master로 설정할
경우.
- 기존 Master : A
- 새로운 Master : B
Migration 절차
1. B를 A의 Slave로 설정
- slaveof a_ip a_port
2. B의 slave_read_only 설정 제거
- config set slave_read_only no
3. Client에서 B를 바라보도록 수정.
4. B를 A의 Slave에서 제거
- slaveof no one
Monitoring
Redis Monitoring
1. CPU Usage
2. CPU Load
3. Network Tx/Rx
4. Commands count
5. Clients connections
6. memory
7. rss
Tools
1. Cacti Plugin
2. Redis Stat
- https://github.com/junegunn/redis-stat
3. Inhouse로 제작을 많이함…
HA
HA
Cache or Store?
중요한 Cache 인가?
다시 만드는데 비용이 비싼가?
HA 솔루션
1. Redis Sentinel
- 대규모에서 검증되지 않았음.
2. Zookeeper를 이용한 Inhouse 솔루션.
- Agent를 이용해 응답이 없으면 클라이언트에
서 ZooKeeper 이벤트를 받아서 Change
Redis Sentinel
Redis Sentinel
Redis에서 정식 지원
- 대규모에서 검증되지 않았음.
- 가끔 이상 동작함.
- Redis Sentinel은 재시작시 전부 내리고 다시
시작하는게 유리.
Redis 코드를 이용함.
Sentinel Conf
port 26379
sentinel monitor mymaster 127.0.0.1 6379 1
sentinel down-after-milliseconds mymaster 30000
sentinel can-failover mymaster yes
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 900000
Pub/Sub을 이용
redis 127.0.0.1:2003> psubscribe *
Reading messages... (press Ctrl-C to quit)
1) "pmessage"
2) "*"
3) "+switch-master"
4) "resque 127.0.0.1 1999 127.0.0.1
2002"
In House Solution
Inhouse solution
대부분 비슷한 구조…
Inhouse solution
Application Servers
ZooKeeper
Redis Cluster
Manager
Redis
Shard-1
Redis
Shard-2
Redis
Shard-3
Health Checking
Event
Thank you.

More Related Content

What's hot

다중성 확보, 시스템 안정화
다중성 확보, 시스템 안정화다중성 확보, 시스템 안정화
다중성 확보, 시스템 안정화Choonghyun Yang
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestI Goo Lee
 
Techplanetreview redis
Techplanetreview redisTechplanetreview redis
Techplanetreview redisDaeMyung Kang
 
Redis From 2.8 to 4.x(unstable)
Redis From 2.8 to 4.x(unstable)Redis From 2.8 to 4.x(unstable)
Redis From 2.8 to 4.x(unstable)DaeMyung Kang
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기NHN FORWARD
 
Tungsten 을활용한 MySQL / Hadoop 동기화
Tungsten 을활용한 MySQL / Hadoop 동기화Tungsten 을활용한 MySQL / Hadoop 동기화
Tungsten 을활용한 MySQL / Hadoop 동기화I Goo Lee
 
[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱
[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱
[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱PgDay.Seoul
 
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...OpenStack Korea Community
 
[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0Ji-Woong Choi
 
[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1
[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1
[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1Ji-Woong Choi
 
서버/인프라를 지탱하는 기술
서버/인프라를 지탱하는 기술서버/인프라를 지탱하는 기술
서버/인프라를 지탱하는 기술재훈 정
 
서버인프라를지탱하는기술2_1-2
서버인프라를지탱하는기술2_1-2서버인프라를지탱하는기술2_1-2
서버인프라를지탱하는기술2_1-2HyeonSeok Choi
 
[오픈소스컨설팅] RPM 만들기
[오픈소스컨설팅] RPM 만들기[오픈소스컨설팅] RPM 만들기
[오픈소스컨설팅] RPM 만들기Ji-Woong Choi
 
MySQL Deep dive with FusionIO
MySQL Deep dive with FusionIOMySQL Deep dive with FusionIO
MySQL Deep dive with FusionIOI Goo Lee
 
Pgday bdr 천정대
Pgday bdr 천정대Pgday bdr 천정대
Pgday bdr 천정대PgDay.Seoul
 
[234]멀티테넌트 하둡 클러스터 운영 경험기
[234]멀티테넌트 하둡 클러스터 운영 경험기[234]멀티테넌트 하둡 클러스터 운영 경험기
[234]멀티테넌트 하둡 클러스터 운영 경험기NAVER D2
 
AWS 환경에서 MySQL BMT
AWS 환경에서 MySQL BMTAWS 환경에서 MySQL BMT
AWS 환경에서 MySQL BMTI Goo Lee
 
[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3
[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3
[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3Ji-Woong Choi
 

What's hot (20)

Cache governance
Cache governanceCache governance
Cache governance
 
Redis on AWS
Redis on AWSRedis on AWS
Redis on AWS
 
다중성 확보, 시스템 안정화
다중성 확보, 시스템 안정화다중성 확보, 시스템 안정화
다중성 확보, 시스템 안정화
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
 
Techplanetreview redis
Techplanetreview redisTechplanetreview redis
Techplanetreview redis
 
Redis From 2.8 to 4.x(unstable)
Redis From 2.8 to 4.x(unstable)Redis From 2.8 to 4.x(unstable)
Redis From 2.8 to 4.x(unstable)
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기
 
Tungsten 을활용한 MySQL / Hadoop 동기화
Tungsten 을활용한 MySQL / Hadoop 동기화Tungsten 을활용한 MySQL / Hadoop 동기화
Tungsten 을활용한 MySQL / Hadoop 동기화
 
[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱
[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱
[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱
 
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
 
[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
 
[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1
[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1
[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1
 
서버/인프라를 지탱하는 기술
서버/인프라를 지탱하는 기술서버/인프라를 지탱하는 기술
서버/인프라를 지탱하는 기술
 
서버인프라를지탱하는기술2_1-2
서버인프라를지탱하는기술2_1-2서버인프라를지탱하는기술2_1-2
서버인프라를지탱하는기술2_1-2
 
[오픈소스컨설팅] RPM 만들기
[오픈소스컨설팅] RPM 만들기[오픈소스컨설팅] RPM 만들기
[오픈소스컨설팅] RPM 만들기
 
MySQL Deep dive with FusionIO
MySQL Deep dive with FusionIOMySQL Deep dive with FusionIO
MySQL Deep dive with FusionIO
 
Pgday bdr 천정대
Pgday bdr 천정대Pgday bdr 천정대
Pgday bdr 천정대
 
[234]멀티테넌트 하둡 클러스터 운영 경험기
[234]멀티테넌트 하둡 클러스터 운영 경험기[234]멀티테넌트 하둡 클러스터 운영 경험기
[234]멀티테넌트 하둡 클러스터 운영 경험기
 
AWS 환경에서 MySQL BMT
AWS 환경에서 MySQL BMTAWS 환경에서 MySQL BMT
AWS 환경에서 MySQL BMT
 
[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3
[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3
[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3
 

More from DaeMyung Kang

How to use redis well
How to use redis wellHow to use redis well
How to use redis wellDaeMyung Kang
 
The easiest consistent hashing
The easiest consistent hashingThe easiest consistent hashing
The easiest consistent hashingDaeMyung Kang
 
How to name a cache key
How to name a cache keyHow to name a cache key
How to name a cache keyDaeMyung Kang
 
Integration between Filebeat and logstash
Integration between Filebeat and logstash Integration between Filebeat and logstash
Integration between Filebeat and logstash DaeMyung Kang
 
How to build massive service for advance
How to build massive service for advanceHow to build massive service for advance
How to build massive service for advanceDaeMyung Kang
 
Massive service basic
Massive service basicMassive service basic
Massive service basicDaeMyung Kang
 
Data Engineering 101
Data Engineering 101Data Engineering 101
Data Engineering 101DaeMyung Kang
 
How To Become Better Engineer
How To Become Better EngineerHow To Become Better Engineer
How To Become Better EngineerDaeMyung Kang
 
Kafka timestamp offset_final
Kafka timestamp offset_finalKafka timestamp offset_final
Kafka timestamp offset_finalDaeMyung Kang
 
Kafka timestamp offset
Kafka timestamp offsetKafka timestamp offset
Kafka timestamp offsetDaeMyung Kang
 
Data pipeline and data lake
Data pipeline and data lakeData pipeline and data lake
Data pipeline and data lakeDaeMyung Kang
 
webservice scaling for newbie
webservice scaling for newbiewebservice scaling for newbie
webservice scaling for newbieDaeMyung Kang
 

More from DaeMyung Kang (20)

Count min sketch
Count min sketchCount min sketch
Count min sketch
 
Redis
RedisRedis
Redis
 
Ansible
AnsibleAnsible
Ansible
 
Why GUID is needed
Why GUID is neededWhy GUID is needed
Why GUID is needed
 
How to use redis well
How to use redis wellHow to use redis well
How to use redis well
 
The easiest consistent hashing
The easiest consistent hashingThe easiest consistent hashing
The easiest consistent hashing
 
How to name a cache key
How to name a cache keyHow to name a cache key
How to name a cache key
 
Integration between Filebeat and logstash
Integration between Filebeat and logstash Integration between Filebeat and logstash
Integration between Filebeat and logstash
 
How to build massive service for advance
How to build massive service for advanceHow to build massive service for advance
How to build massive service for advance
 
Massive service basic
Massive service basicMassive service basic
Massive service basic
 
Data Engineering 101
Data Engineering 101Data Engineering 101
Data Engineering 101
 
How To Become Better Engineer
How To Become Better EngineerHow To Become Better Engineer
How To Become Better Engineer
 
Kafka timestamp offset_final
Kafka timestamp offset_finalKafka timestamp offset_final
Kafka timestamp offset_final
 
Kafka timestamp offset
Kafka timestamp offsetKafka timestamp offset
Kafka timestamp offset
 
Data pipeline and data lake
Data pipeline and data lakeData pipeline and data lake
Data pipeline and data lake
 
Redis acl
Redis aclRedis acl
Redis acl
 
Coffee store
Coffee storeCoffee store
Coffee store
 
Scalable webservice
Scalable webserviceScalable webservice
Scalable webservice
 
Number system
Number systemNumber system
Number system
 
webservice scaling for newbie
webservice scaling for newbiewebservice scaling for newbie
webservice scaling for newbie
 

Redis edu 4