Amazon Elastic MapReduce
Developer Guide (API Version 2009-03-31)
Did this page help you?  Yes | No |  Tell us about it...
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.

Using Hive Interactively or in Batch Mode

Amazon EMR enables you to run Hive scripts or queries in two modes:

  • Interactive

  • Batch

When you launch a long-running cluster using the console or the AWS CLI, you can ssh into the master node as the Hadoop user and use the Hive Command Line Interface to develop and run your Hive scripts interactively. Using Hive interactively enables you to revise the Hive script more easily than batch mode. After you successfully revise the Hive script in interactive mode, you can upload the script to Amazon S3 and use batch mode to run the script in production.

To use Hive interactively in the Amazon EMR CLI, use the --hive-interactive parameter when you launch the cluster.

In batch mode, you upload your Hive script to Amazon S3, and then submit the work to the cluster as a step. Hive steps can be submitted to a long-running cluster or a transient cluster. For more information on submitting work to a cluster, see Submit Work to a Cluster. An example of launching a long-running cluster and submitting a Hive step can be found here: Launch a Cluster and Submit Hive Work.

To launch a cluster in interactive mode using the Amazon EMR CLI

Note

The Amazon EMR CLI is no longer under feature development. Customers are encouraged to use the Amazon EMR commands in the AWS CLI instead.

  • In the directory where you installed the Amazon EMR CLI, type the following command line. For more information, see the Command Line Interface Reference for Amazon EMR.

    • Linux, UNIX, and Mac OS X users:

      ./elastic-mapreduce --create --alive --name "Hive cluster" \
      --num-instances 5 --instance-type m1.large \
      --hive-interactive
    • Windows users:

      ruby elastic-mapreduce --create --alive --name "Hive cluster" --num-instances 5 --instance-type m1.large --hive-interactive

    Note

    The --hive-interactive parameter is only required by the Amazon EMR CLI. You do not need to use this parameter when launching a cluster using the AWS CLI.