Create Redis via ApplicationΒΆ
You can create many Redis instances for your Application
.
PrerequisitesΒΆ
Warning
It is not possible to share Redis instances between teams.
Enable Redis in your manifestΒΆ
The above snippet will allow your application to use the sessions
Redis instance, and provide the application with credentials for a
read/write user. In addition, the application will get credentials for
a read-only user for the lookup
instance. See the manifest
reference for other
options for access
.
The default Redis created by NAIS looks like this:
apiVersion: aiven.io/v1alpha1
kind: Redis
metadata:
labels:
app: redis-tester
team: myteam
name: redis-myteam-sessions
namespace: myteam
spec:
plan: startup-4
project: nav-dev
If all you need is a Redis instance for one application using just the default settings, this is all you need. If you want to share a Redis instance across applications, or want to change configuration away from the defaults, please read the section on explicitly creating Redis instances.
For each Redis instance, your application will receive three environment variables. The environment variables use a fixed prefix, and the instance name uppercased as a suffix.
Key | Value |
---|---|
REDIS_URI_<InstanceName> |
The URI for the instance |
REDIS_HOST_<InstanceName> |
The host for the instance |
REDIS_PORT_<InstanceName> |
The port for the instance |
REDIS_USERNAME_<InstanceName> |
The username to use when connecting. |
REDIS_PASSWORD_<InstanceName> |
The password to use when connecting. |