메뉴 건너뛰기

GREATUSER

tech

REDIS-3.0.1 설치 하기

위대한유저 2015.06.04 18:39 조회 수 : 394

 

1. redis 설치

다운로드 : http://redis.io

wget http://download.redis.io/releases/redis-3.0.1.tar.gz

tar zxvpf redis-3.0.1.tar.gz

cd redis-3.0.1

make PREFIX=/usr/local/redis install

mkdir -p /usr/local/redis/etc

난 redis를 /usr/local/redis 하단에 설치하기 위해서 make 명령에 부가 옵션을 준것이고, 통상적으로 /usr/local/bin 하단에 들어가게 하려면 그냥 make  명령만 사용하면 된다.

어디까지나 개인의 취향적인 부분이고… 굳이 왜 저렇게 했는가를 묻는다면….

redis는 시스템의 기본 패키지가 아니라, 특정 목적을 가진 서비스용 패키지 이기 때문에

* 이것(redis)이 설치되어있다.
* 다른 파일 & 디렉토리와 구분을 했으면 좋겠다.
* 이것(redis) 업그레이드시 해당 디렉토리만 갈아 치우면 된다.
* 이것(redis) 삭제해 해당 디렉토리만 삭제 하면 된다.

라는 생각으로 /usr/local/redis 를 사용했다.

 

2. 설정파일

redis 소스 디렉토리에 있는 것을 복사해서 사용하자

cp redis.conf /usr/local/redis/etc/6379.conf

 

3. 구동스크립트(redis init)

redis 소스 디렉토리에 있는 것을 복사해서 사용하자.

cp utils/redis_init_script /etc/init.d/redis_6379

다만, 나는 /usr/local/redis 로 위치를 강제 지정했기 때문에 init 스크립트 역시 약간의 수정을 해줘야 한다…

 

REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
CLIEXEC=/usr/local/redis/bin/redis-cli

PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF=”/usr/local/redis/etc/${REDISPORT}.conf”

 

 

4. redis 시작

/etc/init.d/redis_6379 start

redis 시작시 출력되는 메세지

27150:M 03 Jun 17:54:55.589 # Server started, Redis version 3.0.1
27150:M 03 Jun 17:54:55.589 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ’vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ’sysctl vm.overcommit_memory=1’ for this to take effect.
27150:M 03 Jun 17:54:55.589 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ’echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
27150:M 03 Jun 17:54:55.589 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
27150:M 03 Jun 17:54:55.589 * The server is now ready to accept connections on port 6379

자 한줄한줄 처리를 해봅시다..

 

* rc.local 에 등록할 내용 (해당 내용은 쉘에서 한번 실행 하자)

# for redis
echo never > /sys/kernel/mm/transparent_hugepage/enabled

 

* sysctl.conf 에  등록할 내용

# for redis

vm.overcommit_memory = 1

net.core.somaxconn = 65535

 

sysctl -p

다시 redis를 재시작 하면..
/etc/init.d/redis_6379 stop
/etc/init.d/redis_6379 start

아까 봤던 에러 메세지는 더이상 나오지 않는것을 확인 할 수 있다.

 

5. 제대로 구동되고 있는가???

# /usr/local/redis/bin/redis-cli
127.0.0.1:6379> set myname choilha
OK
127.0.0.1:6379> get myname
”choilha”
127.0.0.1:6379>

된거임…

번호 제목 글쓴이 날짜 조회 수
49 인터넷으로 서비스를 제공하기 위해 챙겨야 할 실용적인 보안 가이드 관리자 2016.05.24 33
48 termination protection on instances and instance protection on auto scaling 관리자 2016.05.31 30
47 mod_rpaf on aws elb 관리자 2016.06.17 42
46 Apache Tomcat Versions – Which Do I Want? 관리자 2016.06.24 44
45 $_SERVER[‘SERVER_SOFTWARE’]=’Apache’ in wp-config.php 관리자 2016.06.24 49
44 WordPress 4.6 Beta 1 관리자 2016.06.30 35
43 mysqlbinlog: unknown variable ‘default-character-set=utf8’ 관리자 2016.07.09 64
42 WordPress 4.6 Beta 3 관리자 2016.07.14 33
41 Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MariaDB client in /home1/htdocs/apartzm/affisacc/php/acc_tongys.inc.php on line 188ERROR 1251: Client does not smysql_connect(): Client 관리자 2016.07.26 66
40 WordPress 4.6 Release Candidate 관리자 2016.07.28 42
39 리눅스 서버의 TCP 네트워크 성능을 결정짓는 커널 파라미터 이야기 – 1편 관리자 2016.08.12 73
38 리눅스 서버의 TCP 네트워크 성능을 결정짓는 커널 파라미터 이야기 – 2편 관리자 2016.08.12 69
37 리눅스 서버의 TCP 네트워크 성능을 결정짓는 커널 파라미터 이야기 – 3편 관리자 2016.08.12 75
36 WordPress 4.6 “Pepper” 관리자 2016.08.17 46
35 Unable to validate certificate chain in aws elb – comodossl 관리자 2016.09.06 159
위로