Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


Redis

Redis is a software project that implements data structure servers. It is open-source, networked, in memory, and stores keys with optional durability.

Reference(s)

Table of contents


Install

Install Redis:

# emerge -a dev-db/redis
# pacman -S redis
# apt install redis
# yum install redis
# dnf install redis

Config

Configure Redis:

# vi /etc/redis.conf
    > ...
    >
    > bind 127.0.0.1 # make sure this line is not commented, unless you want
    >                # your Redis instance to listen to all interfaces
    > ...
    >
    > # Accept connections on the specified port, default is 6379 (IANA #815344).
    > # If port 0 is specified Redis will not listen on a TCP socket.
    > port 0
    >
    > ...
    >
    > # Unix socket.
    > #
    > # Specify the path for the Unix socket that will be used to listen for
    > # incoming connections. There is no default, so Redis will not listen
    > # on a unix socket when not specified.
    > #
    > # unixsocket /tmp/redis.sock
    > # unixsocketperm 700
    >
    > # Enable and update the Redis socket path:
    > unixsocket /run/redis/redis.sock
    > # Set permission to all members of the redis user group:
    > unixsocketperm 770
    > ...

Add Redis to the init system:

# rc-update add redis default
# ln -s /etc/runit/sv/redis /run/runit/service/
# chkconfig redis on
# systemctl enable redis

Give Redis the good group membership:

# usermod -a -G nginx redis # add redis to the nginx group

Special config with dhcpcd

If, you are using dhcpcd instead of netifrc, then you need to config Redis accordingly:

# vi /etc/conf.d/redis
    > ...
    > rc_need="net"

# vi /etc/conf.d/redis-sentinel
    > ...
    > rc_need="net"

And restart the Redis service:

# rc-service redis restart
# sv restart redis
# service redis restart
# systemctl restart redis

Use

Update procedure

TODO

Troubleshooting


If this cheat sheet has been useful to you, then please consider leaving a star here.