Skip to content

Valkey / Redis

We provide Valkey, an in-memory key-value store commonly used for caches, sessions, and queues. Valkey supports the Redis protocol, so applications using Redis clients can connect to it. Check your application's requirements if it needs features specific to newer Redis versions or additional modules.

The valkey-server and valkey-cli commands are already installed. The compatibility names redis-server and redis-cli point to the same programs. You create and manage your own instance as a systemd user service.

Configuration

Create a private directory for the configuration, socket, and data:

[isabell@moondust ~]$ mkdir -m 700 ~/.valkey

This command produces no output on success.

Create ~/.valkey/valkey.conf with the following content, replacing isabell with your username:

unixsocket /home/isabell/.valkey/valkey.sock
daemonize no
port 0
save ""

This configuration accepts connections through a Unix socket. The private ~/.valkey/ directory restricts access to your user. TCP is disabled by port 0; no web backend or externally accessible port is needed. The server stays in the foreground so systemd can manage it, and logs go to your journal.

This configuration is intended for a disposable cache. With save "" and append-only persistence disabled by default, cached data is lost when the service stops. Use this only when your application can rebuild all stored data. For persistent storage, see the Valkey persistence documentation.

Add the service

Use uberspace service add to create, start, and enable the service so it also starts after a reboot. Example output (abbreviated):

[isabell@moondust ~]$ uberspace service add valkey "valkey-server /home/${USER}/.valkey/valkey.conf" --workdir "/home/${USER}/.valkey"
OK: Created service file: /home/isabell/.config/systemd/user/valkey.service
OK: systemctl --user daemon-reload
OK: systemctl --user start valkey.service
OK: systemctl --user enable valkey.service
OK: systemctl --user status valkey.service
...
     Active: active (running)
...

Connect

Check that the service responds through its socket. Example output:

[isabell@moondust ~]$ valkey-cli -s ~/.valkey/valkey.sock PING
PONG

You can store, read, and delete a test value. Example output:

[isabell@moondust ~]$ valkey-cli -s ~/.valkey/valkey.sock SET manual:example "Hello from Valkey"
OK
[isabell@moondust ~]$ valkey-cli -s ~/.valkey/valkey.sock GET manual:example
"Hello from Valkey"
[isabell@moondust ~]$ valkey-cli -s ~/.valkey/valkey.sock DEL manual:example
(integer) 1

redis-cli accepts the same arguments. Always specify the socket with -s; without it, the client tries a TCP connection.

Application settings

Choose your application's Redis connection option and configure a Unix socket:

Setting Value
Socket path /home/isabell/.valkey/valkey.sock (replace isabell with your username)
Username / password Leave unset; this setup uses filesystem permissions
Database number 0, unless your application requires a different number

Use the absolute socket path; applications do not necessarily expand ~ or shell variables. The setting may be called socket, unix_socket_path, or appear in the application's Redis host field. Follow the application's documentation for the exact syntax. For an application-specific example, see WordPress caching in the Lab. That guide uses its own socket path; use the path belonging to the instance you configured.

Manage the service

Check whether the service is running. Example output:

[isabell@moondust ~]$ systemctl --user is-active valkey.service
active

After editing ~/.valkey/valkey.conf, restart the service:

[isabell@moondust ~]$ systemctl --user restart valkey.service

This command produces no output on success. Run the PING check above again to verify the connection.

If startup or a connection fails, inspect the service's logs. Example output (abbreviated):

[isabell@moondust ~]$ journalctl --user -u valkey.service -n 20 --no-pager
...
Oct 09 12:00:00 moondust.uberspace.de valkey-server[12345]: ... Ready to accept connections unix

Check that the socket path matches your configuration and that the directory belongs to your user. If an application tries to connect to 127.0.0.1:6379, configure it to use the Unix socket instead.

Remove the service

To stop, disable, and remove the service, use the following command. Example output:

[isabell@moondust ~]$ uberspace service del valkey
OK: systemctl --user stop valkey.service
OK: systemctl --user disable valkey.service
OK: Deleted service file: /home/isabell/.config/systemd/user/valkey.service
OK: systemctl --user daemon-reload

Your configuration in ~/.valkey/ remains in place.