Access the web UI of Cloudera Manager service components through an SSH tunnel

Updated at:
Copy as MD

In a Cloudera Manager (CM) cluster, the web UI ports for open source components such as Hadoop, Spark, and Flink are not publicly exposed to enhance cluster security. You can access these web UIs by creating a Secure Shell (SSH) tunnel on your local server that uses port forwarding. This topic describes how to access the web UIs of CM service components through an SSH tunnel.

Get the public IP address of the utility node

Use dynamic port forwarding

This method creates an SSH tunnel from an open port on your local server to the master node of the cluster. A local SOCKS proxy server listens on this port and forwards data to the master node through the SSH tunnel.

Create an SSH tunnel

  1. Using a key

ssh -i <path_to_key_file> -N -D 8157 root@<public_IP_address_of_utility_node>
  1. Using a password

ssh -N -D 8157 root@<public_IP_address_of_utility_node>

Parameter descriptions:

  • 8157: An example of a local server port. You can use any available port on your local server.

  • -D: Enables dynamic port forwarding. This parameter starts a SOCKS proxy process that listens on your local port.

  • <public_IP_address_of_utility_node>: The public IP address of the utility node. For more information, see Obtain the public IP address of the utility node.

  • <path_to_key_file>: The path where the key file is saved.

Configure your browser

After you configure dynamic port forwarding, choose one of the following methods to configure your browser.

Method 1: Use the Chrome command line

Method 2: Configure a proxy extension

Method 1: Use the Chrome command line

  1. Open a command-line window and navigate to your Google Chrome installation folder.

The default installation folder for Chrome varies depending on the operating system.

Operating system

Default Chrome installation path

Mac OS X

"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \

--user-data-dir="$HOME/chrome-with-proxy" \

--proxy-server="socks5://localhost:8157"

Linux

/usr/bin/google-chrome \ --user-data-dir="$HOME/chrome-with-proxy" \ --proxy-server="socks5://localhost:8157"

Windows

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ^ --user-data-dir="%USERPROFILE%\chrome-with-proxy" ^ --proxy-server="socks5://localhost:8157"

Note

8157: An example of a local server port. You can use any available port on your local server.

  1. In this Chrome session, you can access Cloudera Manager and other web UIs over the internal network.

For example: http://cdp-master-1.xxxx.cn-hangzhou.cdp.aliyuncs.com:9870/dfshealth.html#tab-overview

Method 2: Configure a proxy extension

A proxy extension helps you manage proxies in your browser. This prevents interference between your regular web browsing and your access to the cluster web UI.

  1. Install the SwitchyOmega extension for Chrome.

  1. After the installation is complete, click the SwitchyOmega extension icon. In the pop-up window, select Options to begin the configuration.

  2. Click New profile. Enter a Profile name, such as `SSH pac`. For the profile type, select PAC Profile.

  3. In the PAC Script section, enter the following script.

function regExpMatch(url, pattern) {    
  try { return new RegExp(pattern).test(url); } catch(ex) { return false; }    
}

function FindProxyForURL(url, host) {
    // Important: replace 172.31 below with the proper prefix for your VPC subnet

    if (shExpMatch(url, "*localhost*")) return "SOCKS5 localhost:8157";
    if (shExpMatch(url, "*cdp-*")) return "SOCKS5 localhost:8157";

    return 'DIRECT';
}
  1. After you configure the parameters, click Apply Options in the left navigation pane.

  2. In Chrome, click the SwitchyOmega extension icon and switch to the SSH tunnel profile that you created.

  1. Log in to the CDP console and access the web UI of the desired service. For example, you can access the Ranger page.