728x90

Redis Open Source - Install using RPM and systemd
1. Install Redis with RPM
- Create the file /etc/yum.repos.d/redis.repo with the following contents.
다음 내용을 사용하여 파일을 만듭니다./etc/yum.repos.d/oss_redis.repo
- For Rocky Linux 9 / AlmaLinux 9 / etc...
[Redis]
name=Redis
baseurl=http://packages.redis.io/rpm/rockylinux9
enabled=1
gpgcheck=1
- For Rocky Linux 8 / AlmaLinux 8 / etc...
[Redis]
name=Redis
baseurl=http://packages.redis.io/rpm/rockylinux8
enabled=1
gpgcheck=1
2. Run the following commands
다음 내용을 사용하여 gpg 공개키 등록을 통해 yum/dnf 로 파일을 다운 받도록 합니다.
# rpm --import public.gpg.key
curl -fsSL https://packages.redis.io/gpg > /tmp/redis.key
sudo rpm --import /tmp/redis.key
sudo yum install redis
2. 소스 설치 및 직접 systemd 등록
만약 직접 소스 빌드한 경우, redis.service systemd 유닛 파일을 수동 작성해야 합니다.
예시:
systemd 서비스 유닛 파일 (/etc/systemd/system/redis.service)
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
# 메모리 잠금 (옵션)
LimitNOFILE=10000
[Install]
WantedBy=multi-user.target
- User, Group, ExecStart 경로는 빌드·설치 위치에 따라 수정하세요4.
3. redis 저장소 : 필수 디렉터리/권한 설정:
다음과 같이 redis 저장소 위치에 대한 권한을 설정합니다.
"/var/lib/redis/dump.rdb" 파일이 redis 설정 환경을 저장하고 관리 합니다.
sudo adduser --system --group --no-create-home redis
sudo mkdir /var/lib/redis
sudo chown redis:redis /var/lib/redis
sudo chmod 770 /var/lib/redis
- /etc/redis/redis.conf 파일도 redis 사용자가 읽을 수 있어야 합니다4.
4. systemd 서비스 등록 및 시작:
bash
sudo systemctl daemon-reload
sudo systemctl start redis
sudo systemctl enable redis
sudo systemctl status redis
5. 서비스 확인 및 테스트
bash
# redis-cli로 접속
redis-cli
# 정상 작동 확인
127.0.0.1:6379> PING
PONG
(참고) Redis 서버 시작 설정
redis-server --help
[root@vbox redis-conf]# redis-server --help
Usage: ./redis-server [/path/to/redis.conf] [options] [-]
./redis-server - (read config from stdin)
./redis-server -v or --version
./redis-server -h or --help
./redis-server --test-memory <megabytes>
./redis-server --check-system
Examples:
./redis-server (run the server with default conf)
echo 'maxmemory 128mb' | ./redis-server -
./redis-server /etc/redis/6379.conf
./redis-server --port 7777
./redis-server --port 7777 --replicaof 127.0.0.1 8888
./redis-server /etc/myredis.conf --loglevel verbose -
./redis-server /etc/myredis.conf --loglevel verbose
Sentinel mode:
./redis-server /etc/sentinel.conf --sentinel
redis-server --check-system
redis-server --check-system
[slow-clocksource]...OK
[xen-clocksource]...OK
[overcommit]...OK
[THP]...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 madvise > /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 (set to 'madvise' or 'never').
핵심 요약
예시
| 작업 | 명령어 (Ubuntu/Debian) | 명령어 (CentOS/RHEL) |
| Redis 설치 | sudo apt install redis-server | sudo yum install redis |
| Redis 서비스 시작 | sudo systemctl start redis-server | sudo systemctl start redis |
| Redis 서비스 부팅 자동실행 | sudo systemctl enable redis-server | sudo systemctl enable redis |
| Redis 서비스 상태 확인 | sudo systemctl status redis-server | sudo systemctl status redis |
- 소스 빌드 시에는 별도 서비스 파일(/etc/systemd/system/redis.service)을 작성해야 합니다.
728x90
반응형
'DevOps' 카테고리의 다른 글
| Redis 설치 유의사항 - redis-server --check-system 점검 (0) | 2025.07.21 |
|---|---|
| Redis에서 TLS를 활성화 (0) | 2025.07.21 |
| Redis Benchmark (0) | 2025.07.21 |
| Redis | Hazelcast 기능 및 성능 비교 (0) | 2025.07.19 |
| Redis Architect (2) | 2025.07.14 |
| Redis 8 - 새로운 기능 과 성능 개선 (0) | 2025.07.14 |
| Redis Enterprise 기능 비교 (0) | 2025.07.14 |