• Home
  • WordPress
  • web Hosting
    • Free hosting
    • Cheap Hosting
    • comparison cloud , vps, shared, wordpress
    • managed wordpress hosting
    • managed cloud hosting
  • page Speed
  • Deals
  • Services
  • About

RAaz Kumar .com

wordpress tutorials seo hosting etc


redis install ubuntu 20.04 with wordpress php redis mysql configuration

Redis installation on ubuntu 20.04

 

1st step: update & install redis server form ubuntu repository

sudo apt update && sudo apt install redis-server

 

2nd redis server configuration

edit

sudo nano /etc/redis/redis.conf

 

change:

: supervised no // change here

supervised systemd

then it runs as a service

bind local or remote address

bind 127.0.0.1 ::1

maxmemory 256mb
maxmemory-policy allkeys-lru

step 3 restart reload  redis

systemctl restart redis

systemctl status redis

check port redis running or not

sudo netstat -lnp | grep redis

to check ports

redis-cli

send ping then it returns pong.

php 7 install redis extension

apt-get install php-redis
check redis module or not by typing
php -m | grep redis
PHP Warning: Module ‘redis’ already loaded in Unknown on line 0
redis
supports PHP 7 then don’t go for manual installation.
memcached storage is low,
php acp dead and rebuild as APCu.  store cache in the PHP shared memory (memory-hog >>opcode cache memory, php process memory may unstable>> due to high memory allocated to a single php process when you increase over all php memory)

How to use redis wordpress

installing and configuring Redis, >> installing a PHP extension, >>Redis Object Cache plugin.

#1 Installing php redis extension

apt-get install redis
apt-get install php-redis
Quick & easy but not the latest version.

#2 by Enable Redis object cache in w3 Total cache

Performance (w3tc)>> General settings>> page cache>>

  1. Disc basic
  2. Disc enhance
  3. Php Apcu
  4. Redis  (it will available once you load redis PHP extension)

 

#3 Edit wp-config.php file

define(‘WP_CACHE’, true);
define(‘WP_CACHE_KEY_SALT’, ‘yoursite.com’);

Note: object-cache.php (generated by any plugin) should be ar wp-content directory.

#2nd way  install redis object cache plugin

 

 

if root access then try this command. shared hosting servers may not offer this.

redis-cli monitor

using redis and mysql together

Redis is an in-memory databases,  faster as compare to query the data from hdd MYSQL. also read mysql buffer pool cache

how to use redis with mysql database in Apache nginx

redis php extension from github (predis library from github), or wordpress directory

mysql smart plugin,

like memcached plugin for mysql

InnoDB memcached plugin ( daemon_memcached ) provides an integrated memcached daemon.

 

Reinstall Uninstall & install redis on Ubuntu 20.4

sudo apt-get remove

sudo apt-get purge redis-server

//pyrhe removes config files

 

apt install redis-server

check status

service redis-server status

root@-s-4vcpu-8gb-blr1-01:~# service redis-server status
● redis-server.service – Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) sin

 

ps aux | grep redis

edit redis configuration file

restart

service redis-server start

MySQL and Redis drivers

Installing Redis from source

Latest version 4.0
http://download.redis.io/redis-stable.tar.gz
redis as server
Using Redis as an LRU cache
Installing from source & compile at the server
sudo apt-get update
sudo apt install build-essential
cd /tmp
wget http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz &&  cd redis-stable
make && make install
cleaning temp directory
cd..

2.working with redis configuration file

sudo mkdir /etc/redis &&  cp redis.conf /etc/redis/
sudo nano /etc/redis/redis.conf
maxmemory 128mb
maxmemory-policy allkeys-lru
supervised no (change)
supervised systemd
working directory
dir ./
change to
dir /var/lib/redis

3.Create Redis systemd Unit File

sudo nano /etc/systemd/system/redis.service
copy & paste the below code

