Skip to content

Commit

Permalink
docs redis: add info on secdist for redis cluster
Browse files Browse the repository at this point in the history
6c3c928029d0ab5fd428a535ed3edc10f45047dd
  • Loading branch information
Anton3 committed May 23, 2024
1 parent f392f6b commit a78f487
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
28 changes: 21 additions & 7 deletions redis/include/userver/storages/redis/component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ namespace components {
/// # yaml
/// redis:
/// groups:
/// - config_name: taxi-tmp
/// db: taxi-tmp
/// sharding_strategy: "RedisCluster"
/// - config_name: taxi-tmp-pubsub
/// db: taxi-tmp-pubsub
/// - config_name: cats
/// db: hello_service_cats_catalogue
/// sharding_strategy: RedisCluster
/// - config_name: dogs
/// db: hello_service_dogs_catalogue
/// subscribe_groups:
/// - config_name: taxi-tmp-pubsub
/// db: taxi-tmp-pubsub
/// - config_name: food
/// db: hello_service_pet_food_orders
/// thread_pools:
/// redis_thread_pool_size: 8
/// sentinel_thread_pool_size: 1
Expand All @@ -108,6 +108,20 @@ namespace components {
/// }
/// }
/// @endcode
///
/// ## Cluster Redis setup
///
/// Redis cluster is the new recommended way of setting up Redis servers
/// with improved stability.
///
/// To start, set `sharding_strategy: RedisCluster` in the static config
/// as shown above.
///
/// Secdist configuration is simplified:
///
/// 1. `"shards"` field is ignored, you can specify an empty array there;
/// 2. `"sentinels"` field should contain some of the cluster nodes. They are
/// only used for topology discovery; it is not necessary to list all nodes.

// clang-format on
class Redis : public LoggableComponentBase {
Expand Down
4 changes: 3 additions & 1 deletion scripts/docs/en/userver/tutorial/redis_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,15 @@ implemented using the testsuite. To do that you have to:
* Prepare the pytest by importing the pytest_userver.plugins.redis plugin:
@snippet samples/redis_service/tests/conftest.py redis setup

* Add the Redis settings info to the service environment variable:
* Add the Redis Secdist settings info to the service environment variable:
@snippet samples/redis_service/tests/conftest.py service_env
The @ref pytest_userver.plugins.service_client.auto_client_deps "auto_client_deps"
fixture already knows about the redis_store fixture, so there's no need to override
the @ref pytest_userver.plugins.service_client.extra_client_deps "extra_client_deps"
fixture.

For details on Redis Secdist format, see @ref components::Redis.

* Write the test:
@snippet samples/redis_service/tests/test_redis.py Functional test

Expand Down

0 comments on commit a78f487

Please sign in to comment.