Table of Contents

Redis

Redis is an open source (BSD licensed), in-memory data structure store used as a database, cache, message broker, and streaming engine. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.

Packages

pacman -S redis

Configuration

redis.conf

nano /etc/redis/redis.conf
port 0
unixsocket /run/redis/redis.sock
unixsocketperm 770
requirepass your-password

Add http to redis group

usermod -aG redis http

Start

systemctl enable --now redis.service

sysctl

If the error overcommit memory … occurs with systemctl status redis.service, add this to sysctl:

/etc/sysctl.d/99-sysctl.conf
vm.overcommit_memory=1

PHP

Enable redis for php.

pacman -S php-igbinary php-redis
nano /etc/php/conf.d/{igbinary.ini,redis.ini}
extension=igbinary.so
extension=redis

Check

redis-cli -s /var/run/redis/redis.sock --askpass monitor