For this tutorial, we assume you are either using the standalone Kiji BentoBox or have installed the individual components described here. If you don't have a working environment yet, you can install the standalone Kiji BentoBox in three quick steps!

Download and Untar KijiExpress

Download KijiExpress from here.

tar xzf kiji-express-0.1.0.tar.gz
cd kiji-express-0.1.0
export PATH=${PATH}:${PWD}/bin

Download, Untar, and Compile Tutorial

Download the KijiExpress Music Tutorial here. Untar the project into a directory <path/to/tutorial/root/dir>:

tar xzf <path/to/tar/ball>
export MUSIC_EXPRESS_HOME=<path/to/tutorial/root/dir>

The source is included along with a Maven project. Starting a Maven project that uses Kiji? Read the Maven setup instructions. or the Apache Maven Homepage.

The following tools are required to compile this project:

  • Maven 3.x
  • Java 6

To compile, run mvn package from $MUSIC_EXPRESS_HOME. The build artifacts (.jar files) will be placed in the $MUSIC_EXPRESS_HOME/target/ directory. This tutorial assumes you are using the pre-built jars included with the music recommendation example under $MUSIC_EXPRESS_HOME/lib/. If you wish to use jars of example code that you have built, you should adjust the command lines in this tutorial to use the jars in $MUSIC_EXPRESS_HOME/target/.

If you already installed BentoBox, make sure you have started it:

cd <path/to/bento>
source bin/kiji-env.sh
bento start

Set Environment Variables

After Bento starts, it will display ports you will need to complete this tutorial. It will be useful to know the address of the MapReduce JobTracker webapp (http://localhost:50030 by default) while working through this tutorial.

It will be useful to define an environment variable named KIJI that holds a Kiji URI to the Kiji instance we’ll use during this tutorial.

export KIJI=kiji://.env/kiji_express_music

To work through this tutorial, various Kiji tools will require that Avro data type definitions particular to the working music recommendation example be on the classpath. You can add your artifacts to the Kiji classpath by running:

export EXPRESS_CLASSPATH=${MUSIC_EXPRESS_HOME}/lib/*
export KIJI_CLASSPATH=${EXPRESS_CLASSPATH}

Install Kiji and Create Tables

Install your Kiji instance:

kiji install --kiji=${KIJI}

Create the Kiji music tables that have layouts described in music-schema.ddl.

kiji-schema-shell --kiji=${KIJI} --file=${MUSIC_EXPRESS_HOME}/music-schema.ddl

This command uses kiji-schema-shell to create the tables using the KijiSchema DDL, which makes specifying table layouts easy. See the KijiSchema DDL Shell reference for more information on the KijiSchema DDL.

Upload Data to HDFS

Upload the data set to HDFS:

hadoop fs -mkdir express-tutorial
hadoop fs -copyFromLocal ${MUSIC_EXPRESS_HOME}/example_data/*.json express-tutorial/