티스토리 뷰

Developer

[ redis ] master , slave 설정

rocksea 2012. 9. 14. 14:06

저번에 redis 설치 및 사용법에 이어 이번에는 redis master, slave환경설정에 대하여 알아보도록 하겠습니다.

각각 192.168.0.200,   192.168.0.201 이 두개의 서버에 설정을 한다고 가정하고 시작하도록 하겠습니다.

redis 설치 참조

http://rocksea.tistory.com/entry/redis-redis-설치-및-벤치마크-테스트

 

master 설정 ( 192.168.0.200 )

redis.conf

slave-serve-stale-data yes
requirepass 1234

 

slave 설정 ( 192.168.0.201 )

redis.conf

slaveof 192.168.0.200 6379

masterauth 1234

repl-ping-slave-period 10

repl-timeout 60

 

redis server 실행

192.168.0.200

./src/redis-server redis.conf &

 

192.168.0.201

./src/redis-server redis.conf &

 

master log

[7571] 14 Sep 14:25:28 - Accepted 192.168.0.201:57054
[7571] 14 Sep 14:25:28 * Slave ask for synchronization
[7571] 14 Sep 14:25:28 * Starting BGSAVE for SYNC
[7571] 14 Sep 14:25:28 * Background saving started by pid 7574
[7574] 14 Sep 14:25:28 * DB saved on disk
[7571] 14 Sep 14:25:28 * Background saving terminated with success
[7571] 14 Sep 14:25:28 * Synchronization with slave succeeded
[7571] 14 Sep 14:25:30 - 0 clients connected (1 slaves), 726168 bytes in use

slaver log

[5261] 14 Sep 14:28:51 * The server is now ready to accept connections on port 6379
[5261] 14 Sep 14:28:51 - 0 clients connected (0 slaves), 717592 bytes in use
[5261] 14 Sep 14:28:51 * Connecting to MASTER...
[5261] 14 Sep 14:28:51 * MASTER <-> SLAVE sync started
[5261] 14 Sep 14:28:51 * Non blocking connect for SYNC fired the event.
[5261] 14 Sep 14:28:51 * MASTER <-> SLAVE sync: receiving 10 bytes from master
[5261] 14 Sep 14:28:51 * MASTER <-> SLAVE sync: Loading DB in memory
[5261] 14 Sep 14:28:51 * MASTER <-> SLAVE sync: Finished with success

 

이상으로 posting을 마치도록 하겠습니다.

.by rocksea

 

'Developer' 카테고리의 다른 글

[ Perl ] FTP Upload  (0) 2012.09.28
Heuristic  (0) 2012.09.25
[ memcached ] installation guide  (0) 2012.09.10
[redis] redis 설치 및 벤치마크 테스트  (0) 2012.09.06
[ nodejs ] installation guide  (0) 2012.09.05
댓글