Community Articles

Find and share helpful community-sourced technical articles.
Labels (2)
avatar
Rising Star

How to set up a Ranger enabled cluster using Ambari-blueprint.

In order to setup a cluster using Ambari blueprints we will need a minimum three node cluster.

Lets say this cluster contains three hosts as below:

secure-ranger-a.com

secure-ranger-b.com

secure-ranger-c.com

Pre-requisites: To setup a Ranger enabled cluster we need to install ambari-server on one of the hosts which can be the called the gateway node and ambari-agents should be installed on all the nodes including the gateway node.All the ambari-agents should be configured to point to the ambari-server on the gateway node.

Note : The operating system used for this setup is Cent-OS.

Lets consider the gateway node to be simple-ranger-a.com, to install ambari-server on this host we need to add ambari repository to the OS repositories.

  • To update the OS repository we add ambari.repo file to /etc/yum.repos.d/ directory.
  • Next we do a refresh of the OS repositories using command yum clean all
  • Then we run the command yum install -y ambari-server ambari-agent, this will install both ambari-server and ambari-agent on the gateway host.
  • Then we run ambari-server setup -s to setup ambari-server silently with default values, and ambari-server start to start the ambari-server
  • To install ambari-agent on the all hosts we copy the ambari.repo file to each of the hosts /etc/yum.repos.d/ and do yum clean all and yum install -y ambari-agent.
  • To make ambari-agent point to the ambari-server on the gateway node we run the command ambari-agent reset <FQDN of the gateway node> in this case we need to run ambari-agent reset simple-ranger-a.com on all hosts where agent is to be installed.
  • We now need to setup the Ranger-database as it is a pre-requisite to install Ranger service, here is a nice document to configure Ranger with mysql, postgres or oracle , which can be referred to setup the database of choice.
  • To enable security on the cluster we need to setup kerberos on the cluster, here is a nice document to setup the same.

Now we will need to create the blueprints and run them on the Ambari server.you can use the below blueprints and modify accordingly.

Save the attached hdp.txt and rename the .txt extention to .json

Save the attached cluster.txt and rename the .txt extention to .json

Save the attached blueprint.txt and rename the .txt extention to .json

After modifying the above jsons to use required repositories and hosts, we should now save the jsons on the gateway host.

Now we can submit the blueprints to be processed on the ambari-server using below commands.

  • curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d @<path to hdp.json> "http://<gateway-host>:8080/api/v1/stacks/HDP/versions/2.6/operating_systems/redhat6/repositories/HDP-2.6"
  • curl -u admin:admin -H "X-Requested-By: ambari" -X POST -d @<path to blueprint.json> "http://<gateway-host>:8080/api/v1/blueprints/myblueprint"
  • curl -u admin:admin -H "X-Requested-By: ambari" -X POST -d @<path to cluster.json> "http://<gateway-host>:8080/api/v1/clusters/myblueprint"

On successful execution of above commands we get response message in below format:

{ "href" : "http://<gateway-host>:8080/api/v1/clusters/myblueprint/requests/1", "Requests" : { "id" : 1, "status" : "Accepted" } }

We can now log-in to Ambari and check the background operations to see the components being installed and started on all the hosts.

3,421 Views
Comments
avatar
Super Collaborator

Thanks for this guide.. 🙂

...Will this work on a HA setup?