Skip to main content

Redis tunnel

info

Available only with a subscription.

Overview​

Redis tunnel allows you to provide access to a Redis database and track executed queries in the inspector.

note

Redis tunnels are designed for debugging and working locally or in test environments, they do not support SSL connections. We do not recommend using this type of tunnels in production environments.

Starting with version 0.36.0, tuna shows a full-screen interface in the terminal with sessions and Redis commands.

Examples​

note

You can view all current flags, hints, and examples by calling help:

tuna redis --help

Almost all flags have corresponding environment variables.

Basic example​

tuna redis 6379

With IP address​

tuna redis 10.0.0.1:6379

Specifying an API key​

You can specify a different API key using the --api-key flag or the TUNA_API_KEY environment variable; the key needs the tunnels:connect scope. Overriding follows the configuration ordering policy.

tuna redis 6379 --api-key=tak_***

Specifying a connection region​

You can specify a particular region using the --location/-l flag or the TUNA_LOCATION environment variable. Overriding follows the configuration ordering policy.

tuna redis 6379 --location=nl

Static port​

The value of the --port/-p flag can be an alias or an assigned port. You can reserve ports in the dashboard, and after restarting the tunnel the address will remain the same. For more details about ports, see the dedicated guide.

tuna redis 6379 --port=redis
tuna redis 6379 --port=35000

IP subnet access restriction​

You can define a whitelist of subnets in CIDR format:

tuna redis 6379 --cidr-allow="10.0.0.1/32"

Or prohibit access from specific subnets:

tuna redis 6379 --cidr-deny="10.0.0.1/32"

You can combine them, for example specify a wide network and subtract private IPs:

tuna redis 6379 --cidr-allow="10.0.0.1/24" --cidr-deny="10.0.0.33/32"

You can also pass lists separated by commas:

tuna redis 6379 --cidr-allow="10.0.0.1/24,192.168.0.1/24" --cidr-deny="10.0.0.33/32,192.168.0.33/32"

Query inspector​

The inspector is always on and available at http://127.0.0.1:4040: sessions on the left, queries of the selected session on the right with duration, result and errors. The next tunnel takes port 4041; set a fixed port with --inspect-port or TUNA_INSPECT_PORT. If you don't need the inspector, use a TCP tunnel.

The CLI logs the inspector address and shows it in the header of the terminal UI. More on the inspector page.

Redis session: MULTI/EXEC marked with a bar