Ниже показан английский оригинал.
Server
The server reports the host and port a client dials, with the scheme, credentials, database and query stripped.
A broker registered with with_broker_labeled is a server of the document, under its label.
Its protocol is redis.
Its host is the host:port of a standalone URL, or the first seed of a cluster or a sentinel list.
A redis:// or rediss:// scheme, a user:password@, a /2 database and a ? query stay out of it.
An address without a port reports the topology's default, 6379, or 26379 for a sentinel.
A broker built with from_pool reports no host at all.
Its address sits inside the pool's own config, and an empty host would read as an address to dial.
A password set with credentials never reaches the document either.
Example
The broker's URL carries a password and a database.
Its server in the document is redis.internal:6379 with the protocol redis.
- Macros
- Manual
/// The server at `redis.internal`, database 2, logged in with a password in the URL.
fn broker(password: &str) -> RedisBroker {
RedisBroker::standalone(format!("redis://worker:{password}@redis.internal:6379/2"))
}
/// The server at `redis.internal`, database 2, logged in with a password in the URL.
fn broker(password: &str) -> RedisBroker {
RedisBroker::standalone(format!("redis://worker:{password}@redis.internal:6379/2"))
}