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.
ImportantWhen 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 | |
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 |
Download the JDBC driver of Presto
Log on to the cluster in SSH mode. For more information, see Log on to a cluster.
Run the following command to create a directory named presto-jdbc:
mkdir -p /opt/apps/presto-jdbc/
Download the required Java Database Connectivity (JDBC) JAR package and upload it to the /opt/apps/presto-jdbc/ directory.
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.
Upload the JAR package to the /opt/apps/presto-jdbc/ directory.
Run the following command to modify file permissions:
chmod 644 /opt/apps/presto-jdbc/*
Run the following command to edit the hue.sh file:
vim /etc/profile.d/hue.sh
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.
Load the JDBC driver of Presto
Go to the Hue configuration tab.
Log on to the Alibaba Cloud EMR console.
In the top navigation bar, select the region where your cluster resides and select a resource group based on your business requirements.
Click the Cluster Management tab.
Find your cluster and click Details in the Actions column.
In the left-side navigation pane, choose .
On the Hue service page, click the Configure tab.
In the Service Configuration section, click the hue tab.
Add parameters to Hue.
Click Custom Configuration in the upper-right corner.
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": ""} .
Click OK.
Save the configurations.
In the upper-right corner of the Service Configuration section, click Save.
In the Confirm Changes dialog box, specify Description and turn on Auto-update Configuration.
Click OK.
Deploy client configurations.
In the upper-right corner of the Service Configuration section, click Deploy Client Configuration.
In the Cluster Activities dialog box, specify Target Nodes, Actions on Failures, and Description.
Click OK.
In the Confirm message, click OK.
- In the Cluster Activities dialog box, configure the Description parameter and click OK.
- In the Confirm message, click OK.
- Click History in the upper-right corner to view the task progress.
Restart Hue.
In the upper-right corner of the Hue service page, choose .
In the Cluster Activities dialog box, specify Target Nodes, Actions on Failures, and Description.
Click OK.
In the Confirm message, click OK.
- In the Cluster Activities dialog box, configure the Description parameter and click OK.
- In the Confirm message, click OK.
- Click History in the upper-right corner to view the task progress.
Access the Presto service of the EMR cluster from Hue
In the left-side navigation pane of the Cluster Overview page, click Connect Strings.
Click the URL of Hue.
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.
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.
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.