The purpose of the samples within the {GATEWAY_HOME}/samples
directory is to demonstrate the capabilities of the Apache Knox Gateway to provide access to the numerous APIs that are available from the service components of a Hadoop cluster.
Depending on exactly how your Knox installation was done, there will be some number of steps required in order fully install and configure the samples for use.
This section will help describe the assumptions of the samples and the steps to get them to work in a couple of different deployment scenarios.
The samples were initially written with the intent of working out of the box for the various Hadoop demo environments that are deployed as a single node cluster inside of a VM. The following assumptions were made from that context and should be understood in order to get the samples to work in other deployment scenarios:
{GATEWAY_HOME}/conf/topologies
directory that is configured to point to the actual host and ports of running service components.There should be little to do if anything in a demo environment that has been provisioned with illustrating the use of Apache Knox.
However, the following items will be worth ensuring before you start:
sandbox.xml
topology is configured properly for the deployed servicesApache Knox instances that are under the management of Ambari are generally assumed not to be demo instances. These instances are in place to facilitate development, testing or production Hadoop clusters.
The Knox samples can however be made to work with Ambari managed Knox instances with a few steps:
You need to have SSH access to the environment in order for the localhost assumption within the samples to be valid
The Knox Demo LDAP Server is started - you can start it from Ambari
The default.xml
topology file can be copied to sandbox.xml
in order to satisfy the topology name assumption in the samples
Be sure to use an actual Java JRE to run the sample with something like:
/usr/jdk64/jdk1.7.0_67/bin/java -jar bin/shell.jar samples/ExampleWebHdfsLs.groovy
For manually installed Knox instances, there is really no way for the installer to know how to configure the topology file for you.
Essentially, these steps are identical to the Ambari deployed instance except that #3 should be replaced with the configuration of the out of the box sandbox.xml
to point the configuration at the proper hosts and ports.
You need to have SSH access to the environment in order for the localhost assumption within the samples to be valid.
The Knox Demo LDAP Server is started - you can start it from Ambari
Change the hosts and ports within the {GATEWAY_HOME}/conf/topologies/sandbox.xml
to reflect your actual cluster service locations.
Be sure to use an actual Java JRE to run the sample with something like:
/usr/jdk64/jdk1.7.0_67/bin/java -jar bin/shell.jar samples/ExampleWebHdfsLs.groovy