메뉴 건너뛰기

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>

된거임…

번호 제목 글쓴이 날짜 조회 수
109 웹사이트 보안 개발 가이드 20160421 관리자 2017.07.25 49
108 jsp 에서 사용자가 생성한 java class 호출 하기 관리자 2015.12.31 50
107 $_SERVER[‘SERVER_SOFTWARE’]=’Apache’ in wp-config.php 관리자 2016.06.24 50
106 Testing the Fastest Way to Import a Table into MySQL (and some interesting 5.7 performance results) 관리자 2015.12.31 51
105 WordPress 4.8.1 Maintenance Release 관리자 2017.08.03 51
104 그누보드 짧은 주소 작성 (nginx) 관리자 2016.02.02 53
103 config static port for nfsd on centos6 관리자 2016.05.21 56
102 pulseaudio [alsa-sink-VT1708S Analog] alsa-sink.c: Error opening PCM device front:0: 부적절한 인수 관리자 2016.12.21 58
101 [MySQL] ERROR 1457 (HY000): Failed to load routine after upgrade or migratrion 관리자 2015.12.31 61
100 The Month in WordPress: August 2017 관리자 2017.09.02 62
99 mysqlbinlog: unknown variable ‘default-character-set=utf8’ 관리자 2016.07.09 64
98 cannot resolve symbol R on android studio 관리자 2016.02.17 65
97 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
96 리눅스 서버의 TCP 네트워크 성능을 결정짓는 커널 파라미터 이야기 – 2편 관리자 2016.08.12 69
95 [AWS] certificate arn:aws:iam server-certificate not found when configure ELB 관리자 2017.06.06 69
위로