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
:
RedisURI
new RedisURI("localhost", 6379, 60, TimeUnit.SECONDS);
Redis Standalone
redis :// [: password@] host [: port] [/ database][? [timeout=timeout[d|h|m|s|ms|us|ns]] [&database=database]]
Redis Standalone (SSL)
rediss :// [: password@] host [: port] [/ database][? [timeout=timeout[d|h|m|s|ms|us|ns]] [&database=database]]
Redis Standalone (Unix Domain Sockets)
redis-socket :// path [?[timeout=timeout[d|h|m|s|ms|us|ns]][&database=database]]
Redis Sentinel
redis-sentinel :// [: password@] host1[: port1] [, host2[: port2]] [, hostN[: portN]] [/ database][?[timeout=timeout[d|h|m|s|ms|us|ns]] [&sentinelMasterId=sentinelMasterId] [&database=database]]
Schemes
redis
Redis Standalonerediss
Redis Standalone SSLredis-socket
Redis Standalone Unix Domain Socketredis-sentinel
Redis SentinelTimeout units
d
Daysh
Hoursm
Minutess
Secondsms
Millisecondsus
Microsecondsns
NanosecondsHint: 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.