title | description | services | documentationcenter | author | manager | editor | ms.assetid | ms.service | ms.custom | ms.devlang | ms.topic | ms.tgt_pltfrm | ms.workload | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Use SSH tunneling to access Azure HDInsight | Microsoft Docs |
Learn how to use an SSH tunnel to securely browse web resources hosted on your Linux-based HDInsight nodes. |
hdinsight |
Blackmist |
jhubbard |
cgronlun |
879834a4-52d0-499c-a3ae-8d28863abf65 |
hdinsight |
hdinsightactive |
na |
article |
na |
big-data |
05/30/2017 |
larryfr |
Linux-based HDInsight clusters provide access to Ambari web UI over the Internet, but some features of the UI are not. For example, the web UI for other services that are surfaced through Ambari. For full functionality of the Ambari web UI, you must use an SSH tunnel to the cluster head.
Several of the menus in Ambari only work through an SSH tunnel. These menus rely on web sites and services running on other node types, such as worker nodes. Often, these web sites are not secured, so it is not safe to directly expose them on the internet.
The following Web UIs require an SSH tunnel:
- JobHistory
- NameNode
- Thread Stacks
- Oozie web UI
- HBase Master and Logs UI
If you use Script Actions to customize your cluster, any services or utilities that you install that expose a web UI require an SSH tunnel. For example, if you install Hue using a Script Action, you must use an SSH tunnel to access the Hue web UI.
Secure Shell (SSH) tunneling routes traffic sent to a port on your local workstation. The traffic is routed through an SSH connection to your HDInsight cluster head node. The request is resolved as if it originated on the head node. The response is then routed back through the tunnel to your workstation.
-
An SSH client. For more information, see Use SSH with HDInsight.
-
A web browser that can be configured to use a SOCKS5 proxy.
[!WARNING] The SOCKS proxy support built into Windows does not support SOCKS5, and does not work with the steps in this document. The following browsers rely on Windows proxy settings, and do not currently work with the steps in this document:
- Microsoft Edge
- Microsoft Internet Explorer
Google Chrome also relies on the Windows proxy settings. However, you can install extensions that support SOCKS5. We recommend FoxyProxy Standard.
Use the following command to create an SSH tunnel using the ssh
command. Replace USERNAME with an SSH user for your HDInsight cluster, and replace CLUSTERNAME with the name of your HDInsight cluster:
ssh -C2qTnNf -D 9876 [email protected]
This command creates a connection that routes traffic to local port 9876 to the cluster over SSH. The options are:
- D 9876 - The local port that routes traffic through the tunnel.
- C - Compress all data, because web traffic is mostly text.
- 2 - Force SSH to try protocol version 2 only.
- q - Quiet mode.
- T - Disable pseudo-tty allocation, since we are just forwarding a port.
- n - Prevent reading of STDIN, since we are just forwarding a port.
- N - Do not execute a remote command, since we are just forwarding a port.
- f - Run in the background.
Once the command finishes, traffic sent to port 9876 on the local computer is routed to the cluster head node.
PuTTY is a graphical SSH client for Windows. Use the following steps to create an SSH tunnel using PuTTY:
-
Open PuTTY, and enter your connection information. If you are not familiar with PuTTY, see the PuTTY documentation (http://www.chiark.greenend.org.uk/~sgtatham/putty/docs.html).
-
In the Category section to the left of the dialog, expand Connection, expand SSH, and then select Tunnels.
-
Provide the following information on the Options controlling SSH port forwarding form:
-
Click Add to add the settings, and then click Open to open an SSH connection.
-
When prompted, log in to the server.
Important
The steps in this section use the Mozilla FireFox browser, as it provides the same proxy settings across all platforms. Other modern browsers, such as Google Chrome, may require an extension such as FoxyProxy to work with the tunnel.
-
Configure the browser to use localhost and the port you used when creating the tunnel as a SOCKS v5 proxy. Here's what the Firefox settings look like. If you used a different port than 9876, change the port to the one you used:
[!NOTE] Selecting Remote DNS resolves Domain Name System (DNS) requests by using the HDInsight cluster. This setting resolves DNS using the head node of the cluster.
-
Verify that the tunnel works by visiting a site such as http://www.whatismyip.com/. If the proxy is correctly configured, the IP address returned is from a machine in the Microsoft Azure datacenter.
Once the cluster has been established, use the following steps to verify that you can access service web UIs from the Ambari Web:
-
In your browser, go to http://headnodehost:8080. The
headnodehost
address is sent over the tunnel to the cluster and resolve to the headnode that Ambari is running on. When prompted, enter the admin user name (admin) and password for your cluster. You may be prompted a second time by the Ambari web UI. If so, reenter the information.[!NOTE] When using the http://headnodehost:8080 address to connect to the cluster, you are connecting through the tunnel. Communication is secured using the SSH tunnel instead of HTTPS. To connect over the internet using HTTPS, use https://CLUSTERNAME.azurehdinsight.net, where CLUSTERNAME is the name of the cluster.
-
From the Ambari Web UI, select HDFS from the list on the left of the page.
-
When the HDFS service information is displayed, select Quick Links. A list of the cluster head nodes appears. Select one of the head nodes, and then select NameNode UI.
[!NOTE] When you select Quick Links, you may get a wait indicator. This can happen if you have a slow internet connection. Wait a minute or two for the data to be received from the server, then try the list again.
Some entries in the Quick Links menu may be cut off by the right side of the screen. If so, expand the menu using your mouse and use the right arrow key to scroll the screen to the right to see the rest of the menu.
-
A page similar to the following image is displayed:
[!NOTE] Notice the URL for this page; it should be similar to http://hn1-CLUSTERNAME.randomcharacters.cx.internal.cloudapp.net:8088/cluster. This URI is using the internal fully qualified domain name (FQDN) of the node, and is only accessible when using an SSH tunnel.
Now that you have learned how to create and use an SSH tunnel, see the following document for other ways to use Ambari:
For more information on using SSH with HDInsight, see Use SSH with HDInsight.