By default, you can directly access the Presto service of an E-MapReduce (EMR) cluster from Hue in EMR V3.33.0 or later V3.X.X, or in EMR V4.6.0 or later V4.X.X. In the earlier EMR versions, to access the Presto service of an EMR cluster from Hue, you must configure related parameters for Hue. This topic describes how to configure the parameters.

Prerequisites

  • A cluster of EMR V3.X.X earlier than V3.33.0, or EMR V4.X.X earlier than V4.6.0 is created, and Presto is selected from the optional services during cluster creation. For more information, see Create a cluster.
  • A security group rule is configured. For more information, see Security groups.
    Notice When you set the authorization object in the security group rule, enter only the Classless Inter-Domain Routing (CIDR) blocks or IP addresses that need to access Hue. Do not enter the CIDR block 0.0.0.0/0.
  • Port 8888 is enabled. For more information, see Access the web UIs of open source components.

Step 1: Download the JDBC driver of Presto

  1. Connect to the master node of the cluster in SSH mode. For more information, see Connect to the master node of an EMR cluster in SSH mode.
  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.
    Link: 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
  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

Step 2: 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. Find your cluster and click Details in the Actions column.
    4. In the left-side navigation pane, choose Cluster Service > Hue.
    5. On the Hue service page, click the Configure tab.
    6. In the Service Configuration section, click the hue tab.
  2. Add configuration items for Hue.
    1. Click Custom Configuration in the upper-right corner.
    2. In the Add Configuration Item dialog box, add configuration items.
      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": ""}.
    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.
      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.
      Click History in the upper-right corner to view the task progress.

Step 3: 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 link of Hue.
    Hue_port

    Log on to the Hue web UI as the default user admin. For more information about how to obtain the initial password, see View the initial password of the default administrator in Hue.

  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. Presto
  4. Optional:Test connectivity.
    1. On the Hue web UI, choose Query > Editor > Presto.
    2. Run the following command to query the schemas on your cluster:
      show schemas
      The query results are displayed on the Results tab, as shown in the following figure. Presto_schema