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

FieldTypeDescriptionRequired
hoststringYes
trafficPolicyTrafficPolicyNo

ConnectionPoolSettings

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

FieldTypeDescriptionRequired
tcpTCPSettingsNo
redisRedisSettingsNo

Auth

Auth provide a way to get redis auth token.

FieldTypeDescriptionRequired
secretSecretReference (oneof)

Secret use the k8s secret in current namespace.

No
plainPlainAuth (oneof)

redis password.

No

SecretReference

FieldTypeDescriptionRequired
namestringNo
passwordFieldstringNo
usernameFieldstringNo

PlainAuth

FieldTypeDescriptionRequired
passwordstringYes
usernamestringNo

RedisSettings

FieldTypeDescriptionRequired
modeModeNo
authAuthNo
discoveryEndpointsstring[]No

TrafficPolicy

FieldTypeDescriptionRequired
connectionPoolConnectionPoolSettingsNo

RedisService

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

FieldTypeDescriptionRequired
hoststring[]Yes
settingsSettingsNo
redisRoute[]Yes
faultsFault[]

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].

FieldTypeDescriptionRequired
valuedoubleNo

Fault

Fault defines redis faults used for fault injection.

FieldTypeDescriptionRequired
typeType

Fault type.

No
percentagePercent

Percentage of requests fault applies to.

No
delayDuration

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

No
commandsstring[]

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

FieldTypeDescriptionRequired
caseInsensitivebool

Indicates that prefix matching should be case insensitive.

No
opTimeoutDuration

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
enableCommandStatsbool

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

No
maxBufferSizeBeforeFlushuint32

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
bufferFlushTimeoutDuration

The encoded request buffer is flushed N milliseconds after the first request has been encoded, unless the buffer size has already exceeded maxbuffer_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
maxUpstreamUnknownConnectionsUInt32Value

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
enableHashtaggingbool

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&gt;.

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
enableRedirectionbool

Accept moved and ask redirection <https://redis.io/topics/cluster-spec#redirection-and-resharding&gt;_ 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
readPolicyReadPolicy

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

No
authAuth

Downstream auth.

No

RedisService.KeyMatch

KeyMatch match the redis key prefix;

FieldTypeDescriptionRequired
prefixstring

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

No
removePrefixbool

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

No

RedisService.RouteMatch

FieldTypeDescriptionRequired
keyKeyMatch (oneof)No

RedisService.Destination

FieldTypeDescriptionRequired
hoststringYes
portuint32No

RedisService.Mirror

FieldTypeDescriptionRequired
routeDestinationNo
percentagePercentNo
excludeReadCommandsboolNo

RedisService.Route

FieldTypeDescriptionRequired
matchRouteMatchNo
routeDestinationNo
mirrorMirror[]No

google.protobuf.UInt32Value

Wrapper message for uint32.

The JSON representation for UInt32Value is JSON number.

FieldTypeDescriptionRequired
valueuint32

The uint32 value.

No

RedisSettings.Mode

NameDescription
PROXY
CLUSTER

RedisSettings.Mode

NameDescription
PROXY
CLUSTER

RedisService.ReadPolicy

NameDescription
MASTER
PREFER_MASTER
REPLICA
PREFER_REPLICA
ANY

Fault.Type

NameDescription
DELAY

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

ERROR

Returns errors on requests.

Fault.Type

NameDescription
DELAY

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

ERROR

Returns errors on requests.

Fault.Type

NameDescription
DELAY

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

ERROR

Returns errors on requests.

RedisService.ReadPolicy

NameDescription
MASTER
PREFER_MASTER
REPLICA
PREFER_REPLICA
ANY

RedisService.ReadPolicy

NameDescription
MASTER
PREFER_MASTER
REPLICA
PREFER_REPLICA
ANY

最后修改 March 10, 2022: add reference (897f1a1)