redis-ssh2 is a Node.js package (v1.0.3) that enables executing Redis commands over an SSH tunnel using ioredis and ssh2. It creates a local SSH tunnel to a remote server and then connects to Redis through that tunnel, bypassing restrictions on localhost-only connections. The package wraps ioredis for Redis operations and ssh2 for SSH connections. It is particularly useful when Redis is only accessible from a webserver and not directly from the client. The API consists of a single connect() function that accepts SSH and Redis configurations and returns a promise that resolves to an ioredis client. Users must close the tunnel with Redis.close() when done.
npm install redis-ssh2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to a remote Redis server through an SSH tunnel using a private key, sets a key, and closes the tunnel.
Always call Redis.close() after finishing Redis operations.
Use Redis.close() to properly close the SSH tunnel.
Refer to ioredis documentation for breaking changes between versions.
Provide at least one authentication method in the SSH config object.
Pass 'agent' option in sshConfig if agent forwarding is needed.
Use 'const Redis = require('redis-ssh2')' (default) or 'import Redis from 'redis-ssh2''.Verify sshConfig has correct host, user, and either privateKey or password.
Call Redis.close() (static method) not client.close().