[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

[Install]
WantedBy=multi-user.target

save the file by CTRL+X and type and hit enter.

4.Creating User /group /directories and permissions

sudo adduser –system —group –no-create-home redis &&  mkdir /var/lib/redis && chown redis:redis /var/lib/redis && chmod 770 /var/lib/redis

start

sudo systemctl start redis

stop

sudo systemctl stop redis

restart

sudo systemctl restart redis

Enable Redis on every Bootup

sudo systemctl enable redis
testing:
netstat -lntp to know all listening ports
# redis-cli
127.0.0.1:6397>>ping
you will get pong
Redis configuring with PHP
install the Redis Object Cache Plugin.

 

APcu vs Memcached vs Redis

implementing Object cache with APCu, Redis for wordpress memcached comparison
>> No need to communicate with another server.
>>NO TCP Connection (to PHP & MySQL)
>> ACpu stores in php shared memory (no separate memory allocation needed, this can cause memory -hog I need to increase PHP memory size and figure out how much MySQL using)
APCu
Does not share the cache with other servers but is faster (maybe)
single machine.
why Redis among Memcached and php apcu?
more features than memcached.

ACPU Installation

from repository
check your distribution version
lsb_release -a
Description: Ubuntu 18.04.1 LTS
step 1: 
sudo apt-get install php7.2-apcu -y
step 2:
nano /etc/php/7.2/mods-available/acpu.ini
add the following adjusting memory size
extension=apcu.so
apc.shm_size = “50M”
check php enabled modules by
php -m
restart
step 3:
service php7.2-fpm restart
step 4:
go to w3tc >>general settings>> object cache>> Apc/apcu.

nano /etc/php/7.0/mods-available/apcu.ini
extension=apcu.so
apc.shm_size = “40M”
nano /etc/php/7.0/mods-available/redis.ini
apc
opcache settings for WordPress
don’t disable timestamps. it caches all unnecessary PHP file from /wp-includes and wp-admin/
don’t set large amount memory.
validate settings should be low.

enable memcached plugin with mysql

libmemcached.so: the memcached daemon plugin to MySQL.

innodb_engine.so: an InnoDB API plugin to memcached.

libevent must be installed.

sudo apt-get install libevent-dev

2. step

 

mysql> source MYSQL_HOME/share/innodb_memcached_config.sql

mysql> USE innodb_memcache;
mysql> SHOW TABLES;

Activate the daemon_memcached plugin by running the INSTALL PLUGIN statement:

mysql> INSTALL PLUGIN daemon_memcached soname “libmemcached.so”;

telnet localhost 11211

read more here

how to use memcached with wordpress

memcached used by youtube,fb,twitter, why don;t you. easy to configure.
matured than redis.

#1 install memcached ubuntu / debian family

sudo apt-get update && sudo apt-get install memcached

sudo apt-get install libmemcached-tools (optional)

#1.1 configuring memcached  conf memory limit

sudo nano /etc/memcached.conf

default values are enough but 64mb memory

binding
add top of the file if not
-l 127.0.0.1

disable UDP
add bottom of the file
. . .
-U 0

uncomment
. . .
-vv
to enable logging
/var/log/memcached

memory allocation

Locate the -m parameter.
value to MB or GB based on DB size frequently accessed data.

256MB for low end servers 512MB 1Gb as per need.

 

sudo systemctl restart memcached

check
telnet localhost 11211
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
exit memcached telnet
quit
Connection closed by foreign host.
or
ps aux | grep memcached
stop memcached
sysctl stop memcached
sysctl disable memcached

#2 install php -memcached extension from github

sudo apt-get install -y php-memcached
(if not works add ppa repository / install from source github)

#3 Edit wp-config.php file

define(‘WP_CACHE’, true);
define(‘WP_CACHE_KEY_SALT’, ‘yoursite.com’);

define(‘WP_CACHE’, true); // Added by W3 Total Cache

#4 install w3tc

used memached for object cache. not page cache (if it done by fastcgi)
Conclusion: i have tried both Apcu and Redis in the past. installed Memcached on the test server as of far i don’t remember about Memcached. its a tie between redis and Apcus. (both Memcached & redis are distributed but Apcu works only for local machine)
Reference:
https://guides.wp-bullet.com/install-redis-object-cache-for-wordpress-php-7-on-ubuntu-16-04/
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04

Related topics:

  1. Linux sysadmin tutorials linux system administrator
  2. redis config file location ubuntu config settings
  3. managed cloud hosting with AWS, GCP, DO
  4. improve mysql performance wordpress my.cnf file configuration
  5. change wordpress site url

tutorials

  • Vivek Bindra Videos Transcription (business strategy)
  • git commands
  • new relic php agent install in 3 steps
  • new relic mysql install integration - 2 ways fix problems
  • new relic installation linux (infrastructure agent , php, mysql , nginx)
  • xampp tutorials 2021 installation errors fix wordpress phpmyadmin mysql apache
  • Redis performance metrics & tuning for nginx apache ubuntu & debian
  • Devops course Syllabus topics PDF AWS, Azure, cisco, redhat
  • CCNA Syllabus pdf (CCNA / CCNP vs devops vs mcsa /MCSE)
  • how to create a website free of cost on google
  • what is vpn vs proxy vs tor, http vs https, http2, tcp vs udp, kali linux sql source code injection
  • nginx server tutorials (installation, configuration, performance tuning, security)
  • MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS
  • AUdio Editing Background Noise removal (Audacity, Adobe Premiere Addition, Camtasia Filmora Windows Obs)
  • Android Studio tutorials syllabus Topics Course details #AndroidApplicationDevelopment
  • [INTRO] Ethical hacking / cyber Security / Penetration testing Tutorial -{updates frequently}
  • redis install ubuntu 20.04 with wordpress php redis mysql configuration
    • redis config file location ubuntu config settings
    • redis wordpress (install, configure, tweak performance ) compared with memcached
    • redis slowlog enable disable view logs keys examples
  • ubuntu tutorials installation download issues etc
  • Php tutorials
  • HTML & CSS Tutorials
  • Core Java Tutorial Free online
  • Linux sysadmin tutorials linux system administrator
  • apache server tutorial (install,config, performance tuning, security, error handling)

 

 

wordpress Pagespeed optimization

Digitalocean free $100 Credit

Cloudways Review pricing promo codes

Siteground cpu limits Pricing

Shared Hosting

Managed wordpress Hosting

Managed Hosting Cloud server

VPS Hosting

Cloud Hosting – Unmanaged

Google cloud Pricing

Aws Pricing

Azure pricing

nginx server tutorials

apache server tutorials

linux sysadmin tutorials

mysql Commands list pdf

LEMP Install Ubuntu

Mysql Performance Tuning

Nginx Performance tuning

Linux Performance tuning

Php -fpm performance tuning

Redis Performance tuning

linux server security

nginx security best practices

wordpress security plugins

 

 

wordpress

 

Top 5  WP Google Analytics Plugins

WP Backup Plugins

Wp Comment Plugins

Top wordpress Security Plugins

WP Seo Plugins

WP Caching Plugins

Best Adsense Plugins for WordPress

Wp social Sharing Plugins

autoshare social media plugins

WP speed Optimization Plugins

Speedup WordPress google Score

More Wp tuts

Server Admin Cloud

 

Installing Nginx LEMP On ubuntu

Installing apache Lamp ubuntu

nginx fastcgi cache enable

php – fpm install  & Configuration

Opcache install & Configure

php -fpm pool manager explained

Mysql Install & Configuration

Redis Object cache install & configure

 

Nginx as Reverse Proxy and Load balancer

Load Balance / auto scaling in google cloud

Linux Commands PDF

Mysql Commands Pdf

Letsencrypt tutorial

mysqldump export & import 

Pagespeed Module install & configure

nginx.conf best file

mysql.conf best file

upgrade ubuntu

© 2023 - All Rights Reserved Disclaimer & Privacy Policy