Install Redis

Install Redis module

$ sudo apt install php-redis

Enable socket communications

$ sudo vi /etc/redis/redis.conf

In redis.conf file

port 0
unixsocket /var/run/redis/redis-server.sock
unixsocketperm 770

Redis Bug fix

Redis have a bug on loading the service. So fix the bug by editing the service file.

$ sudo vi /etc/systemd/system/redis.service

Edit the redis.service file like following.

[service]
ExecStartPost=/bin/sh -c "echo $MAINPID > /var/run/redis/redis.pid"

Reload deamon

$ sudo systemctl daemon-reload

Permission modify

$ sudo usermod -aG redis www-data
$ sudo chown -R redis:www-data /var/run/redis

Reload redis-server

$ sudo systemctl restart redis-server

Check the configuration

$ sudo redis-cli -s /var/run/redis/redis-server.sock
>monitor

If you got “OK”, settings are correct.

Last Updated on July 12, 2021 by lama-admin


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *