워드프레스 Redis Cache 설치 및 설정

Redis Cache는 비관계형 데이터베이스 관리 시스템으로, 오픈 소스 기반으로 개발된 Remote Dictionary Server의 약자입니다. 이 시스템은 키-값 구조의 비정형 데이터를 저장하고 관리합니다.

✅ Redis Cache 설치

~]# dnf -y install redis
Last metadata expiration check: 3:09:28 ago on Thu 01 Aug 2024 07:16:40 AM UTC.
Dependencies resolved.
==========================================================================================================
 Package                  Architecture              Version                        Repository                    Size
==========================================================================================================
Installing:
 redis                    x86_64                    6.2.7-1.el9                    appstream                    1.3 M

Transaction Summary
==========================================================================================================
Install  1 Package

Total download size: 1.3 M
Installed size: 4.7 M
Downloading Packages:
redis-6.2.7-1.el9.x86_64.rpm                                                           28 MB/s | 1.3 MB     00:00
----------------------------------------------------------------------------------------------------------
Total                                                                                 1.7 MB/s | 1.3 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1
  Running scriptlet: redis-6.2.7-1.el9.x86_64                                                                     1/1
  Installing       : redis-6.2.7-1.el9.x86_64                                                                     1/1
  Running scriptlet: redis-6.2.7-1.el9.x86_64                                                                     1/1
  Verifying        : redis-6.2.7-1.el9.x86_64                                                                     1/1

Installed:
  redis-6.2.7-1.el9.x86_64

Complete!
~]# rpm -qa | grep redis
redis-6.2.7-1.el9.x86_64

~]# dnf -y install redis-devel
Last metadata expiration check: 3:13:27 ago on Thu 01 Aug 2024 07:16:40 AM UTC.
Dependencies resolved.
======================================================================================================================
 Package                      Architecture            Version                        Repository                  Size
======================================================================================================================
Installing:
 redis-devel                  x86_64                  6.2.7-1.el9                    appstream                   21 k

Transaction Summary
======================================================================================================================
Install  1 Package

Total download size: 21 k
Installed size: 67 k
Downloading Packages:
redis-devel-6.2.7-1.el9.x86_64.rpm                                                    101 kB/s |  21 kB     00:00
----------------------------------------------------------------------------------------------------------------------
Total                                                                                  26 kB/s |  21 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1
  Installing       : redis-devel-6.2.7-1.el9.x86_64                                                               1/1
  Running scriptlet: redis-devel-6.2.7-1.el9.x86_64                                                               1/1
  Verifying        : redis-devel-6.2.7-1.el9.x86_64                                                               1/1

Installed:
  redis-devel-6.2.7-1.el9.x86_64

Complete!
~]# systemctl status redis
~]# systemctl start redis
~]# systemctl enable redis
Created symlink /etc/systemd/system/multi-user.target.wants/redis.service  /usr/lib/systemd/system/redis.service.

# 정상 작동 확인 $
~]# redis-cli ping
PONG

~]# dnf -y install php-redis
Last metadata expiration check: 0:40:38 ago on Thu 01 Aug 2024 11:39:12 AM UTC.
Dependencies resolved.
=========================================================================================================
 Package                       Architecture       Version                              Repository                Size
=========================================================================================================
Installing:
 php-pecl-redis6               x86_64             6.0.2-1.el9.remi.8.3                 remi-modular             331 k
Installing dependencies:
 liblzf                        x86_64             3.6-22.el9                           epel                      27 k
 php-pecl-igbinary             x86_64             3.2.15-1.el9.remi.8.3                remi-modular              71 k
 php-pecl-msgpack              x86_64             2.2.0-2.el9.remi.8.3                 remi-modular              56 k

Transaction Summary
=========================================================================================================
Install  4 Packages

