This guide shows you how to connect to a remote secure Redis instance via local.
Note: PROCEED WITH EXTREME CAUTION UNDER THE ASSUMPTION THAT YOU ARE CONNECTING TO A PROUDCTION LEVEL REDIS INSTANCE
- redis-cli (https://redis.io/download)
- stunnel (
brew install stunnel
) to handle encryption - Working SSH tunnel
-
Open up
ssh
tunnel$ ssh <ssh-alias> -L 6379:<remote-host-name>:6379 -N
-
Create
stunnel.conf
, the config file should look like the following:[redis-cli] client=yes accept=127.0.0.1:6380 connect=127.0.0.1:6379
Note: we'll be using port
6380
to connect usingredis-cli
in next step -
Run
stunnel
, the process will be running in the background.$ stunnel stunnel.conf
Note: In case you need to kill the process to free up the port, you can run
lsof -i :6380
to find the running process under the running port and usekill <pid>
-
Run
redis-cli
$ redis-cli -p 6380
-
Voila, you should be connected :)