diff options
author | 999lakhisidhu <42063995+999lakhisidhu@users.noreply.github.com> | 2023-02-15 16:39:31 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-15 07:39:31 -0500 |
commit | 27a3a72a50cb24f25e48fad1e6e79aba2cd1bea2 (patch) | |
tree | e640256d7a26f03bcec1a7bbbf8711ecebb54f49 | |
parent | Update the error code for duplicate annotation (#15075) (diff) | |
download | synapse-27a3a72a50cb24f25e48fad1e6e79aba2cd1bea2.tar.xz |
Support for selecting the Redis logical database. (#15034)
Note that this is only used for key-value store (cached values) and not for the pub/sub replication used by Synapse.
-rw-r--r-- | changelog.d/15034.feature | 1 | ||||
-rw-r--r-- | contrib/docker_compose_workers/README.md | 1 | ||||
-rw-r--r-- | docs/usage/configuration/config_documentation.md | 4 | ||||
-rw-r--r-- | synapse/config/redis.py | 1 | ||||
-rw-r--r-- | synapse/server.py | 1 |
5 files changed, 8 insertions, 0 deletions
diff --git a/changelog.d/15034.feature b/changelog.d/15034.feature new file mode 100644 index 0000000000..34f320da92 --- /dev/null +++ b/changelog.d/15034.feature @@ -0,0 +1 @@ +Allow Synapse to use a specific Redis [logical database](https://redis.io/commands/select/) in worker-mode deployments. diff --git a/contrib/docker_compose_workers/README.md b/contrib/docker_compose_workers/README.md index bdd3dd32e0..d3cdfe5614 100644 --- a/contrib/docker_compose_workers/README.md +++ b/contrib/docker_compose_workers/README.md @@ -68,6 +68,7 @@ redis: enabled: true host: redis port: 6379 + # dbid: <redis_logical_db_id> # password: <secret_password> ``` diff --git a/docs/usage/configuration/config_documentation.md b/docs/usage/configuration/config_documentation.md index 2883f76a26..75483bfb12 100644 --- a/docs/usage/configuration/config_documentation.md +++ b/docs/usage/configuration/config_documentation.md @@ -3927,6 +3927,9 @@ 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. + + _Added in Synapse 1.78.0._ Example configuration: ```yaml @@ -3935,6 +3938,7 @@ redis: host: localhost port: 6379 password: <secret_password> + dbid: <dbid> ``` --- ## Individual worker configuration diff --git a/synapse/config/redis.py b/synapse/config/redis.py index b42dd2e93a..e6a75be434 100644 --- a/synapse/config/redis.py +++ b/synapse/config/redis.py @@ -33,4 +33,5 @@ class RedisConfig(Config): 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") diff --git a/synapse/server.py b/synapse/server.py index efc6b5f895..e5a3475247 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -827,6 +827,7 @@ class HomeServer(metaclass=abc.ABCMeta): 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, ) |