前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >redis url 格式

redis url 格式

作者头像
马哥Python
发布2019-06-27 17:05:24
9.2K0
发布2019-06-27 17:05:24
举报
文章被收录于专栏:快乐学Python快乐学Python

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:

  1. Use an URI: RedisURI.create("redis://localhost/");
  2. Use the Builder RedisURI.Builder.redis("localhost", 6379).auth("password").database(1).build();
  3. Set directly the values in RedisURI new RedisURI("localhost", 6379, 60, TimeUnit.SECONDS);

URI syntax

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019.05.21 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • URI syntax
相关产品与服务
云数据库 Redis
腾讯云数据库 Redis(TencentDB for Redis)是腾讯云打造的兼容 Redis 协议的缓存和存储服务。丰富的数据结构能帮助您完成不同类型的业务场景开发。支持主从热备,提供自动容灾切换、数据备份、故障迁移、实例监控、在线扩容、数据回档等全套的数据库服务。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档