Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Adding support for redis logical db #15034

Merged
merged 6 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added changelog.d/15034.feature
Empty file.
1 change: 1 addition & 0 deletions contrib/docker_compose_workers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ redis:
enabled: true
host: redis
port: 6379
# dbid: <redis_logical_db_id>
# password: <secret_password>
```

Expand Down
3 changes: 3 additions & 0 deletions docs/usage/configuration/config_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3927,6 +3927,8 @@ This setting has the following sub-options:
* `host` and `port`: Optional host and port to use to connect to redis. Defaults to
localhost and 6379
* `password`: Optional password if configured on the Redis instance.
* `dbid`: Optional redis dbid if needs to connect to specific redis logical db.
999lakhisidhu marked this conversation as resolved.
Show resolved Hide resolved
_Added in Synapse 1.78.0
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved

Example configuration:
```yaml
Expand All @@ -3935,6 +3937,7 @@ redis:
host: localhost
port: 6379
password: <secret_password>
dbid: <dbid>
```
---
## Individual worker configuration
Expand Down
1 change: 1 addition & 0 deletions synapse/config/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:

self.redis_host = redis_config.get("host", "localhost")
self.redis_port = redis_config.get("port", 6379)
self.redis_dbid = redis_config.get("dbid", None)
self.redis_password = redis_config.get("password")
1 change: 1 addition & 0 deletions synapse/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ def get_outbound_redis_connection(self) -> "ConnectionHandler":
hs=self,
host=self.config.redis.redis_host,
port=self.config.redis.redis_port,
dbid=self.config.redis.redis_dbid,
password=self.config.redis.redis_password,
reconnect=True,
)
Expand Down