Last active
January 4, 2018 20:27
-
-
Save mnebuerquo/057be354026d54a601a1d724104237aa to your computer and use it in GitHub Desktop.
Open an ssh tunnel to a mongo server through another host, so that the mongo ports are available on localhost.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# mongodb is in a private network somewhere, host is a machine which can connect | |
# after running this script, you can connect to mongo at localhost | |
MONGO=$1 | |
HOST=$2 | |
ssh -fnN \ | |
-L 27017:$MONGO:27017 \ | |
-L 27018:$MONGO:27018 \ | |
-L 27019:$MONGO:27019 \ | |
$HOST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment