Redis Configuration

Configuration for Redis traffic rules.

RedisDestination defines policies that apply to redis traffic intended for a redis service

RedisDestination

RedisDestination defines policies that apply to redis traffic intended for a redis service

Field Type Description Required
host string Yes
trafficPolicy TrafficPolicy No

ConnectionPoolSettings

Connection pool settings for an upstream host. The settings apply to each individual host in the upstream service.

Field Type Description Required
tcp TCPSettings No
redis RedisSettings No

Auth

Auth provide a way to get redis auth token.

Field Type Description Required
secret SecretReference (oneof)

Secret use the k8s secret in current namespace.

No
plain PlainAuth (oneof)

redis password.

No

SecretReference

Field Type Description Required
name string No
passwordField string No
usernameField string No

PlainAuth

Field Type Description Required
password string Yes
username string No

RedisSettings

Field Type Description Required
mode Mode No
auth Auth No
discoveryEndpoints string[] No

TrafficPolicy

Field Type Description Required
connectionPool ConnectionPoolSettings No

RedisService

RedisService provide a way to config redis service in service mesh.

Field Type Description Required
host string[] Yes
settings Settings No
redis Route[] Yes
faults Fault[]

List of faults to inject. Faults currently come in two flavors: - Delay, which delays a request. - Error, which responds to a request with an error. Errors can also have delays attached.

No

Percent

Percent specifies a percentage in the range of [0.0, 100.0].

Field Type Description Required
value double No

Fault

Fault defines redis faults used for fault injection.

Field Type Description Required
type Type

Fault type.

No
percentage Percent

Percentage of requests fault applies to.

No
delay Duration

Delay for all faults. If not set, defaults to zero

No
commands string[]

Commands fault is restricted to, if any. If not set, fault applies to all commands other than auth and ping (due to special handling of those commands in Envoy).

No

RedisService.Settings

Field Type Description Required
caseInsensitive bool

Indicates that prefix matching should be case insensitive.

No
opTimeout Duration

Per-operation timeout in milliseconds. The timer starts when the first command of a pipeline is written to the backend connection. Each response received from Redis resets the timer since it signifies that the next command is being processed by the backend. The only exception to this behavior is when a connection to a backend is not yet established. In that case, the connect timeout on the cluster will govern the timeout until the connection is ready.

No
enableCommandStats bool

Enable per-command statistics per upstream cluster, in addition to the filter level aggregate count

No
maxBufferSizeBeforeFlush uint32

Maximum size of encoded request buffer before flush is triggered and encoded requests are sent upstream. If this is unset, the buffer flushes whenever it receives data and performs no batching. This feature makes it possible for multiple clients to send requests to Envoy and have them batched- for example if one is running several worker processes, each with its own Redis connection. There is no benefit to using this with a single downstream process. Recommended size (if enabled) is 1024 bytes.

No
bufferFlushTimeout Duration

The encoded request buffer is flushed N milliseconds after the first request has been encoded, unless the buffer size has already exceeded max_buffer_size_before_flush. If max_buffer_size_before_flush is not set, this flush timer is not used. Otherwise, the timer should be set according to the number of clients, overall request rate and desired maximum latency for a single command. For example, if there are many requests being batched together at a high rate, the buffer will likely be filled before the timer fires. Alternatively, if the request rate is lower the buffer will not be filled as often before the timer fires. If max_buffer_size_before_flush is set, but buffer_flush_timeout is not, the latter defaults to 3ms.

No
maxUpstreamUnknownConnections UInt32Value

max_upstream_unknown_connections controls how many upstream connections to unknown hosts can be created at any given time by any given worker thread (see enable_redirection for more details). If the host is unknown and a connection cannot be created due to enforcing this limit, then redirection will fail and the original redirection error will be passed downstream unchanged. This limit defaults to 100.

No
enableHashtagging bool

Use hash tagging on every redis key to guarantee that keys with the same hash tag will be forwarded to the same upstream. The hash key used for determining the upstream in a consistent hash ring configuration will be computed from the hash tagged key instead of the whole key. The algorithm used to compute the hash tag is identical to the redis-cluster implementation <https://redis.io/topics/cluster-spec#keys-hash-tags>_.

Examples:

  • ’{user1000}.following’ and ‘{user1000}.followers’ will be sent to the same upstream
  • ’{user1000}.following’ and ‘{user1001}.following’ might be sent to the same upstream
No
enableRedirection bool

Accept moved and ask redirection <https://redis.io/topics/cluster-spec#redirection-and-resharding>_ errors from upstream redis servers, and retry commands to the specified target server. The target server does not need to be known to the cluster manager. If the command cannot be redirected, then the original error is passed downstream unchanged. By default, this support is not enabled.

No
readPolicy ReadPolicy

Read policy. The default is to read from the primary.

No
auth Auth

Downstream auth.

No

RedisService.KeyMatch

KeyMatch match the redis key prefix;

Field Type Description Required
prefix string

String prefix that must match the beginning of the keys. Envoy will always favor the longest match.

No
removePrefix bool

Indicates if the prefix needs to be removed from the key when forwarded.

No

RedisService.RouteMatch

Field Type Description Required
key KeyMatch (oneof) No

RedisService.Destination

Field Type Description Required
host string Yes
port uint32 No

RedisService.Mirror

Field Type Description Required
route Destination No
percentage Percent No
excludeReadCommands bool No

RedisService.Route

Field Type Description Required
match RouteMatch No
route Destination No
mirror Mirror[] No

google.protobuf.UInt32Value

Wrapper message for uint32.

The JSON representation for UInt32Value is JSON number.

Field Type Description Required
value uint32

The uint32 value.

No

RedisSettings.Mode

Name Description
PROXY
CLUSTER

RedisSettings.Mode

Name Description
PROXY
CLUSTER

RedisService.ReadPolicy

Name Description
MASTER
PREFER_MASTER
REPLICA
PREFER_REPLICA
ANY

Fault.Type

Name Description
DELAY

Delays requests. This is the base fault; other faults can have delays added.

ERROR

Returns errors on requests.

Fault.Type

Name Description
DELAY

Delays requests. This is the base fault; other faults can have delays added.

ERROR

Returns errors on requests.

Fault.Type

Name Description
DELAY

Delays requests. This is the base fault; other faults can have delays added.

ERROR

Returns errors on requests.

RedisService.ReadPolicy

Name Description
MASTER
PREFER_MASTER
REPLICA
PREFER_REPLICA
ANY

RedisService.ReadPolicy

Name Description
MASTER
PREFER_MASTER
REPLICA
PREFER_REPLICA
ANY

最后修改 September 19, 2022: release 1.2.0 (433e12f)