Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

The HDP 2.5 Sandbox VM for VirtualBox comes without the preconfigured port forwardings that allow you to map all the important Web UIs to ports on the host machine. Instead of going through the motions of entering all the port forwardings manually, I decided to copy them from the earlier Tech-Preview release using the VBoxManage CLI. The process has three steps:

  1. Obtain the new VM's SSID, which is a unique identifier that VirtualBox uses to address a VM.
  2. Read out the forwarding rules from the "old" (tech preview) VM
  3. For each rule, configure a matching rule in the "new" VM

Here is the code:

VMID=$(VBoxManage list vms | perl -ne '/Docker.*{(.*)}/ && print $1')

This bit gets the new VM's list entry (it is called "Hortonworks Docker Sandbox"), and parses the SSID, which is the bit that is enclosed by curly brackets. We need the SSID in the next step:

VBoxManage showvminfo "Hortonworks Sandbox with HDP 2.5 Technical Preview" | perl -ne '/NIC.*?Rule.*name = (.*?),.*protocol = (.*?),.*host ip = (.*?),.*host port = (.*?),.*guest ip = (.*?),.*guest port = (.*?)$/ && print "'"VBoxManage modifyvm $VMID --natpf1 "'$1,$2,$3,$4,$5,$6\n"' | bash

The vminfo command lists all kinds of data about the "old" VM, including the port forwarding rules. These are parsed with a Perl regular expression. The output of the Perl one-liner is a list of VBoxManage commands that create one rule each in the new VM's settings. The output is fed into bash via a pipe, and voilà! After running

VBoxManage startvm "Hortonworks Docker Sandbox"

the new Sandbox VM is available with All WebUIs in the familiar way!

2,420 Views
Comments
Not applicable

How to configure the same for VMware?

Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
1 of 1
Last update:
‎09-21-2016 02:37 PM
Updated by:
Former Member
 
Contributors
Top Kudoed Authors