Connect to a source via ssh tunnel

Hi All,
We have a data provider hosting a PostgreSQL database. They’ve provided details for connecting to the database via an SSH tunnel which I’ve connected to successfully using the PGAdmin client. How would I go about connecting to a PostgreSQL source via SSH tunnel from Dremio?

Are you able to setup the SSH tunnel on each of the executors in the same way? If so then you should be able to use the tunnel ip:port (usually you’d do something like 127.0.0.1:port and forward that onto the destination. However you might run into some complications keeping that tunnel connection open. Dremio simply connects to the IP:port of a given source it does not setup port forwarding. You could have to take care of that and manage that at the OS level.

I’ve tried setting up the tunnel at the OS level, as suggested, and restarted Dremio but still no luck. I’ve looked at the server.log and can see JDBC is complaining that the “Connection is not valid”. I sent the ssh command as follows:
ssh -f -N -i [path/to/private/key/file] [tunnel user]@[tunnel ip] -L 5432:[postgresql server name]:5432
and then entered the key password but no success.

I was hoping the Dremio source connection interface might have an SSH tunnel section, similar to PGAdmin.

When you added the source in Dremio, did you you specify localhost:5432 or 127.0.0.1:5432 as the connection point?

Yes - that ended up being the issue: should have been localhost, not the Postgresql server name.