Superset Connect to a private database
Asked Answered
W

2

7

I have a database running in a private VPC. The database isn't publicly accessible. Does superset support Connecting to databases via an SSH Tunnel? If so any link to the docs?

Woodworm answered 3/12, 2020 at 21:0 Comment(0)
T
2

I couldn't find it in the docs, but with the SSH tunnel you basically need to change the DB host to 127.0.0.1 (not localhost, since that's a keyword reserved for connection using the MySQL socket), and everything else should be the same.

For example, I tested with a MySQL database that I have running on host.example.com. I first created a tunnel redirecting my local port 3336 to MySQL's port 3306 (I did that because I already have MySQL running locally on 3306):

ssh -N -L 3336:127.0.0.1:3306 host.example.com

Then I was able to add it to Superset using this SQLAlchemy URI:

mysql://username:[email protected]:3336/dbname
Tugboat answered 8/12, 2020 at 18:44 Comment(2)
What is the -N flag for? I don't get it in the usage list when running $sshCharcuterie
On Mac OS: "-N Do not execute a remote command. This is useful for just forwarding ports."Tugboat
W
0

This worked for me:

ssh -i /path/key-pair_instance1.pem username_of_instance1@i-0123456789abcdefa -L 9090:ec2-198-51-100-2.compute-1.amazonaws.com:3306

Here is the source with further explanation.

Wally answered 21/10, 2021 at 11:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.