Verify that Presto CLI is accessible and working for non-root users. In this guide, Hive is the example connector.
-
Log in as a non-root user.
-
Enter the following to verify that Presto is in the user $PATH.
type presto
Something similar to the following displays.
presto is hashed (/usr/bin/presto)
-
Enter the following to verify that the user can access Presto CLI and run a command.
presto --help
Presto help displays.
NAME presto - Presto interactive console SYNOPSIS presto [--catalog <catalog>] ... --version Display version information and exit
-
Enter the following to verify that Presto is in the user $PATH.
type presto
-
Log in to the Presto SQL Engine and use the following to verify the connection.
presto --server <FQDN of presto coordinator node>:8285 --catalog hive --schema <schema for hive>--user <user name>
The procedures assume that the <schema for hive> is default.Logging in to Presto starts a Presto session and displays a Presto prompt. For example:
presto:default>
-
As a non-root user, enter the following at the Presto CLI command line prompt to verify that the user can run a Presto CLI command from within a Presto session.
presto:default>
help
Presto help displays.
Supported commands: QUIT EXPLAIN [ ( option [, ...] ) ] <query> options: FORMAT { TEXT | GRAPHVIZ } TYPE {LOGICAL | DISTRIBUTED } DESCRIBE <table> SHOW COLUMNS FROM <table> SHOW FUNCTIONS SHOW CATALOGS SHOW SCHEMAS SHOW TABLES [LIKE <pattern>] SHOW PARTITIONS FROM <table> [WHERE ...] [ORDER BY ...] [LIMIT n] USE [<catalog>.]<schema>
-
As a non-root user, run the following Presto CLI commands as a test.
-
presto:default>
show catalogs;
Something similar to the following displays.
Catalog ----------- hive system (3 rows) Query 20160819_144644_00017_72pyd, FINISHED, 1 node Splits: 1 total, 1 done (100.00%) 0:00 [0 rows, 0B] [0 rows/s, 0B/s]
-
presto:default>
show schemas;
Something similar to the following displays.
Schema -------------------- default information_schema (2 rows) Query 20160819_144755_00020_72pyd, FINISHED, 2 nodes Splits: 2 total, 2 done (100.00%) 0:00 [15 rows, 185B] [48 rows/s, 598B/s]
-
presto:default>
show catalogs;
Something similar to the following displays.
-
Test the Presto CLI table commands.
-
presto:default>
create table prestotable (c1 bigint);
The table is created, and the following displays.
CREATE TABLE
-
presto:default>
show tables;
Something similar to the following displays.
Table --------- prestotable (1 row) Query 20160819_144842_00021_72pyd, FINISHED, 2 nodes Splits: 2 total, 2 done (100.00%) 0:00 [1 rows, 31B] [3 rows/s, 99B/s]
-
presto:default>
describe prestotable;
Something similar to the following displays.
Column | Type | Comment --------+--------+--------- c1 | bigint | (1 row) Query 20160819_145755_00027_72pyd, FINISHED, 2 nodes Splits: 2 total, 2 done (100.00%) 0:00 [1 rows, 75B] [2 rows/s, 211B/s]
-
presto:default>
drop table prestotable;
The table is dropped, and the following displays.
DROP TABLE
If hive.properties does not contain the entry hive.allow-drop-table=true, the table is not dropped, and the following message displays.
Query 20160819_152338_00028_72pyd failed: Access Denied: Cannot drop table <user name>.prestotable
-
presto:default>
create table prestotable (c1 bigint);
The table is created, and the following displays.