All Products
Search
Document Center

E-MapReduce:Configure Hue to support access to Presto

Last Updated:Dec 21, 2023

This topic describes how to configure Hue to support access to Presto.

Prerequisites

  • An EMR cluster is created, and Presto is selected from the optional services when you create the cluster.

  • Port 8888 is enabled.

    Important

    When you set the authorization object in the security group rule, enter only the CIDR blocks or IP addresses that need to access Hue. Do not enter the CIDR block 0.0.0.0/0.

Procedure

The following table describes whether access to Presto from Hue is supported by default in different EMR versions and how to configure Hue to support the access if it is not supported by default.

Version

Supported by default

Procedure

A minor version earlier than EMR V3.33.0 or a minor version earlier than EMR V4.6.0

No

  1. Download the JDBC driver of Presto

  2. Load the JDBC driver of Presto

  3. Access the Presto service of the EMR cluster from Hue

EMR V3.33.0 or later versions earlier than EMR V3.38, or EMR V4.6.0 or later versions earlier than EMR V5.5.0

Yes

You can directly access the Presto service without any configurations. For more information, see Access the Presto service of the EMR cluster from Hue.

EMR V3.38, EMR V5.5.0, or a minor version later than EMR V3.38 or EMR V5.5.0

No

  1. Load the JDBC driver of Presto

  2. Access the Presto service of the EMR cluster from Hue

Download the JDBC driver of Presto

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

  2. Run the following command to create a directory named presto-jdbc:

    mkdir -p /opt/apps/presto-jdbc/
  3. Download the required Java Database Connectivity (JDBC) JAR package and upload it to the /opt/apps/presto-jdbc/ directory.

    1. Download presto-jdbc.

      You can determine the JDBC JAR package to be downloaded based on the version of your EMR cluster. In this example, the cluster version is EMR V3.32.0, which corresponds to Presto 338. Therefore, you must download the JDBC JAR package whose version is 338.

      The following figure shows the JDBC JAR package. JDBC-JAR

    2. Upload the JAR package to the /opt/apps/presto-jdbc/ directory.

  4. Run the following command to modify file permissions:

    chmod 644 /opt/apps/presto-jdbc/*
  5. Run the following command to edit the hue.sh file:

    vim /etc/profile.d/hue.sh
  6. Add the following content to the end of the hue.sh file:

    export CLASSPATH=/opt/apps/presto-jdbc/*:$CLASSPATH

    The following figure shows the added content in the file.Edit file

Load the JDBC driver of Presto

  1. Go to the Hue configuration tab.

    1. Log on to the Alibaba Cloud EMR console.

    2. In the top navigation bar, select the region where your cluster resides and select a resource group based on your business requirements.

    3. Click the Cluster Management tab.

    4. Find your cluster and click Details in the Actions column.

    5. In the left-side navigation pane, choose Cluster Service > Hue.

    6. On the Hue service page, click the Configure tab.

    7. In the Service Configuration section, click the hue tab.

  2. Add parameters to Hue.

    1. Click Custom Configuration in the upper-right corner.

    2. In the Add Configuration Item dialog box, add the following parameters.

      • A minor version earlier than EMR V3.33.0 or a minor version earlier than EMR V4.6.0

        Parameter

        Description

        notebook.interpreters.presto.name

        Set the parameter to Presto.

        notebook.interpreters.presto.interface

        Set the parameter to jdbc.

        notebook.interpreters.presto.options

        Set the parameter to {"url": "jdbc:presto://emr-header-1:9090/hive/default", "driver": "com.facebook.presto.jdbc.PrestoDriver", "user": "hadoop", "password": ""}.

      • EMR V3.38, EMR V5.5.0, or a minor version later than EMR V3.38 or EMR V5.5.0

        Parameter

        Description

        notebook.interpreters.presto.options

        Set the parameter to {"url": "jdbc:trino://emr-header-1:9090/hive/default", "driver": "io.trino.jdbc.TrinoDriver", "user": "hadoop", "password": ""} .

    3. Click OK.

  3. Save the configurations.

    1. In the upper-right corner of the Service Configuration section, click Save.

    2. In the Confirm Changes dialog box, specify Description and turn on Auto-update Configuration.

    3. Click OK.

  4. Deploy client configurations.

    1. In the upper-right corner of the Service Configuration section, click Deploy Client Configuration.

    2. In the Cluster Activities dialog box, specify Target Nodes, Actions on Failures, and Description.

    3. Click OK.

    4. In the Confirm message, click OK.

      1. In the Cluster Activities dialog box, configure the Description parameter and click OK.
      2. In the Confirm message, click OK.
      3. Click History in the upper-right corner to view the task progress.
  5. Restart Hue.

    1. In the upper-right corner of the Hue service page, choose Actions > Restart Hue.

    2. In the Cluster Activities dialog box, specify Target Nodes, Actions on Failures, and Description.

    3. Click OK.

    4. In the Confirm message, click OK.

      1. In the Cluster Activities dialog box, configure the Description parameter and click OK.
      2. In the Confirm message, click OK.
      3. Click History in the upper-right corner to view the task progress.

Access the Presto service of the EMR cluster from Hue

  1. In the left-side navigation pane of the Cluster Overview page, click Connect Strings.

  2. Click the URL of Hue.

    Hue_port

    Log on to the Hue web UI as the default user admin. You can view the value of the admin_pwd parameter on the Hue configuration page to obtain the initial password. For more information, see View the initial password.

  3. Access the Presto service of the EMR cluster on the Hue web UI.

    Information about Presto is displayed on the Hue web UI. You can access the Presto service of the EMR cluster.

  4. Optional:Test the connectivity.

    Run the following command in Presto SQL to query the schemas on your cluster:

    show schemas

    If related information is returned, the connectivity is normal.