I used python on sandbox and launch the flask server using the following command
* Running on http://0.0.0.0:5000/
however, when I go to http://sandbox.hortonworks.com:5000/, I got an "sandbox.hortonworks.com refused to connect." error.
I also try the http://192.168.227.129:5000/ and still cannot connect.
Any suggestion on how to connect to the 5000 port?
Thanks a lot.
You will need to add port forwarding to your Sandbox environment. If you login to your sandbox and run netstat -pant from the cmd line, you should see port 5000 running, but it is not exposed external to the sandbox environment.
If you are using Virtualbox, you can edit these settings to add port 5000 to the port forwarding rules:
Then add port 5000 (which is the default port for flask) to the list of already configured ports:
Host IP: 127.0.0.1
Host Port: 5000
Guest Port: 5000
Let me know if this helps.
@Dan Zaratsian Thanks for your advice. I am using VMware, so I tried to following the following instruction http://www.virten.net/2013/03/how-to-setup-port-forwarding-in-vmware-workstation-9/
However, i cannot make it work. Did I miss anything?
Hopefully you're not hitting that bug, but that's good to know.
Here's a good article I found: http://www.virtuatopia.com/index.php/VMware_Server_NAT_Configuration
Do you have a NAT based virtual network setup? If so, then you can try to add the port forwarding rules.
Hopefully you can get this working. As an alternative, if you are just getting started with the sandbox VM, you may want to consider using Virtualbox, since the port forwarding rules seem to be much easier to implement.
I didn't configure the docker in the VM, so port forwarding is not working. It's working after I configure the sandbox. I learned a lot after following your advice. Thanks a lot for your help,
There is definitely additional port forwarding that needs to be done to make this work. If it is the VMware problem you are describing, I would think that 127.0.0.1:8080 would not work, either. If you are getting to Ambari on :8080, it doesn't sound like you are hitting the VMware bug you mentioned.
The first layer of virtualization is the VMware you are using. Did you add port forwarding for port 5000 into the VMware port forwarding rules? You will have to do that first in order to get this to work.
There is a second layer of virtualization in the sandbox that ALSO needs to have the port forwarded. That is within docker in the VM that is running on VMware. There is a very nice article at https://community.hortonworks.com/content/kbentry/65914/how-to-add-ports-to-the-hdp-25-virtualbox-sa... that shows how to do it with Virtualbox. It includes the port forwarding step you will do in VMware above, so you need to scroll down to the section that says “Login to the Sandbox VM” and start from there. BE CAREFUL, though, that you do the ‘docker commit sandbox sandbox’ that is mentioned in a note before you do the ‘docker rm sandbox’ or you will revert the sandbox to its initial state.
Once you have both of the forwarding rules in place, you should be able to hit port 5000.