OpenSource

Redis 설치

아르비스 2017. 2. 16. 18:52

Redis 설치

https://redis.io/

 

1.     설치 버전 : 3.2.8

2.     설치 경로 : /ccpkg/platform/redis

3.     Download : http://download.redis.io/releases/redis-3.2.8.tar.gz

4.     설치 Process

A.     tar –zxvf redis-3.2.8.tar.gz

B.      cd redis-3.2.8

C.       make

D.      make install PREFIX=/ccpkg/platform/redis

E.      mkdir /ccpkg/platform/redis/conf

F.      mkdir /ccdata/logs/platform/redis

G.     mkdir /ccdata/redis/data

H.     cp *.conf /ccpkg/platform/redis/conf/

I.       cd /ccpkg/platform/redis/conf

J.       vi redis.conf

…..

Daemonize yes     # no -> yes로 변경

Logfile “/ccdata/logs/platform/redis/redis.log”

databases 2   # DB 개수 16->2 로 변경

….

dir /ccdata/redis/data/

 

 

-       slave 인경우

slaveof <masterip> <masterport>

 

A.     vi sentinel.sh

dir /ccdata/redis/

sentinel monitor mymaster <materip> <port> 2

daemonize yes

logfile "/ccdata/logs/platform/redis/ sentinel_6379.log"

 

 

5.      Redis 실행 / 종료

       i.         cd /ccpkg/platform/redis/bin

      ii.         ./redis-server ../conf/redis.conf

     iii.         ./redis-sendinel ../conf/sentinel.conf

6.      



8. cluster

클러스터 설정하기

Redis.conf에서 설정

 - 설정파일은 redis.conf에 있음

   #### REDIS CLUSTER ### 참조

port 7000

cluster-enabled yes

cluster-config-file nodes.conf

cluster-node-timeout 5000

appendonly yes

cluster의 경우 3node 이상에서 동작함.

 

@ ruby 기반에서 동작함

[Ruby 설치]

-       Install ruby

-       ftp://195.220.108.108/linux/sourceforge/s/sy/sys-integrity-mgmt-platform/yum/el/6/ext/x86_64/libyaml-0.1.4-2.el6.x86_64.rpm

-       rpm –ivh libyaml-0.1.4-2.el6.x86_64.rpm

#> wget http://rpms.southbridge.ru/rhel6/ruby-1.9.3/x86_64/ruby-1.9.3.p547-1.el6.x86_64.rpm

 

#> yum install ruby-1.9.3/x86_64/ruby-1.9.3.p547-1.el6.x86_64.rpm

      rpm –ivh ruby-1.9.3.p547-1.el6.x86_64.rpm

 

    #> yum install gcc gcc-g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel

 

    #> gem update

    #> gem update system

 

 

<Cluster 생성>

To create a cluster, follow this steps:

 

1. Edit create-cluster and change the start / end port, depending on the

number of instances you want to create.

2. Use "./create-cluster start" in order to run the instances.

3. Use "./create-cluster create" in order to execute redis-trib create, so that

an actual Redis cluster will be created.

4. Now you are ready to play with the cluster. AOF files and logs for each instances are created in the current directory.

 

<cluster 삭제>

In order to stop a cluster:

 

1. Use "./craete-cluster stop" to stop all the instances. After you stopped the instances you can use "./create-cluster start" to restart them if you change ideas.

2. Use "./create-cluster clean" to remove all the AOF / log files to restat with a clean environment.