You need the FQDNs and port numbers for the Hive metastore Thrift service. See [CDH] Finding the FQDNs and Verifying the Port Numbers Used for the Hive Metastore Thrift Service or [HDP] Finding the FQDNs and Verifying the Port Numbers Used for the Hive Metastore Thrift Service.
Replace the FQDNs in the examples with the FQDNs for your Hadoop nodes.
- On the prestoadmin node, log in as prestoadmin.
-
Create and open the hive.properties file.
- cd /home/prestoadmin/.prestoadmin/catalog
- vi hive.properties
-
Set up the hive.properties file as shown in the example, with the following entries.
Entry Value connector.name= hive-hadoop2 hive.metastore.uri= <FQDN and port number of the Hive metastore Thrift service used by default>,<FQDN and port number of the Hive metastore Thrift service used as a backup in a high availability system> hive.config.resources= /etc/hadoop/conf/core-site.xml,/etc/hadoop/conf/hdfs-site.xml hive.allow-drop-table= true This entry is used later for testing whether Presto is working for non-root users.The example shows a completed hive.properties file for a high availability system with two Hive metastores.connector.name=hive-hadoop2 hive.metastore.uri=thrift://xyz721m1.customer.com:9083,thrift://xyz721m2.customer.com:9083 hive.config.resources=/etc/hadoop/conf/core-site.xml,/etc/hadoop/conf/hdfs-site.xml hive.allow-drop-table=true
- Save the hive.properties file. ESC:wq
-
Change the permissions on the hive.properties file.
- chown prestoadmin:prestoadmin hive.properties
- chmod 660 hive.properties
-
[Optional] View the permissions of the
hive.properties file.
ls -l
Something similar to the following displays.
total 8 -rw-rw---- 1 prestoadmin prestoadmin 162 Aug 30 13:34 hive.properties -rw-rw---- 1 prestoadmin prestoadmin 19 Aug 30 08:18 tpch.properties
-
Add the hive connector.
/opt/prestoadmin/presto-admin catalog add hive
Something similar to the following displays.
Deploying hive.properties connector configurations on: xyz721d5.customer.com ... Deploying hive.properties connector configurations on: xyz721m1.customer.com
-
Restart Presto.
Always restart Presto when a connector is added or
removed.
/opt/prestoadmin/presto-admin server restart
Something similar to the following displays.
[xyz721m1.customer.com] out: Stopping presto [xyz721d5.customer.com] out: Stopping presto ... [xyz721d2.customer.com] out: Stopping presto [xyz721m1.customer.com] out: [xyz721d5.customer.com] out: Stopped 40000 [xyz721d4.customer.com] out: Stopped 37298 ... [xyz721d3.customer.com] out: Stopped 26326 [xyz721d5d5.customer.com] out: ... [xyz721m1.customer.com] out: Starting presto [xyz721m1.customer.com] out: Started as 27958 [xyz721m1.customer.com] out: Waiting to make sure we can connect to the Presto server on xyz721m1.customer.com, please wait. This check will time out after 2 minutes if the server does not respond. [xyz721d5.customer.com] out: Starting presto [xyz721d3.customer.com] out: Starting presto ... Server started successfully on: xyz721m1.customer.com ... Server started successfully on: xyz721d2.customer.com
-
Verify that the Hive connector is available.
/opt/prestoadmin/presto-admin server status
Something similar to the following displays. Note that the hive connector shows up in the catalog field.
Server Status: xyz721m1.customer.com(IP: 39.0.8.15, Roles: coordinator): Running Node URI(http): http://39.0.8.15:8285 Presto Version: 0.148-t.1.2 Node status: active Catalogs: hive, system, tpch Server Status: xyz721d2.customer.com(IP: 39.0.8.17, Roles: worker): Running Node URI(http): http://39.0.8.17:8285 Presto Version: 0.148-t.1.2 Node status: active Catalogs: hive, system, tpch ... Server Status: xyz721d5.customer.com(IP: 39.0.8.21, Roles: worker): Running Node URI(http): http://39.0.8.21:8285 Presto Version: 0.148-t.1.2 Node status: active Catalogs: hive, system, tpch