Interconnecting Presto with OBS Using an IAM Agency
After configuring decoupled storage and compute for a cluster by referring to Interconnecting an MRS Cluster with OBS Using an IAM Agency, you can use presto_cli.sh client to create tables and store them in OBS.
Interconnecting Presto with OBS (Kerberos authentication is disabled for the cluster (in normal mode))
- Log in to the node where the client is installed as the client installation user.
For details about how to download and install the cluster client, see .
- Configure environment variables.
Go to the client installation directory.
cd Client installation directoryConfigure environment variables.
source bigdata_env
- Connect to the Presto client.
presto_cli.sh
- Create a schema and set location to an OBS path.
CREATE SCHEMA hive.demo WITH (location = 'obs://mrs-word001/presto-demo002/'); - Create a table in the schema. The table data is stored in the OBS file system.
CREATE TABLE hive.demo.demo_table WITH (format = 'ORC') AS SELECT * FROM tpch.sf1.customer;Figure 1 Return result
- Exit the client.
exit
Interconnecting Presto with OBS (Kerberos authentication is enabled for the cluster (in security mode))
- Log in to FusionInsight Manager of the MRS cluster.
For details about how to log in to FusionInsight Manager, see Accessing MRS Manager.
- Create a role with the Hive Admin Privilege permission, for example, prestorole. For how to create a role, see Managing MRS Cluster Roles.
- Create a user that belongs to the Presto and Hive groups and bind the role created in Step 2 to the user, for example, presto001. For how to create a user, see Creating an MRS Cluster User.
If a human-machine user is created, log in to MRS Manager as the new user and change the initial password.
- Download the user credential.
- For versions earlier than MRS 3.x, log in to MRS Manager, choose System > Manage User. Locate the row containing the new user, click More, and select Download Authentication Credential.
- Log in to FusionInsight Manager for MRS 3.x or later, choose System > Permission > 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, Client installation directory/Presto/.
For details about how to download and install the cluster client, see .
- Log in to the node where the client is installed as the client installation user.
- Obtain the user principal.
klist -kt Client installation directory/Presto/user.keytab - Configure environment variables.
Go to the client installation directory.
cd Client installation directoryConfigure environment variables.
source bigdata_env
- Connect to the Presto server of the cluster.
presto_cli.sh --krb5-config-path {krb5.conf file path} --krb5-principal {User principal} --krb5-keytab-path {user.keytab file path} --user {Presto username}
Table 1 How to obtain parameter values Parameter Value
How to Obtain
krb5.conf file path
Replace it with the file path set in Step 5, for example, Client installation directory/Presto/krb5.conf.
user.keytab file path
Replace it with the file path set in Step 5, for example, Client installation directory/Presto/user.keytab/opt/Bigdata/client/Presto/user.keytab.
User principal
Replace it with the result returned in Step 7.
Presto username
Replace it with the username created in Step 3, for example, presto001.
- Create a schema and set location to an OBS path.
CREATE SCHEMA hive.demo01 WITH (location = 'obs://mrs-word001/presto-demo002/');
- Create a table in the schema. The table data is stored in the OBS file system.
CREATE TABLE hive.demo01.demo_table WITH (format = 'ORC') AS SELECT * FROM tpch.sf1.customer;Figure 2 Returned result
- Exit the client.
exit
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.