Skip to content

Configuration

Gateway flags and pg_redis settings with defaults.

Configuration is split between command-line flags on the pgredis Go gateway executable (cmd/pgredis/main.go) and database-level settings managed by PostgreSQL and the pg_redis extension (v0.1.0-rc1, schema 0.54, commit 11411411d72ab45456904cc602cefbb13b68ff25).

Gateway CLI flags

FlagDefaultDescription
-listen127.0.0.1:56379RESP listener address (Mimus assigns 6379 in standard deployments).
-pgpostgres://127.0.0.1:55432/pgredis?sslmode=disablePostgreSQL connection URL without credentials.
-auth-modenativeAuthentication mode: native (PostgreSQL roles) or redis-acl (redis._acl_user).
-acl-service-user(empty)Bound PostgreSQL LOGIN role used when -auth-mode redis-acl is active.
-acl-service-password-file(empty)File containing the ACL service role password (one trailing newline stripped); falls back to PGREDIS_ACL_SERVICE_PASSWORD.
-default-userappPostgreSQL LOGIN role used for single-argument AUTH <password> in native mode.
-client-default-resp2Initial wire protocol for new connections and RESET (2 or 3).
-max-clients1024Maximum concurrent RESP client connections.
-max-pools8Maximum cached PostgreSQL identity connection pools.
-pool-size4Maximum PostgreSQL backend connections per identity pool (1..2147483647).
-tls-cert(empty)Server TLS certificate path (required when -listen is non-loopback).
-tls-key(empty)Server TLS private key path (required when -listen is non-loopback).
-max-bulk-bytes536870912 (512 MiB)Maximum bytes for a single request bulk argument.
-max-frame-bytes1074790400 (1 GiB + 1 MiB)Maximum sum of argument bytes in a single request frame.
-max-reply-bytes1074790400 (1 GiB + 1 MiB)Maximum wire bytes for a complete reply, including EXEC child replies.
-max-input-bytes2147483648 (2 GiB)Shared budget across connections for live input payloads and bookkeeping.
-max-output-bytes2147483648 (2 GiB)Shared budget across connections for live replies, workspace, and bookkeeping.
-max-pg-read-bytes2147483648 (2 GiB)Shared budget for PostgreSQL receive buffers and DataRow metadata.
-max-pg-message-bytes1073741822 (1 GiB - 2 B)Maximum bytes in a single PostgreSQL wire message body.
-frame-read-timeout30sDeadline to finish reading a frame after its first byte arrives.
-command-timeout30sPer-command execution timeout against PostgreSQL.
-write-timeout10sDeadline for writing a reply frame to the client socket.
-tls-handshake-timeout5sDeadline for completing a client TLS handshake.
-versionfalsePrint pgredis 0.1.0 and exit.

The -pg URL must never contain a password. In native mode, clients supply their PostgreSQL role credentials via AUTH or HELLO ... AUTH. In redis-acl mode, the gateway connects with -acl-service-user and verifies per-user hashes inside redis._acl_user.

Connection pools and default protocol

  • Identity-isolated pools: The gateway isolates connection pools by database and authenticated principal (-max-pools 8, -pool-size 4). Active checkout references prevent pool eviction, and up to 4 additional short-lived connections are permitted for credential verification. Connections return to a pool only after transaction state and session state (redis._pool_reset()) are cleanly reset; any uncertain connection is closed immediately.
  • Default RESP version: -client-default-resp 3 starts new connections in RESP3 mode instead of RESP2. HELLO 2 or HELLO 3 switches the active connection protocol, AUTH preserves it, and RESET restores the gateway’s -client-default-resp default.

PostgreSQL extension GUCs

Configure these PostgreSQL GUCs in postgresql.conf (or with ALTER DATABASE ... SET as a superuser):

GUCDefaultContextDescription
pg_redis.maintenance_database'postgres'postmaster (shared_preload_libraries)Target database where the background maintenance worker reclaims expired keys and leases.
pg_redis.maintenance_role'postgres'postmaster (shared_preload_libraries)PostgreSQL role used by the background maintenance worker.
pg_redis.object_heat_trackingoffsuperuserWhen on, every key access updates LRU/LFU metadata in redis._object_heat so OBJECT IDLETIME and OBJECT FREQ report live values (causing plain reads to write WAL).
pg_redis.list_layout_trackingoffsuperuserWhen on, newly created Lists track exact Redis listpack/quicklist encoding transitions on every write.

Redis CONFIG GET and CONFIG SET

pg_redis persists selected Redis runtime settings inside PostgreSQL tables so they participate in SQL transactions, savepoints, and pg_dump backups:

ParameterDefaultBacking tableEffect
notify-keyspace-events"" (disabled)redis._configEnables keyspace (K) and keyevent (E) Pub/Sub notifications.
slowlog-log-slower-than10000 (10 ms)redis._slowlog_configMicrosecond threshold for recording entries in redis._slowlog (negative disables).
slowlog-max-len128redis._slowlog_configMaximum retained slowlog entries.
latency-tracking-info-percentiles"50 99 99.9"redis._slowlog_configSpace-separated percentile list formatted in INFO latencystats.
acllog-max-len128redis._acl_configMaximum entries retained in redis._acl_log for ACL LOG.
requirepass""redis._acl_configPassword for the Redis default ACL user (does not alter PostgreSQL LOGIN roles).
acl-pubsub-default"resetchannels"redis._acl_configDefault Pub/Sub channel policy (resetchannels or allchannels) for new ACL users and RESET.
tracking-table-max-keys1000000redis._tracking_configMaximum tracked keys in redis._tracking_key before earlier entries are evicted and invalidated.
client-output-buffer-limit"normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60"redis._output_configPer-class <hard> <soft> <seconds> output buffer limits (replica is accepted as an alias for slave).
hash-max-listpack-entries, hash-max-listpack-value, list-max-listpack-size, list-compress-depth, set-max-intset-entries, set-max-listpack-entries, set-max-listpack-value, zset-max-listpack-entries, zset-max-listpack-value, stream-node-max-bytes, stream-node-max-entriesRedis 7.2.4 defaultsredis._configThresholds used for OBJECT ENCODING reporting and approximate XTRIM node boundaries.

Client output buffer limits and route logs

  • client-output-buffer-limit accounting: normal limits apply to ordinary, MONITOR, and tracking-only connections (0 0 0 disabled by default); pubsub limits apply to subscribed connections (32 MiB hard, 8 MiB soft for 60 seconds by default). Accounting sums retained Go reply bytes plus unread rows in redis._pubsub_event or the MONITOR ring. Exceeding a hard or sustained soft limit closes the connection without sending an extra error frame.
  • Server-side route failure log: When a Pub/Sub or tracking route fails a capacity, message-count, single-message-size, or identity check, pg_redis writes a pg_redis Pub/Sub route failure decision message to the PostgreSQL server log containing the failure reason, database OID, XID, and tuple position, while omitting tokens, channel names, and payloads.
Scan to open this page
https://mimus.pgsty.com/docs/redis/reference/configuration/

Table reader