본문 바로가기

리눅스

우분투에서 Redis 서버를 소스 코드로 컴파일하여 설치하는 방법(소스 컴파일)

반응형

우분투에서 Redis 서버를 소스 코드로 컴파일하여 설치하는 방법(소스 컴파일)

테스트 환경

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jamm

redis server install

wget https://download.redis.io/releases/redis-6.2.7.tar.gz
tar xfz redis-6.2.7.tar.gz
cd redis-6.2.7

컴파일

make
$ make
...
    LINK redis-server
    INSTALL redis-sentinel
    CC redis-cli.o
    CC cli_common.o
    LINK redis-cli
    CC redis-benchmark.o
    LINK redis-benchmark
    INSTALL redis-check-rdb
    INSTALL redis-check-aof

Hint: It's a good idea to run 'make test' ;)

make[1]: Leaving directory '/usr/local/src/redis-6.2.7/src'
make install
$ make install
cd src && make install
make[1]: Entering directory '/usr/local/src/redis-6.2.7/src'
    CC Makefile.dep

Hint: It's a good idea to run 'make test' ;)

    INSTALL redis-server
    INSTALL redis-benchmark
    INSTALL redis-cli
make[1]: Leaving directory '/usr/local/src/redis-6.2.7/src'

redis-cli 버전

/usr/local/bin/redis-cli --version
$ /usr/local/bin/redis-cli --version
redis-cli 6.2.7

redis server 버전

/usr/local/bin/redis-server --version
$ /usr/local/bin/redis-server --version
Redis server v=6.2.7 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=222518f6c635ef61
728x90

redis server 디렉터리 생성

mkdir -pv /var/lib/redis
mkdir -pv /var/log/redis
mkdir -pv /etc/redis
cp /usr/local/src/redis-6.2.7/redis.conf /etc/redis/redis.conf

redis.conf 설정

bind 0.0.0.0
port 6379
dir /var/lib/redis
daemonize yes
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 3000
appendonly yes
appendfilename "appendonly.aof"
pidfile /var/run/redis.pid
logfile "/var/log/redis/redis-6381.log"

redis(redis warning) 설정

TCP backlog 경고

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

overcommit_memory 경고

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

THP 경고

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

Redis Server Start/Stop

redis server start

/usr/local/bin/redis-server /etc/redis/redis.conf

redis server stop

ps -ef | grep redis-server | grep -v grep | awk {'print $2'} | xargs kill -9

레디스 핑 테스트

redis-cli -h 127.0.0.1 -p 6379 ping

 

참고URL

- [linux] redis 설치 : https://scbyun.com/724

- [linux] redis 모니터링 툴(redis-stat) : https://scbyun.com/726

- [Redis] Redis 최신 버전 설치하기 : https://scbyun.com/1079

- [리눅스] Redis 경고 : https://scbyun.com/1058

- [Docker] predixy redis-cluster 구성 https://scbyun.com/1038

 

728x90
반응형