cta

Get Started

cloud

Ready to Get Started?

Download sandbox

How can we help you?

closeClose button

Sandbox Port Forwarding Guide

Introduction

The Hortonworks Sandbox is delivered as a Dockerized container with the most common ports already opened and forwarded for you. If you would like to open even more ports, check out the tutorial corresponding to your virtualization platform.

Outline

This series is made up of instructions for each virtualization platform that Hortonworks Sandbox runs on. Jump to the one you’re looking for.

  1. Sandbox Port Forwarding on VirtualBox
  2. Sandbox Port Forwarding on VMWare
  3. Sandbox Port Forwarding on Docker
  4. Sandbox Port Forwarding on Azure

Sandbox Port Forwarding on VirtualBox

Introduction

In order to explain opening ports and port forwarding in the VirtualBox version of the Hortonworks Sandbox, it may be a good idea to first have a high level view of what the sandbox looks like. Have a look at the graphic below, which shows where the sandbox exists in relation to the outside world and the port forwarding that exists.

VirtualBox Sandbox Architecture

Prerequisites

Outline

SSH Into the VM Running Docker

We need to login to the virtual machine that runs the sandbox container. If you use the standard sandbox ssh -p 2222 root@sandbox.hortonworks.com, you will actually log into the sandbox container, not the containing VM where Docker changes are made. You want to log into the VM running Docker with the following command:

ssh -p 2122 root@sandbox.hortonworks.com

Note: The default password is hadoop.

Add Ports to the Docker Script

The script in the VM that is responsible for creating the dockerized sandbox container is located at /root/start_scripts/start_sandbox.sh.

Open /root/start_scripts/start_sandbox.sh to reveal the docker script, which looks something like the following:

docker run -v hadoop:/hadoop --name sandbox --hostname "sandbox.hortonworks.com" --privileged -d \
-p 6080:6080 \
-p 9090:9090 \
-p 9000:9000 \
-p 8000:8000 \
-p 8020:8020 \
-p 2181:2181 \
-p 42111:42111 \
...

Edit this file and add your desired port forward. In this example, we’re going to forward host port 15000 to sandbox port 15000. The file should now look something like the following:

docker run -v hadoop:/hadoop --name sandbox --hostname "sandbox.hortonworks.com" --privileged -d \
-p 15000:15000 \
-p 6080:6080 \
-p 9090:9090 \
-p 9000:9000 \
-p 8000:8000 \
-p 8020:8020 \
-p 2181:2181 \
-p 42111:42111 \
...

Remove the Current Sandbox Container

Terminate the existing sandbox container, and then remove it.

Warning: Be aware that this deletes the sandbox, changes are not saved. If you want to save the work you’ve done inside the sandbox, first run: docker commit sandbox sandbox.

docker stop sandbox
docker rm sandbox

Restart the VM Running Docker

We now restart the VM running Docker. Upon restart, the script we modified above will be run in order to start the sandbox container. Since we removed the container in the previous step, the sandbox container is first rebuilt with your newly specified port forwards.

One easy method of restarting the VM is executing the following command:

init 6

Forward VirtualBox Ports

We now need to update the ports forwarded by VirtualBox. Open VirtualBox, right-click on the sandbox entry and select “Settings”.

VirtualBox Entry Settings

In the “Network” tab, expand the adapter’s “Advanced” section, and click “Port Forwarding”.

VirtualBox Network Tab

Click the Settings button and go to the Network tab, click Advanced and Port Forwarding:

Click on the + icon on the right of the window to create a new port forwarding rule. Enter any “Name” for your port forward, set the “Host IP” to “127.0.0.1”, and enter your desired new port forward.

VirtualBox Add Port Forward

Click “OK” until your out of the settings. You’re all done! Changes take effect immediately – no need to reset VirtualBox.

Summary

You’ve successfully modified the sandbox container’s startup script and VirtualBox settings in order to add in new port forwards. The forwarded ports allow you to access processes running on the sandbox from your host system (i.e. your computer and browser).


Sandbox Port Forwarding on VMWare

Introduction

In order to explain opening ports and port forwarding in the VMWare version of the Hortonworks Sandbox, it may be a good idea to first have a high level view of what the sandbox looks like. Have a look at the graphic below, which shows where the sandbox exists in relation to the outside world and the port forwarding that exists.

VMWare Sandbox Architecture

Outline

SSH Into the VM Running Docker

We need to login to the virtual machine that runs the sandbox container. If you use the standard sandbox ssh -p 2222 root@sandbox.hortonworks.com, you will actually log into the sandbox container, not the containing VM where Docker changes are made. You want to log into the VM running Docker with the following command:

ssh -p 2122 root@sandbox.hortonworks.com

Note: The default password is hadoop.

Add Ports to the Docker Script

The script in the VM that is responsible for creating the dockerized sandbox container is located at /root/start_scripts/start_sandbox.sh.

Open /root/start_scripts/start_sandbox.sh to reveal the docker script, which looks something like the following:

docker run -v hadoop:/hadoop --name sandbox --hostname "sandbox.hortonworks.com" --privileged -d \
-p 6080:6080 \
-p 9090:9090 \
-p 9000:9000 \
-p 8000:8000 \
-p 8020:8020 \
-p 2181:2181 \
-p 42111:42111 \
...

Edit this file and add your desired port forward. In this example, we’re going to forward host port 15000 to sandbox port 15000. The file should now look something like the following:

docker run -v hadoop:/hadoop --name sandbox --hostname "sandbox.hortonworks.com" --privileged -d \
-p 15000:15000 \
-p 6080:6080 \
-p 9090:9090 \
-p 9000:9000 \
-p 8000:8000 \
-p 8020:8020 \
-p 2181:2181 \
-p 42111:42111 \
...

