1. 설치 위치 : http://www.redis.io/download

2. 설치 하기 


$ wget http://download.redis.io/releases/redis-2.8.15.tar.gz
$ tar xzf redis-2.8.15.tar.gz
$ cd redis-2.8.15
$ make
$ make install


2. 인스톨 하기 
$ cd utils
$ ./install_server.sh

3. 실행/종료 

$ /etc/init.d/redis_6379 start
$ /etc/init.d/redis_6379 stop


4. 테스트 

$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"


5. 비밀번호 설정  

$ vi etc/redis/6379.conf 

requirepass 비밀번호

파일 저장 

$ /etc/init.d/redis_6379 stop
$ /etc/init.d/redis_6379 start


6. 접속 테스트 
src/redis-cli
auth 비밀번호 
ok
사용 하면 끝



7. 포트 열기 기본 레디스 + 센티널 포트 열기


# iptables -I INPUT 1 -p tcp --dport 6379 -j ACCEPT 
# iptables -I OUTPUT 1 -p tcp --dport 6979 -j ACCEPT  
# iptables -I INPUT 1 -p tcp --dport 26379 -j ACCEPT 
iptables -I OUTPUT 1 -p tcp --dport 26379 -j ACCEPT 


# service iptables save
# service iptables restart





8. Master/ slave 설정
Master 의 경우
      SECURITY 섹션에서 requirepass 를 설정하기만 하면 된다.
   # requirepass foobared
      이 부분을 주석 제거하고, 원하는 비밀번호로 설정.. 센티널 설정할려면 이부분 설정한다.

Slave 의 경우    
   # slaveof <masterip> <masterport>
      주석 제거하고, 마스터의 아이피와 포트를 적는다. 기본 포트를 사용한다면 6379

    REPLICATION 섹션에서 설정을 변경한다.
   # masterauth <master-password>
      주석 제거하고, requirepass에서 설정한 비밀번호를 적는다.
   # repl-ping-slave-period 10
      주석 제거하고, 기본값 10으로 사용
   # repl-timeout 60
      주석 제거하고, 기본값 60으로 사용
      repl-ping-slave-period 값보다 큰 값을 사용하라는 코멘트가 있다.

  


9. 기타 사항 
1. 마스터 서버 종료하기 
./redis-cli - a 비밀번호
> SHUTDOWN





참고 싸이트 

1. http://trend21c.tistory.com/1645 에러 관련 정리  잘되어있슴
2. http://lovedev.tistory.com/?page=3 설치 관련 정보

문제 해결 

$yum -y install gcc

$ make distclean
$ make
$ make test

$ yum -y install tcl
$ make test



10. sentinel 설정
11. 준비 과정 
          --> master/slave 설정을 완료하고 레디스를 실행한다.
          --> sentinel.conf 설정을 해당 서버 환경에 맞게 설정한다.
          --> 실행시에는 redis-sentinel /usr/local/reids/conf/sentinel.conf(프로퍼티 파일으 내가만든파일 위치)     

12. 센티널 설정 
sentinel.conf 설정 (설정파일은 redis 설치한 디렉토리에 보면 샘플 파일이 있다 이것을 복사해서 써도대고 새로 만들어도 된다)
## 마스터/ 슬레이브 설정
sentinel monitor mymaster 175.207.8.168 6379 2
sentinel down-after-milliseconds mymaster 30000
sentinel auth-pass mymaster 1020
sentinel failover-timeout mymaster 80000
sentinel parallel-syncs mymaster 1
 

 --> 마스터만 설정을 전부 다하고 
 --> 슬레이브는 마스터만 등록하면된다.

13. 설정참고 URL

14. 개발 운영 참고
15. 개잘 참고 사이트 
http://yakolla.tistory.com/47 -- 자바 관련 설명되어있다.

16. shiding