The Golden Spot

I hope this helps someone who is learning about Linux and web application programming with Python, Django, and Javascript.

Sunday, October 05, 2014

SSH tunneling for SparkUI

When starting a Spark session you can visit the status page on port 4040 by default. For instance when you start the pyspark program you'll see:

14/10/06 05:22:03 INFO Utils: Successfully started service 'SparkUI' on port 4040.

I don't want to allow public access to this page so I'll use SSH to forward the port. I have port 8125 open for tcp connections on my gcloud instance. First, on the gcloud instance, forward the Spark service's port 4040 to port 8125, which is open to the Internet; while logged in to the gcloud instance run:

 ssh -4 -f localhost -L 8125:localhost:4040 -N

Next, on your laptop you'll want to forward the gcloud Internet available opened port at 8125 to a port like 2200 so that we can visit the page locally. On your laptop run:

ssh -N -L 2200:localhost:8125

replace '' with the Internet facing IP of your gcloud instance.

Now visit http://localhost:2200 and the service that is running on your gcloud instance on port 4040 is first forwarded to 8125 on that host, and then forwarded to port 2200 locally. 



Anonymous Anonymous said...

you can also do
ssh my-server -f -N -L localhost:8503:my-server:8501
which will run the daemon in the background; then you can kill this process by getting it's PID from this command
lsof -t -i @localhost:8503 -sTCP:listen

8:37 AM  

Post a Comment

<< Home