Skip to main content

Redis

Redis is a fast in-memory key-value store — 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 slice of the key space, not a whole server.

1. Create a user

  1. Go to Services and click Manage on Redis.
  2. Click 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 only read and write 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 user name and the password. Password-only authentication logs in as a different, default user and your keys will be 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