Configuration String | configurationoptions | Description |
---|---|---|
Abortconnect={bool} | Abortonconnectfail | If true, connect does not create a connection when no server is available |
Allowadmin={bool} | Allowadmin | If true, turn on some of the commands that are considered risky |
Channelprefix={string} | Channelprefix | Optional channel prefixes for all pub/sub operations |
Connectretry={int} | Connectretry | The number of connection retries when Connect is initialized |
Connecttimeout={int} | ConnectTimeout | Connection Timeout setting, time unit is MS |
Configchannel={string} | Configurationchannel | Set the broadcast channel name |
Defaultdatabase={int} | DefaultDatabase | Default database index, from 0 to databases-1 |
Keepalive={int} | KeepAlive | If there is no activity within the specified time (seconds), a message is sent to help the socket stay connected |
Name={string} | ClientName | Unique name used to identify the connection within Redis |
Password={string} | Password | Redis Server Password |
Proxy={proxy type} | Proxy | The type of proxy used (if any); such as 'Twemproxy' |
Resolvedns={bool} | Resolvedns | Specifies that DNS parsing is displayed rather than implicitly |
Servicename={string} | ServiceName | Not currently implemented |
Ssl={bool} | Ssl | Specify to use SSL encryption |
Sslhost={string} | Sslhost | Enforcing SSL host recognition requires the use of server-side certificates |
Synctimeout={int} | Synctimeout | Asynchronous timeout setting (ms) |
Tiebreaker={string} | Tiebreaker | The main is to choose between a fuzzy host as the primary server |
Version={string} | Defaultversion | Redis version level (this option is useful when the server is unavailable) |
Writebuffer={int} | WriteBuffer | The size of the output buffer |
Connect
(or ConnectAsync
):configuration
here can be either:ConfigurationOptions
instancestring
representing the configuration:
) as is usual. Configuration options include an =
after the name. For example:mymaster
service and return a managed connectionpointing to that master server that will automatically be updated if the master changes:string
and ConfigurationOptions
representation is shown below, but you can switch between them trivially:ConfigurationOptions
object has a wide range of properties, all of which are fully documented in intellisense. Some of the more common options to use include:Configuration string | ConfigurationOptions | Default | Meaning |
---|---|---|---|
abortConnect={bool} | AbortOnConnectFail | true (false on Azure) | If true, Connect will not create a connection while no servers are available |
allowAdmin={bool} | AllowAdmin | false | Enables a range of commands that are considered risky |
channelPrefix={string} | ChannelPrefix | null | Optional channel prefix for all pub/sub operations |
checkCertificateRevocation={bool} | CheckCertificateRevocation | true | A Boolean value that specifies whether the certificate revocation list is checked during authentication. |
connectRetry={int} | ConnectRetry | 3 | The number of times to repeat connect attempts during initial Connect |
connectTimeout={int} | ConnectTimeout | 5000 | Timeout (ms) for connect operations |
configChannel={string} | ConfigurationChannel | __Booksleeve_MasterChanged | Broadcast channel name for communicating configuration changes |
configCheckSeconds={int} | ConfigCheckSeconds | 60 | Time (seconds) to check configuration. This serves as a keep-alive for interactive sockets, if it is supported. |
defaultDatabase={int} | DefaultDatabase | null | Default database index, from 0 to databases - 1 |
keepAlive={int} | KeepAlive | -1 | Time (seconds) at which to send a message to help keep sockets alive (60 sec default) |
name={string} | ClientName | null | Identification for the connection within redis |
password={string} | Password | null | Password for the redis server |
user={string} | User | null | User for the redis server (for use with ACLs on redis 6 and above) |
proxy={proxy type} | Proxy | Proxy.None | Type of proxy in use (if any); for example “twemproxy” |
resolveDns={bool} | ResolveDns | false | Specifies that DNS resolution should be explicit and eager, rather than implicit |
serviceName={string} | ServiceName | null | Used for connecting to a sentinel master service |
ssl={bool} | Ssl | false | Specifies that SSL encryption should be used |
sslHost={string} | SslHost | null | Enforces a particular SSL host identity on the server’s certificate |
sslProtocols={enum} | SslProtocols | null | Ssl/Tls versions supported when using an encrypted connection. Use ‘|’ to provide multiple values. |
syncTimeout={int} | SyncTimeout | 5000 | Time (ms) to allow for synchronous operations |
asyncTimeout={int} | AsyncTimeout | SyncTimeout | Time (ms) to allow for asynchronous operations |
tiebreaker={string} | TieBreaker | __Booksleeve_TieBreak | Key to use for selecting a server in an ambiguous master scenario |
version={string} | DefaultVersion | (3.0 in Azure, else 2.0 ) | Redis version level (useful when the server does not make this available) |
CheckCertificateRevocation | true | A Boolean value that specifies whether the certificate revocation list is checked during authentication. |
IReconnectRetryPolicy
) - Default: ReconnectRetryPolicy = LinearRetry(ConnectTimeout);
=
sign are assumed to be redis server endpoints. Endpoints without an explicit port will use 6379 if ssl is not enabled, and 6380 if ssl is enabled.Tokens starting with $
are taken to represent command maps, for example: $config=cfg
.Configuration string | ConfigurationOptions | Previous Default | Previous Meaning |
---|---|---|---|
responseTimeout={int} | ResponseTimeout | SyncTimeout | Time (ms) to decide whether the socket is unhealthy |
writeBuffer={int} | WriteBuffer | 4096 | Size of the output buffer |
CommandMap
, but instead of passing a HashSet<string>
to Create()
(to indicate the available or unavailable commands), you pass a Dictionary<string,string>
. All commands not mentioned in the dictionary are assumed to be enabled and not renamed. A null
or blank value records that the command is disabled. For example:Proxy
option can be used:'__Booksleeve_TieBreak'
(always in database 0). This is used as a crude voting mechanism to help determine the preferred master, so that work is routed correctly.INFO
, CONFIG
, etc - where available). StackExchange.Redis does this by automatically subscribing to a pub/sub channel upon which such notifications may be sent. For similar reasons, this defaults to '__Booksleeve_MasterChanged'
.'
), via the .ConfigurationChannel
and .TieBreaker
configuration properties.IServer.MakeMaster()
method, which can set the tie-breaker in the database and broadcast the configuration change message. The configuration message can also be used separately to master/replica changes simply to request all nodes to refresh their configurations, via the ConnectionMultiplexer.PublishReconfigure
method.