sudo apt update
sudo apt install redis-server
OR
sudo apt-get update
sudo apt-get install build-essential tcl
curl -O http://download.redis.io/redis-stable.tar.gz # or wget http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
cd redis-stable
make
make test
sudo make install
Update redis config, allow manage Redis as a service
===================================================
sudo nano /etc/redis/redis.conf
supervised systemd
Configuring a Redis Password
============================
sudo nano /etc/redis/redis.conf
requirepass <password>
Reload the redis service to adapt the new changes made on the configuration file.
sudo systemctl reload redis
Validate Status
===============
sudo systemctl status redis
Stop\Start Redis
================
/etc/init.d/redis-server stop
/etc/init.d/redis-server start
OR
sudo service redis-server start
sudo service redis-server stop
sudo service redis-server restart
OR
sudo systemctl restart redis
running the server manually with config
/usr/bin/redis-server /etc/redis/redis.conf
Test the Redis Instance Functionality
=====================================
redis-cli ping
OR
redis-cli -a <password> ping
OR
it should answer with PONG, but in some cases it can answer with "LOADING Redis is loading the dataset in memory"
How to fix "LOADING Redis is loading the dataset in memory"?
1) sudo service redis-server stop
2) delete redis dump and temp files from /var/lib/redis/
3) /etc/init.d/redis-server start
Uninstall redis
sudo apt-get --purge remove redis-server
sudo rm -rf /etc/redis/dump.rdb
How to flush Redis cache and delete everything using the CLI?
redis-cli flushall
sudo apt install redis-server
OR
sudo apt-get update
sudo apt-get install build-essential tcl
curl -O http://download.redis.io/redis-stable.tar.gz # or wget http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
cd redis-stable
make
make test
sudo make install
Update redis config, allow manage Redis as a service
===================================================
sudo nano /etc/redis/redis.conf
supervised systemd
Configuring a Redis Password
============================
sudo nano /etc/redis/redis.conf
requirepass <password>
Reload the redis service to adapt the new changes made on the configuration file.
sudo systemctl reload redis
Validate Status
===============
sudo systemctl status redis
Stop\Start Redis
================
/etc/init.d/redis-server stop
/etc/init.d/redis-server start
OR
sudo service redis-server start
sudo service redis-server stop
sudo service redis-server restart
OR
sudo systemctl restart redis
running the server manually with config
/usr/bin/redis-server /etc/redis/redis.conf
Test the Redis Instance Functionality
=====================================
redis-cli ping
OR
redis-cli -a <password> ping
OR
redis-cli -h redis15.localnet.org -p 6390 ping
it should answer with PONG, but in some cases it can answer with "LOADING Redis is loading the dataset in memory"
How to fix "LOADING Redis is loading the dataset in memory"?
1) sudo service redis-server stop
2) delete redis dump and temp files from /var/lib/redis/
3) /etc/init.d/redis-server start
Uninstall redis
sudo apt-get --purge remove redis-server
sudo rm -rf /etc/redis/dump.rdb
How to flush Redis cache and delete everything using the CLI?
redis-cli flushall
How to Browse/View The Values Stored in Redis?
Redis Commander allow web view of redis DB
Install it using
npm install -g redis-commander
Activate the web-server using
redis-commander --redis-password <Password>
Solve Redis Errors
Problem 1
PHP Fatal error: Uncaught RedisException: MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
Solution
nano /etc/redis/redis.conf
On redis.conf
line ~235
let's try to change config like this
- stop-writes-on-bgsave-error yes
+ stop-writes-on-bgsave-error no
Problem 2
# WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
# WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
Solution
sudo nano /etc/sysctl.conf
# Add at the bottom of file
vm.overcommit_memory = 1
net.core.somaxconn=1024
Now for these configs to work, you need to reload the config
sudo sysctl -p
Problem 3
# 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 never > /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.
Solution
sudo nano /etc/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi