If you want to use Redis storage for the rstash cache, you need to set the RSTASH_REDIS_ENDPOINT with the single-node redis URL.
If you want to use a Redis cluster, set RSTASH_REDIS_CLUSTER_ENDPOINTS instead of RSTASH_REDIS_ENDPOINT with the comma-separated list of redis node URLs.
Redis endpoint URL format can be found in the OpenDAL source code. Some valid examples:
redis://127.0.0.1:6379ortcp://127.0.0.1:6379or127.0.0.1:6379- TCP-based Redis connection (non-secure)rediss://@1.2.3.4:6379- TLS-based Redis connection over TCP (secure)unix:///tmp/redis.sockorredis+unix:///tmp/redis.sock- Unix socket-based Redis connection
Redis can be configured as a LRU (least recently used) cache with a fixed maximum cache size. Set maxmemory and maxmemory-policy according to the Redis documentation. The allkeys-lru policy which discards the least recently accessed or modified key fits well for the rstash use case.
Redis over TLS is supported. Use the rediss:// url scheme (note rediss vs redis). Append #insecure the url to disable hostname verification and accept self-signed certificates (dangerous!). Note that this also disables SNI.
If you want to authenticate to Redis, set RSTASH_REDIS_USERNAME and RSTASH_REDIS_PASSWORD to the username and password accordingly.
RSTASH_REDIS_DB is the database number to use. Default is 0.
Set RSTASH_REDIS_EXPIRATION in seconds if you don't want your cache to live forever. This will override the default behavior of redis.
RSTASH_REDIS_TTL is a deprecated synonym for RSTASH_REDIS_EXPIRATION.
Set RSTASH_REDIS_KEY_PREFIX if you want to prefix all cache keys. This can be
useful when sharing a Redis instance with another application or cache.
RSTASH_REDIS is deprecated for security reasons, use RSTASH_REDIS_ENDPOINT instead. See khulnasoft/rstash#2083 for details.
If you really want to use RSTASH_REDIS, you should URL in format redis://[[<username>]:<passwd>@]<hostname>[:port][/?db=<db>].
Use the local Redis instance with no password:
RSTASH_REDIS=redis://localhostUse the local Redis instance on port 6379 with password qwerty:
RSTASH_REDIS=redis://:qwerty@localhost:6379Use the 192.168.1.10 Redis instance on port 6380 with username alice, password qwerty123 and database 12 via TLS connection:
RSTASH_REDIS=rediss://alice:qwerty123@192.168.1.10:6380/?db=12