---
# System prepended metadata

title: redis 이중화 테스트 관련 config 및 명령어

---

# redis 이중화 테스트 관련 config 및 명령어


### 7000.conf
```
include /redis/redis-5.0.8/redis.conf

bind 0.0.0.0
daemonize yes
protected-mode no

port 7000
pidfile /var/run/redis_7000.pid
logfile /redis_log/redis-7000.log
dir /redis
dbfilename dump_7000.rdb

cluster-config-file node-7000.conf
cluster-enabled yes
cluster-node-timeout 5000

rename-command keys ""

appendonly no
```

### 7001.conf
```
include /redis/redis-5.0.8/redis.conf

bind 0.0.0.0
daemonize yes
protected-mode no

port 7001
pidfile /var/run/redis_7001.pid
logfile /redis_log/redis-7001.log
dir /redis
dbfilename dump_7001.rdb

cluster-config-file node-7001.conf
cluster-enabled yes
cluster-node-timeout 5000

rename-command keys ""

appendonly no
```

- 데이터 전부 삭제
    - 보이스봇 서비스
    ```
    redis-cli --cluster call 10.220.194.140:7000 flushall
    redis-cli --cluster call 10.220.194.140:7000  cluster reset
    redis-cli --cluster call 10.220.194.140:7001 flushall
    redis-cli --cluster call 10.220.194.140:7001  cluster reset
    redis-cli --cluster call 10.220.194.144:7000 flushall
    redis-cli --cluster call 10.220.194.144:7000  cluster reset
    redis-cli --cluster call 10.220.194.144:7001 flushall
    redis-cli --cluster call 10.220.194.144:7001  cluster reset
    redis-cli --cluster call 10.220.194.145:7000 flushall
    redis-cli --cluster call 10.220.194.145:7000  cluster reset
    redis-cli --cluster call 10.220.194.145:7001 flushall
    redis-cli --cluster call 10.220.194.145:7001  cluster reset
    ```

    - 보이스봇 검증
    ```
    redis-cli --cluster call 10.220.187.155:7000 flushall
    redis-cli --cluster call 10.220.187.155:7000  cluster reset
    redis-cli --cluster call 10.220.187.155:7001 flushall
    redis-cli --cluster call 10.220.187.155:7001  cluster reset
    redis-cli --cluster call 10.220.187.159:7000 flushall
    redis-cli --cluster call 10.220.187.159:7000  cluster reset
    redis-cli --cluster call 10.220.187.159:7001 flushall
    redis-cli --cluster call 10.220.187.159:7001  cluster reset
    redis-cli --cluster call 10.220.187.177:7000 flushall
    redis-cli --cluster call 10.220.187.177:7000  cluster reset
    redis-cli --cluster call 10.220.187.177:7001 flushall
    redis-cli --cluster call 10.220.187.177:7001  cluster reset
    ```

- slave를 마스터 변경
```
redis-cli -p 7000 cluster failover
```

- 상태 확인
```
redis-cli -p 7000 cluster nodes
```

- 참고자료
    - http://redisgate.kr/redis/cluster/cluster_failover.php
