Skip to main content

Redis

This page shows you how to create a Redis user and use Redis from your lab. Redis is a fast in-memory key-value store. It is good for caches, sessions, counters and simple queues. On this platform it is shared: you get a user with its own password and your own part of the key space, not a whole server.

1. Create a user​

  1. Go to Services and select Manage on Redis.
  2. Select Add User (or Create User if you have none yet).
  3. Fill in Username, Password and Confirm Password, then confirm.
FieldRules
Username5–16 characters: letters, digits and underscores. Not only digits, and not a reserved name.
PasswordAt least 8 characters. Single quotes (') are not allowed.

There are no databases to create. A Redis user is credentials only, which is why the Redis page has just the Dashboard tab.

2. Use your own key prefix​

Your user can read and write only keys that start with your service username followed by an underscore. Name every key that way:

alice_dev_session:42
alice_dev_cache:homepage

A key without your prefix is refused with a permissions error. Administrative and dangerous commands are also blocked, since the server is shared.

3. Connect from your lab​

Copy the Hostname and Port from Connection Information on the Dashboard tab, then:

sudo apt-get install -y redis-tools
redis-cli -h <host> -p <port> --user <user> --pass <password>
> SET <user>_greeting "hello"
OK
> GET <user>_greeting
"hello"

From code, most clients accept a URL:

redis://<user>:<password>@<host>:<port>

Always pass both the username and the password. If you pass only the password, you sign in as a different, default user, and your keys are refused.

Public access

If your platform offers Redis outside the labs, the service page shows a Public endpoint (and possibly Public TLS) row. The same user and password work there. See public endpoints.

If it does not work​

SymptomCheck
WRONGPASS or invalid username-password pairYou passed both --user and --pass, copied from the user's card
NOPERM / No permissions to access a keyThe key starts with <user>_
NOPERM on a commandThat command is blocked on the shared server

Next​