RedisCluster.Configuration (redis_cluster v0.8.0)
View SourceA struct to hold the configuration for working with a Redis cluster.
SSL Support
SSL/TLS connections can be enabled by setting ssl: true and providing
SSL options via ssl_opts. The SSL options are passed directly to Redix
as socket options.
Common SSL options include:
verify: :verify_peer- Enable certificate verificationcacertfile: path- Path to CA certificate filecertfile: path- Path to client certificate filekeyfile: path- Path to client private key fileserver_name_indication: 'hostname'- SNI hostname for verification
Example configuration with SSL:
config :my_app, MyApp.RedisCluster,
host: "my-redis-cluster.example.com",
port: 6379,
pool_size: 10,
ssl: true,
ssl_opts: [
verify: :verify_peer,
cacertfile: "/path/to/ca.crt"
]
Summary
Functions
A convenience function to create a configuration struct from application environment.
Types
@type t() :: %RedisCluster.Configuration{ cluster: atom(), host: String.t(), name: atom(), pool: atom(), pool_size: non_neg_integer(), port: non_neg_integer(), redis_module: module(), registry: atom(), shard_discovery: atom(), ssl: boolean(), ssl_opts: keyword() }
A struct representing the configuration for a Redis cluster.
The key elements are the host, port, and pool size. The other fields are used to uniquely identify different processes.
Fields:
host- Redis cluster endpoint hostnameport- Redis cluster endpoint portpool_size- Number of connections per Redis nodessl- Enable SSL/TLS connections (default: false)ssl_opts- SSL options passed to Redix socket_opts (default: [])redis_module- Module used for Redis connections (default: Redix)- Other fields are process identifiers for internal use
Functions
A convenience function to create a configuration struct from application environment.
This is intended for the RedisCluster module.
If you create your own config struct, then do so directly using struct syntax:
%RedisCluster.Configuration{
host: "localhost",
port: 6379,
name: MyApp.RedisCluster,
registry: MyApp.RedisCluster.Registry,
cluster: MyApp.RedisCluster.Cluster,
pool: MyApp.RedisCluster.Pool,
shard_discovery: MyApp.RedisCluster.ShardDiscovery,
pool_size: 10,
ssl: false,
ssl_opts: []
}