2021-04-11 11:25:03 +00:00
|
|
|
---
|
2022-06-15 07:51:47 +00:00
|
|
|
title: "Redis"
|
|
|
|
description: "Redis Session Configuration"
|
|
|
|
lead: "Configuring the Redis Session Storage."
|
2022-06-28 05:27:14 +00:00
|
|
|
date: 2021-04-11T21:25:03+10:00
|
2022-06-15 07:51:47 +00:00
|
|
|
draft: false
|
|
|
|
images: []
|
|
|
|
menu:
|
|
|
|
configuration:
|
|
|
|
parent: "session"
|
|
|
|
weight: 105200
|
|
|
|
toc: true
|
|
|
|
aliases:
|
|
|
|
- /docs/configuration/session/redis.html
|
2021-04-11 11:25:03 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
This is a session provider. By default Authelia uses an in-memory provider. Not configuring redis leaves Authelia
|
2022-06-15 07:51:47 +00:00
|
|
|
[stateful](../../overview/authorization/statelessness.md). It's important in highly available scenarios to configure
|
|
|
|
this option and we highly recommend it in production environments. It requires you setup [redis] as well.
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
session:
|
|
|
|
redis:
|
|
|
|
host: 127.0.0.1
|
|
|
|
port: 6379
|
|
|
|
username: authelia
|
|
|
|
password: authelia
|
|
|
|
database_index: 0
|
|
|
|
maximum_active_connections: 8
|
|
|
|
minimum_idle_connections: 0
|
|
|
|
tls:
|
|
|
|
server_name: myredis.example.com
|
|
|
|
skip_verify: false
|
|
|
|
minimum_version: TLS1.2
|
|
|
|
high_availability:
|
|
|
|
sentinel_name: mysentinel
|
2021-10-31 00:49:27 +00:00
|
|
|
# If `sentinel_username` is supplied, Authelia will connect using ACL-based
|
|
|
|
# authentication. Otherwise, it will use traditional `requirepass` auth.
|
|
|
|
sentinel_username: sentinel_user
|
2021-04-11 11:25:03 +00:00
|
|
|
sentinel_password: sentinel_specific_pass
|
|
|
|
nodes:
|
|
|
|
- host: sentinel-node1
|
|
|
|
port: 26379
|
|
|
|
- host: sentinel-node2
|
|
|
|
port: 26379
|
|
|
|
route_by_latency: false
|
|
|
|
route_randomly: false
|
|
|
|
```
|
|
|
|
|
|
|
|
## Options
|
|
|
|
|
|
|
|
### host
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" required="yes" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The [redis] host or unix socket path. If utilising an IPv6 literal address it must be enclosed by square brackets and
|
|
|
|
quoted:
|
2022-06-15 07:51:47 +00:00
|
|
|
|
2021-04-11 11:25:03 +00:00
|
|
|
```yaml
|
|
|
|
host: "[fd00:1111:2222:3333::1]"
|
|
|
|
```
|
|
|
|
|
|
|
|
### port
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="integer" default="6379" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The port [redis] is listening on.
|
|
|
|
|
|
|
|
### username
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The username for [redis authentication](https://redis.io/commands/auth). Only supported in [redis] 6.0+, and [redis]
|
|
|
|
currently offers backwards compatibility with password-only auth. You probably do not need to set this unless you went
|
|
|
|
through the process of setting up [redis ACLs](https://redis.io/topics/acl).
|
|
|
|
|
|
|
|
### password
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
2022-06-21 09:45:08 +00:00
|
|
|
*__Important Note:__ This can also be defined using a [secret](../methods/secrets.md) which is __strongly recommended__
|
|
|
|
especially for containerized deployments.*
|
|
|
|
|
2021-04-11 11:25:03 +00:00
|
|
|
The password for [redis authentication](https://redis.io/commands/auth).
|
|
|
|
|
2022-06-21 09:45:08 +00:00
|
|
|
It's __strongly recommended__ this is a
|
|
|
|
[Random Alphanumeric String](../miscellaneous/guides.md#generating-a-random-alphanumeric-string) with 64 or more
|
|
|
|
characters and the user password is changed to this value.
|
2022-06-15 07:51:47 +00:00
|
|
|
|
2021-04-11 11:25:03 +00:00
|
|
|
### database_index
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="integer" default="0" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The index number of the [redis] database, the same value as specified with the redis SELECT command.
|
|
|
|
|
|
|
|
### maximum_active_connections
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="integer" default="8" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The maximum connections open to [redis] at the same time.
|
|
|
|
|
|
|
|
### minimum_idle_connections
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="integer" default="0" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The minimum number of [redis] connections to keep open as long as they don't exceed the maximum active connections. This
|
|
|
|
is useful if there are long delays in establishing connections.
|
|
|
|
|
|
|
|
### tls
|
|
|
|
|
|
|
|
If defined enables [redis] over TLS, and additionally controls the TLS connection validation process. You can see how to
|
2022-06-15 07:51:47 +00:00
|
|
|
configure the tls section [here](../prologue/common.md#tls-configuration).
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
### high_availability
|
|
|
|
|
|
|
|
When defining this session it enables [redis sentinel] connections. It's possible in
|
|
|
|
the future we may add [redis cluster](https://redis.io/topics/cluster-tutorial).
|
|
|
|
|
|
|
|
#### sentinel_name
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" required="yes" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The [redis sentinel] master name. This is defined in your [redis sentinel] configuration, it is not a hostname. This
|
|
|
|
must be defined currently for a high availability configuration.
|
|
|
|
|
2021-10-31 00:49:27 +00:00
|
|
|
#### sentinel_username
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
2021-10-31 00:49:27 +00:00
|
|
|
The username for the [redis sentinel] connection. If this is provided, it will be used along with the sentinel_password
|
|
|
|
for ACL-based authentication to the Redis Sentinel. If only a password is provided, the [redis sentinel] connection will
|
2022-06-15 07:51:47 +00:00
|
|
|
be authenticated with traditional [requirepass] authentication.
|
2021-10-31 00:49:27 +00:00
|
|
|
|
|
|
|
#### sentinel_password
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="string" required="no (yes if sentinel_username is supplied)" >}}
|
2021-10-31 00:49:27 +00:00
|
|
|
|
2022-06-21 09:45:08 +00:00
|
|
|
*__Important Note:__ This can also be defined using a [secret](../methods/secrets.md) which is __strongly recommended__
|
|
|
|
especially for containerized deployments.*
|
|
|
|
|
2021-10-31 00:49:27 +00:00
|
|
|
The password for the [redis sentinel] connection. If specified with sentinel_username, configures Authelia to
|
2022-06-15 07:51:47 +00:00
|
|
|
authenticate to the Redis Sentinel with ACL-based authentication. Otherwise, this is used for [requirepass]
|
2021-10-31 00:49:27 +00:00
|
|
|
authentication.
|
2021-04-11 11:25:03 +00:00
|
|
|
|
2022-06-21 09:45:08 +00:00
|
|
|
It's __strongly recommended__ this is a
|
|
|
|
[Random Alphanumeric String](../miscellaneous/guides.md#generating-a-random-alphanumeric-string) with 64 or more
|
|
|
|
characters and the user password is changed to this value.
|
|
|
|
|
2021-04-11 11:25:03 +00:00
|
|
|
#### nodes
|
|
|
|
|
|
|
|
A list of [redis sentinel] nodes to load balance over. This list is added to the host in the [redis] section above. It
|
|
|
|
is required you either define the [redis] host or one [redis sentinel] node. The [redis] host must be a [redis sentinel]
|
|
|
|
host, not a regular one. The individual [redis] hosts are determined using [redis sentinel] commands.
|
|
|
|
|
|
|
|
Each node has a host and port configuration. Example:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- host: redis-sentinel-0
|
|
|
|
port: 26379
|
|
|
|
```
|
|
|
|
|
|
|
|
##### host
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="boolean" default="false" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The host of this [redis sentinel] node.
|
|
|
|
|
|
|
|
##### port
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="integer" default="26379" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
The port of this [redis sentinel] node.
|
|
|
|
|
|
|
|
#### route_by_latency
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="boolean" default="false" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
Prioritizes low latency [redis sentinel] nodes when set to true.
|
|
|
|
|
|
|
|
#### route_randomly
|
2022-06-15 07:51:47 +00:00
|
|
|
|
|
|
|
{{< confkey type="boolean" default="false" required="no" >}}
|
2021-04-11 11:25:03 +00:00
|
|
|
|
|
|
|
Randomly chooses [redis sentinel] nodes when set to true.
|
|
|
|
|
|
|
|
[redis]: https://redis.io
|
|
|
|
[redis sentinel]: https://redis.io/topics/sentinel
|
2022-06-15 07:51:47 +00:00
|
|
|
[requirepass]: https://redis.io/topics/config
|