Hi All,
Is it currently possible to have a MySQL or Postgres data source that is connected to via an SSH tunnel?
Cheers,
Josh
Yes, use ssh to create the tunnel first then connect redash to the tunneled port.
ssh -N -Llocalport:remotedbhost:remoteport user@sshhost
Eg
ssh -N -L3307:localhost:3306 user@myserver.com
You can specify multiple -L parameters to map MySQL and Postgres
Then simply connect to port 3307.
I have this running as an upstart job in on my redash machine to keep the tunnel open 24/7.
Thanks both, I wasn’t sure if I was missing an option in the GUI that would have redash open the tunnel, use it for a query & close it afterwards, but leaving it open is fine
Thanks for pointing out autossh as well, I’d never seen it before & it looks awesome!
Is there a way to have the SaaS version talk to our postgres database? I presume the described mechanism would only work if we were running our own redash.
Thanks!
There is no UI to control it, but we can setup the tunnel for you if needed.
Is there any good way of doing this with the docker deployment. Especially the workers.
I have the same issue but don’t have ssh access to my database server. However, I can connect to mysql from another server in the same network. how should I proceed? I did this:
autossh -N -L3307:ssssadasd.rackspaceclouddb.com:3306 root@IP -C
I get this error:
Connection Test Failed:
Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
In your case you need to use autossh
in the other server, the one from the same network that has access your database, and create the tunnel there.
Then you’ll need to setup Redash to access the db from that server:port.
PS: it was not clear to me that this thread was so old. So I’ll keep this reply just in case someone else gets here looking for this info.