Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar
Explorer

In the following article, Ambari Views Server is the Standalone Ambari Server used for hosting Views and Ambari Server is the Operational Ambari Server which manages a Hadoop Cluster

Before Ambari 2.4, when Ambari Views Servers are setup, the only way to configure views was to use ‘Custom Configuration’. In this method details had to be manually entered for several fields. For example, to configure Files View, all the entries as described in Ambari Views Documentaion for 2.2 had to be made.

This is made easier in Ambari 2.4 with ‘Remote Cluster Configuration’ . The remote cluster configuration is used to set up an Ambari Views Server to host views for a remote Ambari server, regardless of the cluster configuration.Once a remote cluster configuration is set, all it takes to create a new view is to select the 'Remote Cluster' option in 'Cluster configuration' and select a cluster name in create view wizard.

How to define a new remote cluster configuration?

Note: If remote Ambari server is either Kerberised or if SSL is enabled, please refer to the end of the article to complete the pre-requisite setup before continuing further.

To create a remote cluster configuration in Views server, go to ‘Manage Ambari’ under admin,

Click on ‘Remote Clusters’. Click on ‘Register Remote Cluster’.

Screen Shot 2016-08-26 at 12.57.42 PM.png

Provide the following values to register a remote Ambari Server:

Cluster Name: This value will be used while creating views using the remote cluster configuration. This need not be same as the cluster name of remote cluster.

Ambari Cluster URL: This is the URL of the remote cluster to be configured.

http://<remote_server_url>:<port>/api/v1/clusters/<remote_cluster_name>;
For example,
http://prod.example.com:8080/api/v1/clusters/cl1

If the remote cluster has SSL enabled for Ambari, the url would start with https instead of http.

Cluster user: Ambari User in remote cluster with ‘Cluster Admin’ permission.

Password : Ambari login password for the above user.

Screen Shot 2016-08-26 at 1.04.49 PM.png

Once Registered, the remote clusters would be listed as follows:

Screen Shot 2016-08-26 at 1.05.03 PM.pngOnce the remote cluster configuration is set, multiple instances of the any view are can be created.

Here is an example for creating a new Files view using the above remote cluster configuration:

Screen Shot 2016-08-30 at 4.30.47 PM.png

Please take note of ‘Remote Cluster’ in the above screenshot. There is no need to enter any further details once this is selected. Optionally the 'Settings' section can be changed.

Once saved, click on 'Go to Instance' to go the the newly created Files view.

Screenshot of the working Files View:

Screen Shot 2016-08-30 at 4.58.38 PM.png

Pre-requisite if Remote Ambari Server is either Kerberised or SSL is enabled

If the Remote Ambari server is kerberized, then the following steps need to be completed in the Ambari Views server:

  • Copy the following from the Remote Ambari Server to the Ambari Views Server:
    1. /etc/krb5.conf
    2. Ambari server user keytab For example, copy /etc/security/keytabs/ambari.server.keytab
  • Find the Ambari server's kerberos principal name from the above file, for example,
klist -kt /etc/security/keytabs/ambari.server.keytab
Keytab name: FILE:/etc/security/keytabs/ambari.server.keytab
KVNO Timestamp           Principal
---- ------------------- ------------------------------------------------------   
   1 08/19/2016 08:14:54 ambari-server-cl1@EXAMPLE.COM   
   1 08/19/2016 08:14:54 ambari-server-cl1@EXAMPLE.COM   
   1 08/19/2016 08:14:54 ambari-server-cl1@EXAMPLE.COM   
   1 08/19/2016 08:14:54 ambari-server-cl1@EXAMPLE.COM   
   1 08/19/2016 08:14:54 ambari-server-cl1@EXAMPLE.COM
  • Stop ambari-server process in Ambari Views Server
ambari-server stop
  • Enable kerberos JAAS config for Ambari Views Server by running ambari-server setup-security and choosing option 3
ambari-server setup-security
Using python /usr/bin/python
Security setup options...
===========================================================================
Choose one of the following options: 
[1] Enable HTTPS for Ambari server. 
[2] Encrypt passwords stored in ambari.properties file. 
[3] Setup Ambari kerberos JAAS configuration. 
[4] Setup truststore. 
[5] Import certificate to truststore.
===========================================================================
Enter choice, (1-5):3
Setting up Ambari kerberos JAAS configuration to access secured Hadoop daemons...
Enter ambari server's kerberos principal name (ambari@EXAMPLE.COM): ambari-server-cl1@EXAMPLE.COM
Enter keytab path for ambari server's kerberos principal: /etc/security/keytabs/ambari.server.keytab
Ambari Server 'setup-security' completed successfully.
  • Start Ambari Server for the view server
ambari-server start

If the Remote Ambari Server has SSL enabled, then the following steps need to be completed in the View server:

  • Copy truststore (all.jks), for example, '/etc/security/serverKeys/all.jks' of the remote Ambari server to Views server.
  • Stop Ambari Server on Views Server
ambari-server stop
  • Setup truststore for Ambari Views Server by running ambari-server security and choosing option 4
ambari-server setup-security
Using python /usr/bin/python
Security setup options...
===========================================================================
Choose one of the following options: 
[1] Enable HTTPS for Ambari server.
[2] Encrypt passwords stored in ambari.properties file. 
[3] Setup Ambari kerberos JAAS configuration. 
[4] Setup truststore.
[5] Import certificate to truststore.
===========================================================================
Enter choice, (1-5):4
Do you want to configure a truststore [y/n] (y)? y
TrustStore type [jks/jceks/pkcs12] (jks):jks
Path to TrustStore file :/etc/security/serverKeys/all.jks
Password for TrustStore:
Re-enter password:
Ambari Server 'setup-security' completed successfully.
  • Start Ambari server on the Views server
ambari-server start
2,636 Views
Comments

@abilgi

I tried the above on two different Ambari versions (2.4.x and 2.5.x) with both Kerberised and Non-Kerberised environments. It does not work.

The Step to Register the Remote Cluster Fails. I see following in the logs:

12 Aug 2017 01:59:09,098 ERROR [ambari-client-thread-33] BaseManagementHandler:67 - Bad request received: Failed to create new Remote Cluster HDP02. User must be Ambari or Cluster Adminstrator.
2017-08-12T01:52:39.377Z, User(admin), RemoteIp(10.42.80.140), RequestType(POST), url(http://172.26.114.132:8080/api/v1/remoteclusters/HDP02), ResultStatus(400 Bad Request), Reason(Failed to create new Remote Cluster HDP02. User must be Ambari or Cluster Adminstrator.)

**Note : The user I have used is "admin" and is cluster administrator.

Am I missing something?

Also, what is the API way of getting this done? Is there any API way of registering a Remote Cluster?