Redis

Redis is a key-value store NoSQL database. It is primarily used because of its high read and write rates. Redis uses two columns, storing pairs of one key and one corresponding value.


Note

For this guide you should be familiar with the basic concepts of supervisord.

License

Redis is distributed under the BSD license.

Configuration

Create the folder ~/.redis/:

[isabell@stardust ~]$ mkdir ~/.redis/
[isabell@stardust ~]$

Now create the config file ~/.redis/conf with an editor of your choice and enter these settings. Replace <user> with your user name.

unixsocket /home/<user>/.redis/sock
daemonize no
port 0

Setup daemon

Use your favourite editor to create ~/etc/services.d/redis.ini with the following content:

[program:redis]
command=redis-server %(ENV_HOME)s/.redis/conf
autostart=yes
autorestart=yes

After creating the configuration, tell supervisord to refresh its configuration and start the service:

[isabell@stardust ~]$ supervisorctl reread
SERVICE: available
[isabell@stardust ~]$ supervisorctl update
SERVICE: added process group
[isabell@stardust ~]$ supervisorctl status
SERVICE                            RUNNING   pid 26020, uptime 0:03:14
[isabell@stardust ~]$

If it’s not in state RUNNING, check your configuration.

Accessing redis

Use the Unix socket ~/.redis/sock to access redis with other applications. You can also use the redis-cli client to access the Redis shell:

[isabell@stardust ~]$ redis-cli -s ~/.redis/sock
redis /home/isabell/.redis/sock>

Tested with Redis 5.0.3, Uberspace 7.2.1.0

Written by: Nico Graf <hallo@uberspace.de>