Remove the Current Sandbox Container

Terminate the existing sandbox container, and then remove it.

Warning: Be aware that this deletes the sandbox, changes are not saved. If you want to save the work you’ve done inside the sandbox, first run: docker commit sandbox sandbox.

docker stop sandbox
docker rm sandbox

Restart the VM Running Docker

We now restart the VM running Docker. Upon restart, the script we modified above will be run in order to start the sandbox container. Since we removed the container in the previous step, the sandbox container is first rebuilt with your newly specified port forwards.

One easy method of restarting the VM is executing the following command:

init 6

Summary

That’s it! There is no need to make changes to your VMWare product as all ports are automatically opened and forwarded.

You’ve successfully modified the sandbox container’s startup script and added in new port forwards. The forwarded ports allow you to access processes running on the sandbox from your host system (i.e. your computer and browser).


Sandbox Port Forwarding on Docker

Introduction

We’ll walk through how to open a port for Docker so that outside connections may make their way into the sandbox.

Outline

Add Ports to the Docker Script

When you first deployed the sandbox on Docker, you used a script named something similar to start-sandbox-hdx.sh. That script is responsible for instructing Docker how to create the dockerized sandbox container. Find this script, as it is what we will be making changes to.

If you no longer have the script, the default scripts are listed below for you to download and edit.

Open the script, which looks something like the following:

docker run -v hadoop:/hadoop --name sandbox --hostname "sandbox.hortonworks.com" --privileged -d \
-p 6080:6080 \
-p 9090:9090 \
-p 9000:9000 \
-p 8000:8000 \
-p 8020:8020 \
-p 2181:2181 \
-p 42111:42111 \
...

Edit this file and add your desired port forward. In this example, we’re going to forward host port 15000 to sandbox port 15000. The file should now look something like the following:

docker run -v hadoop:/hadoop --name sandbox --hostname "sandbox.hortonworks.com" --privileged -d \
-p 15000:15000 \
-p 6080:6080 \
-p 9090:9090 \
-p 9000:9000 \
-p 8000:8000 \
-p 8020:8020 \
-p 2181:2181 \
-p 42111:42111 \
...

Remove the Current Sandbox Container

Terminate the existing sandbox container, and then remove it.

Warning: Be aware that this deletes the sandbox, changes are not saved. If you want to save the work you’ve done inside the sandbox, first run: docker commit sandbox sandbox.

docker stop sandbox
docker rm sandbox

Recreate the Sandbox Container

To recreate the sandbox container, simply run the script you just modified. Since we removed the container in the previous step, the script will first rebuild the sandbox container with your newly specified port forwards.

Below are common methods of running scripts.

For Linux/Mac:

/path/to/your/start-sandbox-script.sh

For Windows:
Right click on the script and click “Run with PowerShell

Summary

You’ve successfully modified the sandbox container’s startup script and added new port forwards. The forwarded ports allow you to access processes running on the sandbox from your host system (i.e. your computer and browser).


Sandbox Port Forwarding on Azure

Introduction

The Hortonworks Sandbox running on Azure requires opening ports a bit differently than when the sandbox is running locally on your machine. We’ll walk through how to open a port in Azure so that outside connections make their way into the sandbox, which is a Docker container inside an Azure virtual machine.

The graphic below shows where the sandbox exists in relation to the Azure VM and the port forwarding that exists.

Azure Sandbox Architecture

Prerequisites

Outline

SSH Into the Azure VM

If you followed the previous tutorial, Deploying Hortonworks Sandbox on Microsoft Azure, this step is as easy as running:

ssh azureSandbox

Otherwise, follow whichever method you prefer to SSH into the Azure VM that is running the sandbox.

Add Ports to the Docker Script

The script in the Azure VM that is responsible for creating the dockerized Sandbox container is located at /root/start_scripts/start_sandbox.sh.

Note: You are likely not logged in as root, so do not forget to sudo your commands.

Open /root/start_scripts/start_sandbox.sh to reveal the docker script, which looks something like the following:

docker run -v hadoop:/hadoop --name sandbox --hostname "sandbox.hortonworks.com" --privileged -d \
-p 6080:6080 \
-p 9090:9090 \
-p 9000:9000 \
-p 8000:8000 \
-p 8020:8020 \
-p 2181:2181 \
-p 42111:42111 \
...

Edit this file and add your desired port forward. In this example, we’re going to forward host port 15000 to sandbox port 15000. The file should now look something like the following:

docker run -v hadoop:/hadoop --name sandbox --hostname "sandbox.hortonworks.com" --privileged -d \
-p 15000:15000 \
-p 6080:6080 \
-p 9090:9090 \
-p 9000:9000 \
-p 8000:8000 \
-p 8020:8020 \
-p 2181:2181 \
-p 42111:42111 \
...

Remove the Current Sandbox Container

Terminate the existing sandbox container, and then remove it.

Warning: Be aware that this deletes the sandbox, changes are not saved. If you want to save the work you’ve done inside the sandbox, first run: docker commit sandbox sandbox.

sudo docker stop sandbox
sudo docker rm sandbox

Restart the Azure VM

We now restart the Azure VM. Upon restart, the script we modified above will be run in order to start the sandbox container. Since we removed the container in the previous step, the sandbox container is first rebuilt with your newly specified port forwards.

One easy method of restarting the VM is executing the following command:

sudo init 6

(Optional) Add New Ports to the SSH Config

If you’re connecting to Azure via SSH tunneling, be sure to add new forwarding directives to your SSH config. See the Deploying Hortonworks Sandbox on Microsoft Azure tutorial for more information.