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:
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:
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 10.10.10.10
replace '10.10.10.10' 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.
References:
1 Comments:
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
Post a Comment
<< Home