rjurney / Agile_Data_Code_2

Code for Agile Data Science 2.0, O'Reilly 2017, Second Edition
http://bit.ly/agile_data_science
MIT License
456 stars 306 forks source link

Trouble with localhost:5000 and localhost:8888 #69

Closed Data-Engineer-Loading closed 5 years ago

Data-Engineer-Loading commented 6 years ago

I'm trying to create the tunnels to forward the ports with the script _ec2_createtunnel.sh and I can't access localhost:5000 and localhost:8888. The script seems to work fine, here is the output :

This script will create an ssh tunnel between the ec2 host's port 5000 and your local port 5000. This will enable you to view web applications you run from ex. Agile_Data_Code_2/ch08/web to be viewed at http://localhost:5000 Note: the tunnel will run in the background, and will die when you terminate the EC2 instance.

First we will forward the port the web appliations use... Forwarding the remote machine's port 5000 to the local port 5000, which you can then access at http://localhost:5000 Executing: ssh -N -i ./agile_data_science.pem -o StrictHostKeyChecking=no -L 5000:localhost:5000 ubuntu@$EC2_HOSTNAME &

Next we will forward the port the Jupyter Notebooks use... Forwarding the remote machine's port 8888 to the local port 8888, which you can then access at http://localhost:8888 Executing: ssh -N -i ./agile_data_science.pem -o StrictHostKeyChecking=no -L 8888:localhost:8888 ubuntu@$EC2_HOSTNAME &

Next we will forward the port that Airflow uses... Forwarding the remote machine's port 8080 to the local port 8080, which you can then access at http://localhost:8080 Executing: ssh -N -i ./agile_data_science.pem -o StrictHostKeyChecking=no -L 8080:localhost:8080 ubuntu@$EC2_HOSTNAME &

Then I ssh the ec2 instance, which works fine and I try to access localhost adresses in my computer's browser (Safari) and I get this message : "Safari can't open the page."

Any idea about what could go wrong ?

Thanks in advance for your help ! :)

rjurney commented 6 years ago

I'm sorry, I don't know what to do here. I can't figure out why it isn't working :(

peopzen commented 6 years ago

@rjurney I think I already set up ec2 environment - all folders and data are right in place via SSH. I can run ec2_create_tunnel.sh and ec2_kill_tunnel.sh successfully, but when trying http://localhost:5000 and 8000 in browser, the terminal tells: "channel 2: open failed: connect failed: Connection refused". any idea about this issue? Thanks. BTW, http://localhost:8080 works as expected. 24 hours later, by starting jupyter-notebook, http://localhost:8888 works fine. I think I tried strating jupyter-notebook before, but not sure why it didn't start.

arnaudbouffard commented 5 years ago

same issue here @BarbeFeu, using Chrome to access localhost:8888

@BarbeFeu managed to get it to work? I'll try looking into it (currently looking for a way to check port forwarding was correctly set)

arnaudbouffard commented 5 years ago

update: found the problem, fixed with commit https://github.com/rjurney/Agile_Data_Code_2/commit/11ce639312b2d6ef2769d8a3ed1a0e5984a97ac6

rjurney commented 5 years ago

@arnaudbouffard thanks for your help!