본문 바로가기

리눅스

[draft] CentOS 7에 최신 버전의 Redis를 설치하는 방법

728x90

CentOS 7에 최신 버전의 Redis를 설치하는 방법

redis : A persistent key-value database

EPEL 저장소 및 YUM Utilities 패키지 설치

yum install -y epel-release yum-utils

remi 저장소 설치

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

remi 저장소를 활성화

yum-config-manager --enable remi

설치전 Redis 버전 확인

yum info redis
$ yum info redis
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * epel: nrt.edge.kernel.org
 * extras: mirror.kakao.com
 * remi: ftp.riken.jp
 * remi-safe: ftp.riken.jp
 * updates: mirror.kakao.com
Available Packages
Name        : redis
Arch        : x86_64
Version     : 6.2.5
Release     : 1.el7.remi
Size        : 1.2 M
Repo        : remi
Summary     : A persistent key-value database
URL         : http://redis.io
License     : BSD
Description : Redis is an advanced key-value store. It is often referred to as a data
            : structure server since keys can contain strings, hashes, lists, sets and
            : sorted sets.
            :
            : You can run atomic operations on these types, like appending to a string;
            : incrementing the value in a hash; pushing to a list; computing set
            : intersection, union and difference; or getting the member with highest
            : ranking in a sorted set.
            :
            : In order to achieve its outstanding performance, Redis works with an
            : in-memory dataset. Depending on your use case, you can persist it either
            : by dumping the dataset to disk every once in a while, or by appending
            : each command to a log.
            :
            : Redis also supports trivial-to-setup master-slave replication, with very
            : fast non-blocking first synchronization, auto-reconnection on net split
            : and so forth.
            :
            : Other features include Transactions, Pub/Sub, Lua scripting, Keys with a
            : limited time-to-live, and configuration settings to make Redis behave like
            : a cache.
            :
            : You can use Redis from most programming languages also.
728x90

Redis 설치

remi 저장소를 활성화한 후 Redis를 설치합니다.

sudo yum install -y redis

Redis 버전 확인

redis-cli --version
$ redis-cli --version
redis-cli 6.2.5

Redis 서비스 시작 및 부팅 시 자동 시작 설정

sudo systemctl --now enable redis

Redis 상태 확인

sudo systemctl status redis

Redis 구성 확인

sudo vim /etc/redis.conf
bind 0.0.0.0

레디스 설치 후 기본 구성 설정(redis default configuration settings)

TCP backlog 경고

sysctl -w net.core.somaxconn=1024

(또는)

echo "net.core.somaxconn = 1024" >> /etc/sysctl.conf

overcommit_memory 경고

sysctl -w vm.overcommit_memory=1

(또는)

echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf

THP 경고

echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local

Redis 클라이언트로 접속 테스트

Redis가 제대로 설치되고 실행되고 있는지 확인하기 위해 Redis 클라이언트를 사용하여 접속해 볼 수 있습니다.

redis-cli

Redis 클라이언트가 실행되면 PING 명령을 입력하여 응답을 확인합니다.

127.0.0.1:6379> PING
PONG

 

728x90