14

我在一个环境中工作,我有一个 S3 服务被用作数据湖,而不是 AWS Athena。我正在尝试设置 Presto 以便能够查询 S3 中的数据,并且我知道我需要通过 Hive Metastore 服务将数据结构定义为 Hive 表。我在 Docker 中部署每个组件,因此我希望尽可能减小容器大小。我需要哪些 Hive 组件才能运行 Metastore 服务?我实际上并不关心运行 Hive,只关心 Metastore。我可以减少需要的东西,还是已经有一个预配置的包呢?我无法在网上找到任何不包括下载所有 Hadoop 和 Hive 的内容。我正在尝试做的事情可能吗?

4

4 回答 4

16

有一种解决方法,您不需要 hive 即可运行 presto。但是我还没有尝试过像 s3 这样的分布式文件系统,但是代码表明它应该可以工作(至少在 HDFS 上)。在我看来,这是值得尝试的,因为您根本不需要任何新的 docker 镜像用于 hive。

这个想法是使用内置的FileHiveMetastore。它既没有记录也不建议在生产中使用,但您可以使用它。架构信息存储在文件系统中的数据旁边。显然,它有它的优点和缺点。我不知道您的用例的详细信息,所以我不知道它是否符合您的需求。

配置:

connector.name=hive-hadoop2
hive.metastore=file
hive.metastore.catalog.dir=file:///tmp/hive_catalog
hive.metastore.user=cox

演示:

presto:tiny> create schema hive.default;
CREATE SCHEMA
presto:tiny> use hive.default;
USE
presto:default> create table t (t bigint);
CREATE TABLE
presto:default> show tables;
 Table
-------
 t
(1 row)

Query 20180223_202609_00009_iuchi, FINISHED, 1 node
Splits: 18 total, 18 done (100.00%)
0:00 [1 rows, 18B] [11 rows/s, 201B/s]

presto:default> insert into t (values 1);
INSERT: 1 row

Query 20180223_202616_00010_iuchi, FINISHED, 1 node
Splits: 51 total, 51 done (100.00%)
0:00 [0 rows, 0B] [0 rows/s, 0B/s]

presto:default> select * from t;
 t
---
 1
(1 row)

完成上述操作后,我能够在我的机器上找到以下内容:

/tmp/hive_catalog/
/tmp/hive_catalog/default
/tmp/hive_catalog/default/t
/tmp/hive_catalog/default/t/.prestoPermissions
/tmp/hive_catalog/default/t/.prestoPermissions/user_cox
/tmp/hive_catalog/default/t/.prestoPermissions/.user_cox.crc
/tmp/hive_catalog/default/t/.20180223_202616_00010_iuchi_79dee041-58a3-45ce-b86c-9f14e6260278.crc
/tmp/hive_catalog/default/t/.prestoSchema
/tmp/hive_catalog/default/t/20180223_202616_00010_iuchi_79dee041-58a3-45ce-b86c-9f14e6260278
/tmp/hive_catalog/default/t/..prestoSchema.crc
/tmp/hive_catalog/default/.prestoSchema
/tmp/hive_catalog/default/..prestoSchema.crc
于 2018-02-23T20:38:01.457 回答
12

It's now available standalone /hive-standalone-metastore-3.0.0/ in the Apache Hive distribution.

Beginning in Hive 3.0, the Metastore is released as a separate package and can be run without the rest of Hive. This is referred to as standalone mode.

By default the Metastore is configured for use with Hive, so a few configuration parameters have to be changed in this configuration.

metastore.task.threads.always -> org.apache.hadoop.hive.metastore.events.EventCleanerTask,org.apache.hadoop.hive.metastore.MaterializationsCacheCleanerTask
metastore.expression.proxy -> org.apache.hadoop.hive.metastore.DefaultPartitionExpressionProxy

Link to Docs

于 2019-01-17T06:11:38.550 回答
3

needing to set up hive just for the metastore seems cumbersome indeed. Have you considered using the AWS glue data catalog instead? This way you won’t have to manage anything. You can find detailed informations here: https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-presto-glue.html

于 2018-12-08T18:35:16.103 回答
3

我能够使用 Presto SQL amd HMS 3.0 与 AWS S3 集成。如果有帮助,我写了一篇文章。 https://www.linkedin.com/pulse/presto-sql-s3-abhishek-gupta

于 2020-11-03T01:02:25.107 回答