Total download size: 485 k
Installed size: 2.3 M
Downloading Packages:
(1/4): php-pecl-msgpack-2.2.0-2.el9.remi.8.3.x86_64.rpm                                52 kB/s |  56 kB     00:01
(2/4): liblzf-3.6-22.el9.x86_64.rpm                                                    25 kB/s |  27 kB     00:01
(3/4): php-pecl-igbinary-3.2.15-1.el9.remi.8.3.x86_64.rpm                              53 kB/s |  71 kB     00:01
(4/4): php-pecl-redis6-6.0.2-1.el9.remi.8.3.x86_64.rpm                                426 kB/s | 331 kB     00:00
---------------------------------------------------------------------------------------------------------
Total                                                                                 169 kB/s | 485 kB     00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1
  Installing       : php-pecl-msgpack-2.2.0-2.el9.remi.8.3.x86_64                                                 1/4
  Installing       : php-pecl-igbinary-3.2.15-1.el9.remi.8.3.x86_64                                               2/4
  Installing       : liblzf-3.6-22.el9.x86_64                                                                     3/4
  Installing       : php-pecl-redis6-6.0.2-1.el9.remi.8.3.x86_64                                                  4/4
  Running scriptlet: php-pecl-redis6-6.0.2-1.el9.remi.8.3.x86_64                                                  4/4
  Verifying        : liblzf-3.6-22.el9.x86_64                                                                     1/4
  Verifying        : php-pecl-igbinary-3.2.15-1.el9.remi.8.3.x86_64                                               2/4
  Verifying        : php-pecl-msgpack-2.2.0-2.el9.remi.8.3.x86_64                                                 3/4
  Verifying        : php-pecl-redis6-6.0.2-1.el9.remi.8.3.x86_64                                                  4/4

Installed:
  liblzf-3.6-22.el9.x86_64                                 php-pecl-igbinary-3.2.15-1.el9.remi.8.3.x86_64
  php-pecl-msgpack-2.2.0-2.el9.remi.8.3.x86_64             php-pecl-redis6-6.0.2-1.el9.remi.8.3.x86_64

Complete!

✅ Redis Cache 설정

🔲 redis.conf 설정

  1 # 최대 메모리 사용량
  2 maxmemory 512mb
  3 maxmemory-policy allkeys-lru
  4 
  5 # 내부 접속만 허용 (보안 강화)
  6 bind 127.0.0.1 -::1
  7 protected-mode yes
  8 
  9 # 비밀번호 설정 (내부만 쓸 경우 비활성)
 10 # requirepass MyStrongPassword123!
 11 
 12 # 포트 - 기본 6379 (비활성해도 socket으로 통신 가능)
 13 port 6379
 14 
 15 # UNIX socket 설정
 16 unixsocket /var/run/redis/redis.sock
 17 unixsocketperm 777
 18 
 19 # 지속 저장 비활성 (워드프레스 캐시 전용)
 20 save ""
 21 appendonly no
 22 
 23 # 백그라운드 리클레임 및 메모리 최적화
 24 activerehashing yes
 25 lazyfree-lazy-eviction yes
 26 lazyfree-lazy-expire yes

🔲 wp-config.php 설정

## Redis 설정 ##
# socket 설정 #
define( 'WP_REDIS_PATH', '/var/run/redis/redis.sock' );
define( 'WP_REDIS_SCHEME', 'unix' );
# 3시간으로 설정
define( 'WP_REDIS_METRICS_MAX_TIME',10800);

🔲 redis Service 설정

systemctl enable redis
systemctl start redis
Redis Cache 로고

✅ Redis Object Cache Plugin 설치 및 확인

아래 화면처럼 플러그인 설치 후 Redis Cache의 정상적인 구동을 확인할 수 있습니다.

Redis Objact Cache 플러그인 상태 화면
Redis Objact Cache 플러그인 통계 화면

Similar Posts

  • [WP] 가성비 해외 호스팅: 네임칩 VS 호스팅어 비교

    해외에서 매니지드 워드프레스 호스팅을 사용하는 분들이 늘어나고 있습니다. 이번에는 가성비 해외 호스팅 업체 중 호스팅어Hostinger와 네임칩NameCheap 2군데를 비교해 보겠습니다. 호스팅과 도메인 가격, 서비스 등의 전반적인 내용을 위주로 비교해 보겠습니다. 어느 정도 웹 사이트의 트래픽이 발생해서 국내에서 대역폭으로 고민하는 경우 클라우드플레어 무료CDN과 함께 사용한다면 사용 중인 국내 호스팅 업체의 서버 업데이트를 통한 비용과 비슷한…

  • [WP] 3가지 리소스 힌트로 워드프레스 성능 향상

    워드프레스 웹 사이트를 운영하면서 초보자의 경우 테마와 플러그인을 하나 씩 설치하면서 점점 느려지는 속도에 당황하게 됩니다. SEO에도 좋지 않지만 느린 웹 사이트는 방문자 이탈율이 늘어날 수 밖에 없습니다. 속도를 향상시키기 위한 방법 중 하나는 캐시 플러그인 사용이며, 거의 모든 캐시 플러그인에 있는 리소스 힌트 제거 기능에 대해 알아 보겠습니다. 목차✅ Redis Cache 설치✅…

  • FastComet 호스팅 신규 신청(가격과 성능)

    워드프레스 사이트 중 일부를 해외 웹호스팅 FastComet에서 사용하기 위해 신규 호스팅을 신청하게 되었습니다. 현재는 주가 되는 웹사이트는 AWS 서버를 사용하지만 FastComet 호스팅은 해외 워드프레스 호스팅 중 Hostinger 다음으로 신청한 2번째 호스팅으로 2년 동안 사용했던 호스팅입니다. 목차✅ Redis Cache 설치✅ Redis Cache 설정🔲 redis.conf 설정🔲 wp-config.php 설정🔲 redis Service 설정✅ Redis Object Cache Plugin 설치…

  • [WP] 웹 브라우저 렌더링이란?[렌더링 종류]

    브라우저 렌더링이란 HTML, CSS, 자바스크립트 등 웹 사이트의 문서가 웹 브라우저에서 출력 되는 과정입니다. 모바일 or PC 모니터 등 브라우저에서 웹 페이지가 표시(렌더링)되는 것이라고 하는 것이 쉬운 접근 법입니다. 각각의 브라우저는 렌더링을 실행하는 렌더링Rendering 엔진을 가지고 있습니다. ※브라우저 별 렌더링 엔진 크롬&오페라 : Blink 인터넷 익스플로러 : Trident 모질라 파이어폭스: Gecko 사파리 :…

  • [WP] 워드프레스 글 페이지 차이

    워드프레스를 처음 후 운영하게 되면 글(Post)과 페이지(Page) 차이가 어려워 혼동을 겪는 경우가 많습니다. 워드프레스 글 페이지 차이가 무엇인지 명확히 알아 보도록 하겠습니다. 워드프레스 포스트(글)은 워드프레스에서 제공하는 가장 기본적인 글 형식입니다. 동적인 콘텐츠이며 반대로 페이지는 정적인 콘텐츠입니다. 목차✅ Redis Cache 설치✅ Redis Cache 설정🔲 redis.conf 설정🔲 wp-config.php 설정🔲 redis Service 설정✅ Redis Object Cache…

  • [WP]워드프레스 무료 테마 추천: BEST 9

    워드프레스를 시작하는 경우 어떤 유료 테마와 무료 테마가 좋은지, 운영할 사이트 목적에 적합한 테마를 찾는 일부터 시작해야 합니다. 유료 테마 이전에 설치하려는 워드프레스 무료 테마가 설치 후 삭제하지 않고 사용할 만한 가치가 있는지 미리 검토를 고려하고 싶을 때 체크할 수 있는 무료 테마 리스트입니다. 목차✅ Redis Cache 설치✅ Redis Cache 설정🔲 redis.conf 설정🔲…

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

Prove your humanity: 5   +   4   =