How Do I Access Presto in a Cluster with Kerberos Authentication Enabled?
- Log in to the Master node in the cluster as user root.
- Run the following command to configure environment variables:
- Access Presto in a cluster with Kerberos authentication enabled.
- Log in to MRS Manager and create a role with the Hive Admin Privilege permission, for example, prestorerole.
- Create a user, for example, presto001, who belongs to the Presto and Hive groups, and bind the user to the role created in 3.a.
- Authenticate user presto001.
kinit presto001
- Download the user authentication credential.
- Operations on MRS Manager: Log in to MRS Manager and choose System > Manage User. Locate the row containing the new user, click More, and select Download authentication credential.
Figure 1 Downloading the Presto user authentication credential
- Operations on FusionInsight Manager:
Log in to FusionInsight Manager, choose System > Permission > User. On the displayed page, locate the row that contains the user, choose More > Download Authentication Credential.
- Operations on MRS Manager: Log in to MRS Manager and choose System > Manage User. Locate the row containing the new user, click More, and select Download authentication credential.
- Decompress the downloaded user credential file, and save the obtained krb5.conf and user.keytab files to the client directory, for example, /opt/client/Presto/.
- Run the following command to obtain the user principal:
- Run the following command to connect to the Presto Server of the cluster:
presto_cli.sh --krb5-config-path {krb5.conf file path} --krb5-principal {User's principal} --krb5-keytab-path {user.keytab file path} --user {presto username}
- krb5.conf file path: file path set in 3.e, for example, /opt/client/Presto/krb5.conf.
- user.keytab file path: file path set in 3.e, for example, /opt/client/Presto/user.keytab.
- User's principal: principal obtained in 3.f.
- presto username: user created in 3.b, for example, presto001.
Example: presto_cli.sh --krb5-config-path /opt/client/Presto/krb5.conf --krb5-principal prest001@xxx_xxx_xxx_xxx.COM --krb5-keytab-path /opt/client/Presto/user.keytab --user presto001
- On the Presto client, run the following statement to create a schema:
CREATE SCHEMA hive.demo01 WITH (location = 'obs://presto-demo002/');
- Create a table in the schema. The table data is stored in the OBS bucket, as shown in the following example:
CREATE TABLE hive.demo01.demo_table WITH (format = 'ORC') AS SELECT * FROM tpch.sf1.customer;
Figure 2 Return result
- Run exit to exit the client.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.