Upload
dae-myung-kang
View
788
Download
6
Embed Size (px)
Citation preview
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.