All Products
Search
Document Center

E-MapReduce:Connect to Impala

Last Updated:Oct 22, 2024

This topic describes how to use a CLI to connect to Impala in the E-MapReduce (EMR) console.

Prerequisites

An EMR cluster is created, and Impala is selected when you create the cluster. For more information, see Create a cluster.

Use impala-shell to connect to Impala

Before you connect to Impala, you can run the impala-shell --help command to obtain help information.

Common cluster

  1. Log on to the master node of your cluster in SSH mode. For more information, see Log on to a cluster.

  2. Run the following command to connect to Impala:

    impala-shell -i <Node name of Impalad>

    To obtain the name of an Impalad node, go to the Status tab of the Impala service page of your cluster in the EMR console. The nodes of Impalad are displayed in the Topology List section. For example, in the following figure, the nodes core-1-1 and core-1-2 are displayed. You can replace <Node name of Impalad> in the preceding command with core-1-1 or core-1-2.impala

  3. Optional. Run the quit; command to exit the Impala CLI.

High-security cluster

  1. Log on to the master node of your cluster in SSH mode. For more information, see Log on to a cluster.

  2. Initialize a Kerberos credential.

    1. Run the following command to check whether Kerberos credentials are available:

      klist

      If the information klist: No credentials cache found is returned, initialize a Kerberos credential. If the returned information indicates that Kerberos credentials are available, run the impala-shell command to connect to Impala.

    2. Run the following command to view the information about a principal:

      klist -k $IMPALA_CONF_DIR/impala.keytab

      Save the first row of the returned information, which needs to be used in the following step. For example, save impala/master-1-1.c-45dcb9bbe234****.cn-hangzhou.emr.aliyuncs.com@EMR.C-45DCB9BBE23****.COM in the following figure.Principal

    3. Run the following command to initialize a Kerberos credential:

      kinit -k -t $IMPALA_CONF_DIR/impala.keytab <Principal information>
      Note

      Replace <Principal information> in the command with the row of information that you save in the previous step.

  3. Run the following command to connect to Impala:

    impala-shell -k -i <Node name of Impalad>
  4. Optional. Run the quit; command to exit the Impala CLI.

Use Beeline to connect to Impala

Common cluster

  1. Log on to the master node of your cluster in SSH mode. For more information, see Log on to a cluster.

  2. Run the following command to connect to Impala:

    beeline -u 'jdbc:hive2://<Node name of Impalad>:28000/default;transportMode=http;uauth=noSasl'
  3. Optional. Run the quit; command to exit the Impala CLI.

High-security cluster

  1. Log on to the core node of the cluster in SSH mode. For more information, see Log on to a cluster.

  2. Initialize a credential as the root user.

    1. Run the following command to check whether Kerberos credentials are available:

      klist

      If the information klist: No credentials cache found is returned, initialize a Kerberos credential. If the returned information indicates that Kerberos credentials are available, run the impala-shell command to connect to Impala.

    2. Run the following command to view the information about a principal:

      klist -k $IMPALA_CONF_DIR/impala.keytab

      Save the first row of the returned information, which needs to be used in the following step. For example, save impala/master-1-1.c-45dcb9bbe234****.cn-hangzhou.emr.aliyuncs.com@EMR.C-45DCB9BBE23****.COM in the following figure.image

    3. Run the following command to initialize a Kerberos credential:

      kinit -k -t $IMPALA_CONF_DIR/impala.keytab <Principal information>
      Note

      Replace <Principal information> in the command with the row of information that you save in the previous step.

  3. Run the following command as the root user to connect to Impala:

    beeline -u 'jdbc:hive2://<Node name of Impalad>:28000/default;principal=<Principal information>;transportMode=http'
  4. Optional. Run the !quit command to exit the Impala CLI.