文档/Redis
此页面尚未翻译,当前显示英文版本。 查看英文版本
Redis
In-memory key-value database.
At a glance
- Category — Key-value
- Query language — Redis commands
- Default port — 6379
- URI scheme —
redis
Redis key-value driver for DBFlux, built on the redis crate.
Features
- Key-value driver classified as
DatabaseCategory::KeyValuewith theRedisCommandsquery language; the editor uses Redis command syntax, not SQL. - Connection modes: manual (host/port/user/password/database) and URI mode. URI mode accepts
redis://andrediss://connection strings. - Multiple logical databases via
SELECT <db>(MULTIPLE_DATABASES). The active database index is tracked on the connection. - Authentication with optional username + password (
AUTHENTICATION). - Reports its client identity to the server via
CLIENT SETNAMEon connect (dbflux/<version>, visible inCLIENT LIST); best-effort, since some managed providers restrictCLIENTcommands. - TLS/SSL with three modes (
off,on,verify):off— plainredis://connection.on—rediss://with the certificate trusted without chain validation (insecure marker).verify—rediss://with a supplied root certificate and optional client certificate/key, built throughClient::build_with_tls.
- SSH tunnel support for reaching Redis through a bastion host (manual mode only; see Limitations).
- Deployment topology can be detected automatically or set explicitly (
standalone,cluster,sentinel):- Automatic detection probes
ROLEandINFO clusterat connect time and routes to standalone or Cluster handling. clusterskips detection and connects directly viaClusterClient, using the primary host/port plus any configured additional seed nodes. A Cluster connection only ever exposes database 0; a nonzero database on a Cluster profile is rejected at connect time instead of being silently applied to db 0.sentinelconnects throughSentinelClient, resolving the named master from one or more Sentinel nodes (primary host/port plus any configured additional nodes). After resolving, the driver runsCLIENT SETNAME,PING, and aROLEsanity check that the resolved node is actually a master.- Sentinel failover recovery: a connection-class failure (dropped connection, IO error) on a Sentinel-backed connection triggers exactly one re-resolve through Sentinel and one retry of the failed command before the error is surfaced.
- Automatic detection probes
- Key browsing and discovery:
- Cursor-based key scanning (
KV_SCAN,PaginationStyle::Cursor). On a Cluster connection, a plainSCANhas no single-node meaning, so the driver fans it out across every master: the page budget is split evenly across masters still pending, each node’s cursor is tracked independently, and the aggregated cursor round-trips as an opaque JSON object mapping"<host>:<port>"to its pendingSCANcursor. The overall scan is exhausted once every master reports cursor 0. - Per-key type discovery (
KV_KEY_TYPES) across string, hash, list, set, sorted set, and stream. - TTL inspection (
KV_TTL) and value size reporting (KV_VALUE_SIZE). - Existence checks (
KV_GET/KV_EXISTS), key rename (KV_RENAME), and bulk get of multiple keys (KV_BULK_GET).
- Cursor-based key scanning (
- Value type coverage: strings, hashes, lists, sets, sorted sets, and streams, including stream range reads, stream entry add, and stream entry delete (
KV_STREAM_RANGE,KV_STREAM_ADD,KV_STREAM_DELETE). - Configurable stream preview limit exposed as a connection setting.
- Mutations: insert, update, delete, batch operations, and bulk delete. The
RedisCommandGeneratoremits Redis commands for set/delete, hash set/delete, list push/set/remove, set add/remove, sorted-set add/remove, and stream add/delete, for use in previews and copy-as-command. - JSON export of results (
EXPORT_JSON). - Size gate on whole-payload reads: when the request carries a byte budget, string/JSON values are probed with
STRLENbeforeGETand oversized values return a placeholder with the real size instead of transferring the payload; collection types are unaffected, and stream reads that hit the fetch cap report themselves as truncated.
Schema introspection reports a single aggregated db0 keyspace on a Cluster connection: the key count and average TTL are summed/averaged across every master’s DBSIZE/keyspace stats rather than reported per-node.
Instance Metrics
Exposes a curated set of live server metrics sourced from the INFO command output. Not available on a Cluster connection — there is no single node to sample INFO against, so instance_catalog() returns None and Instance Overview/metrics/inspectors are unavailable for Cluster profiles.
redis.connected_clients— currently connected clientsredis.blocked_clients— clients waiting on a blocking commandredis.used_memory— bytes allocated by Redis allocatorredis.used_memory_rss— bytes allocated by the OS (resident set size)redis.total_commands_processed— cumulative commands processedredis.total_connections_received— cumulative connections acceptedredis.instantaneous_ops_per_sec— commands processed per second (server-side rate)redis.keyspace_hits— cache hits against key lookupsredis.keyspace_misses— cache misses against key lookupsredis.evicted_keys— keys evicted due tomaxmemorypolicyredis.expired_keys— keys expired by TTLredis.rdb_changes_since_last_save— changes since last RDB snapshotredis.connected_slaves— attached replica count
Each metric is returned as a single (timestamp_ms, value) row for live charting.
Instance Inspector
Exposes tabular snapshots of running server state:
redis.client_list— active clients fromCLIENT LIST(id, cmd, age, idle, flags, db, sub, multi)
Sensitive fields (addr, laddr, name) are redacted to [redacted] to avoid exposing client IP addresses and hostnames.
Limitations
-
SQL is not supported; queries must be written as Redis commands.
-
Instance metrics return a single data point per call (current snapshot from
INFO), not a historical time series. Cumulative counters (e.g.redis.total_commands_processed) grow monotonically — interpret them as deltas between samples rather than absolute rates. -
The
CLIENT LISTinspector redacts theaddr,laddr, andnamefields in every row to avoid exposing client IP addresses and user-supplied names to the UI. -
Query cancellation is not supported (
QUERY_CANCELLATIONis not set); long-running commands cannot be aborted from the UI. -
No upsert (
supports_upsert: false), noRETURNING, and no bulk update (supports_bulk_update: false). -
DDL capabilities are all disabled (no tables, views, indexes, schemas) — this is a key-value store, not relational.
-
Transactions are advertised at the capability level (
supports_transactions: true) but without isolation levels, savepoints, nested transactions, read-only, or deferrable support. -
Pub/Sub is not exposed (
PUBSUBcapability is not set). -
SSH tunneling is not available when URI mode is enabled; the tunnel path is wired only for manual connection mode. Combining an SSH tunnel with Cluster or Sentinel additional seed nodes is not supported: the tunnel forwards only the primary host/port, so additional nodes are unreachable through it.
-
Stream consumer groups are not modeled; only range reads, entry add, and entry delete are supported.
-
Sentinel and Cluster additional seed nodes are always contacted over plain
redis://; per-node TLS configuration for those extra nodes is not supported. The resolved Sentinel master connection itself is also plain (no TLS) in this iteration. -
Sentinel authentication applies only to the resolved master connection (via the configured username/password); the Sentinel nodes themselves are contacted without authentication.