-
Notifications
You must be signed in to change notification settings - Fork 979
Redis URI and connection details
Connections to a Redis Standalone, Sentinel, or Cluster require a
specification of the connection details. The unified form is RedisURI
.
You can provide the database, password and timeouts within the
RedisURI
. You have following possibilities to create a RedisURI
:
-
Use an URI:
RedisURI.create("redis://localhost/");
-
Use the Builder
RedisURI.Builder.redis("localhost", 6379).auth("password").database(1).build();
-
Set directly the values in
RedisURI
new RedisURI("localhost", 6379, 60, TimeUnit.SECONDS);
Redis Standalone
redis :// [[username :] password@] host [:port][/database]
[?[timeout=timeout[d|h|m|s|ms|us|ns]] [&clientName=clientName]
[&libraryName=libraryName] [&libraryVersion=libraryVersion] ]
Redis Standalone (SSL)
rediss :// [[username :] password@] host [: port][/database]
[?[timeout=timeout[d|h|m|s|ms|us|ns]] [&clientName=clientName]
[&libraryName=libraryName] [&libraryVersion=libraryVersion] ]
Redis Standalone (Unix Domain Sockets)
redis-socket :// [[username :] password@]path
[?[timeout=timeout[d|h|m|s|ms|us|ns]] [&database=database]
[&clientName=clientName] [&libraryName=libraryName]
[&libraryVersion=libraryVersion] ]
Redis Sentinel
redis-sentinel :// [[username :] password@] host1[:port1] [, host2[:port2]] [, hostN[:portN]] [/database]
[?[timeout=timeout[d|h|m|s|ms|us|ns]] [&sentinelMasterId=sentinelMasterId]
[&clientName=clientName] [&libraryName=libraryName]
[&libraryVersion=libraryVersion] ]
Schemes
-
redis
Redis Standalone -
rediss
Redis Standalone SSL -
redis-socket
Redis Standalone Unix Domain Socket -
redis-sentinel
Redis Sentinel
Timeout units
-
d
Days -
h
Hours -
m
Minutes -
s
Seconds -
ms
Milliseconds -
us
Microseconds -
ns
Nanoseconds
Hint: The database parameter within the query part has higher precedence than the database in the path.
RedisURI supports Redis Standalone, Redis Sentinel and Redis Cluster with plain, SSL, TLS and unix domain socket connections.
Hint: The database parameter within the query part has higher precedence than the database in the path. RedisURI supports Redis Standalone, Redis Sentinel and Redis Cluster with plain, SSL, TLS and unix domain socket connections.
Redis URIs may contain authentication details that effectively lead to usernames with passwords, password-only, or no authentication. Connections are authenticated by using the information provided through RedisCredentials
. Credentials are obtained at connection time from RedisCredentialsProvider
. When configuring username/password on the URI statically, then a StaticCredentialsProvider
holds the configured information.
Notes
-
When using Redis Sentinel, the password from the URI applies to the data nodes only. Sentinel authentication must be configured for each sentinel node.
-
Usernames are supported as of Redis 6.
-
Library name and library version are automatically set on Redis 7.2 or greater.
Lettuce documentation was moved to https://redis.github.io/lettuce/overview/
Intro
Getting started
- Getting started
- Redis URI and connection details
- Basic usage
- Asynchronous API
- Reactive API
- Publish/Subscribe
- Transactions/Multi
- Scripting and Functions
- Redis Command Interfaces
- FAQ
HA and Sharding
Advanced usage
- Configuring Client resources
- Client Options
- Dynamic Command Interfaces
- SSL Connections
- Native Transports
- Unix Domain Sockets
- Streaming API
- Events
- Command Latency Metrics
- Tracing
- Stateful Connections
- Pipelining/Flushing
- Connection Pooling
- Graal Native Image
- Custom commands
Integration and Extension
Internals