In order to follow along, you'll need:
- The HortonWorks Sanbox, or an Amazon account for hosting a HortonWorks Hadoop AMI.
- Python (with easy_install or pip)
- a Free OpenShift Online account
- and, the RHC command-line tool
The rhc command-line tool can be installed via RubyGems with:
gem install rhc
After signing up for an OpenShift account, and installing
rhc, you'll be able to configure your local machine to work with your new cloud applications:
Now that your development environment is ready, spin up a fresh copy of this app in a single command:
$ rhc app create todo python-2.7 --from-code=https://github.com/ryanj/flask-hbase-todos HBASE_HOST=MY_REMOTE_HBASE_HOST HBASE_PORT=9090
If you already have a Hadoop cluster available, enter it's host URL or IP address as the value to your application's
For this application, we'll use the
HBASE_HOST environment variable to help keep our source clean, and to help enhance the project's portability and reusablility.
If you choose to create your application using OpenShift's web workflow, or if you would like to make changes to your app's current "HBASE_HOST" setting, run the following (assuming "todo" is your app name):
$ rhc env set HBASE_HOST=MY_REMOTE_HBASE_HOST -a todo $ rhc env set HBASE_PORT=MY_REMOTE_HBASE_PORT -a todo
OpenShift operators can also make
hbase service connection strings available to developers as a cartridge, by installing a modified copy of this hbase-external cart into their OpenShift Enterprise or Origin environments.
AMIs from HortonWorks
Hosting your own Hadoop in the cloud is a breeze with the
HDP2_REDSHIFT_DEMO_AMI image, available in Amazon's US East Region.
Just click 'Launch', then open up port
9090 for outside access, allowing your OpenShift environment to connect directly to your new datastore.
Then, make sure to pass your
HBASE_PORT to your application through the system environment, as documented in the previous section.
The HortonWorks Sandbox is an excellent choice for local development scenarios.
After firing up the Sandbox virtual environement, you'll be presented with instructions on how to connect to the Hortonworks Hadoop web dashboard.
Support for Hbase can be enabled in just a click or two.
Flask, happybase, and a HoronWorks Sandbox are all required for setting up your local development environment.
When you create an application using the
rhc command-line tool, a local copy of your project source code will automatically be created for you to work with.
If you created your application using a web-based workflow, you can always retrieve your project source with:
rhc git-clone todo
Then, run the following to start your local server:
This code is dedicated to the public domain to the maximum extent permitted by applicable law, pursuant to CC0 (http://creativecommons.org/publicdomain/zero/1.0/)