Access the web UI of Cloudera Manager service components through an SSH tunnel
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
Using a key
ssh -i <path_to_key_file> -N -D 8157 root@<public_IP_address_of_utility_node>
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
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" |
8157: An example of a local server port. You can use any available port on your local server.
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.
Install the SwitchyOmega extension for Chrome.
After the installation is complete, click the SwitchyOmega extension icon. In the pop-up window, select Options to begin the configuration.
Click New profile. Enter a Profile name, such as `SSH pac`. For the profile type, select PAC Profile.
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';
}
After you configure the parameters, click Apply Options in the left navigation pane.
In Chrome, click the SwitchyOmega extension icon and switch to the SSH tunnel profile that you created.
Log in to the CDP console and access the web UI of the desired service. For example, you can access the Ranger page.