Hue Tutorial Part 1: FileBrowser, Metastore Manager and Beeswax

Hue is an interface for interacting with web applications that access the MapR Distributed File and Object Store (MapR XD). Use the applications in Hue to access MapR-FS, work with tables, run Hive queries, MapReduce jobs, and Oozie workflows.

The MapR Sandbox for Hadoop includes brief overviews and tutorials for the following Hue applications:

  • File Browser
  • Metastore Manager
  • Beeswax
  • Pig
  • Job Designer
  • Oozie

The tutorials are designed to help get you acquainted with HUE and MapR-FS. Use the tutorials to perform the following operations:

  • Upload files with File Browser2
  • Convert a file into a table with Metastore Manager
  • Run a simple Hive query on a table with Beeswax
  • Create and run a word count MapReduce job with Pig
  • Create and submit a MapReduce job design with Job Designer
  • Create and run a workflow with Oozie

Before You Begin

Download the following files for use in the tutorials:

Login to Hue

  • Login to Hue with the username mapr and password mapr.

Using File Browser

File Browser is an application that you can use to access files and directories in the MapR Distributed File and Object Store (MapR XD). Use File Browser in HUE to perform the following directory tasks:

  • Create directories
  • Upload, rename, transfer, and delete files and directories
  • Change the owner, group, and permissions of a file or directory
  • View and edit files as text or binary or download the files to your local system
  • View MapReduce job input and output files

In this tutorial, create a new directory, and upload the customers.csv file.

Create a new directory:

  1. Click .The File Browser - page opens.
  2. Select oozie to open the directory.
  3. Click the New button, and select Directory.
  4. Enter CustomerDirectory as the directory name.
  5. Click Submit. The CustomerDirectory appears in the list.

Upload a file:

  1. Open the CustomerDirectory.
  2. Click the Upload button, and select Files.
  3. Click Select Files in the pop up dialog.
  4. Navigate to the customers.csv file and upload the file. The file appears in the CustomerDirectory.

Example: /oozie/CustomerDirectory

Next: Use Metastore Manager to create a table from the customers.csv file that you just uploaded.

Using Metastore Manager

Metastore Manager is an application that you can use to manage databases, tables, and partitions stored in a relational database that applications, like HIVE, access through the metastore service API.

Use Metastore Manager to perform the following table operations:

  • Create tables
  • Browse tables
  • Import table data
  • Drop tables
  • View table location

Use Metastore Manager to perform the following database operations:

  • Select a database
  • Create a database
  • Drop a database

In this tutorial, import the customer.csv file, and create a table from the file.

Import the customer.csv file:

  1. Click . The Metastore Manager page opens.
  2. Under Actions, select Create a new table from a file.
  3. Enter customer_table as the table name and description.
  4. In the Input file field, browse to the CustomerDirectory, and upload the customer.csv file

  5. Select the Import data from file checkbox.

  6. Click Next.

Choose a delimiter:

  1. Select Comma as the delimiter.
  2. Click Next.

Define your columns:

  1. Enter column names. Enter State as the column name for col_6.
  2. Select column types that correlate with the data.
  3. Click Create table. A message, “Waiting for query” appears while the system creates the table.
  4. After the table is created, click on the Sample view to see the new table.

Next: Use Beeswax to run a Hive query on the table.

Using Beeswax

Beeswax is an application for querying data in Hive. Hive is a data warehouse system for Hadoop that uses an SQL-like language to query structured data in the MapR Distributed File and Object Store (MapR XD). You can access Beeswax from the HUE interface to run Hive queries with Hive's Query Language (HQL) and then save the queries.

In this tutorial, use Beeswax to run a basic Hive query against the customer_table you created.

Create and run a query:

  1. Click . The Hive Query page opens.
  2. In the Query Editor, enter the following query:
    SELECT * FROM customer_table WHERE state=”TX”
  3. Click Execute.
    The system processes the query and then displays all the customers located in Texas in the Results view.
  4. Optionally, save the query or download the query as a CSV or XLS file.