有一种解决方法,您不需要 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