简体   繁体   English

我可以使用Presto创建Hive Metastore吗?

[英]Can I create a Hive metastore using Presto?

Basic question: Can I use Presto as the basis for my Hive metastore? 基本问题:我可以将Presto用作Hive Metastore的基础吗?

I am trying to install presto and hive on an amazon aws and I'm having trouble creating the Hive metastore. 我正在尝试在亚马逊aws上安装presto和hive,但无法创建Hive元存储库。 Presto seems to be installed and working properly apart from failing to connect to the metastore. 除无法连接到元存储之外,Presto似乎已安装并正常工作。 The problem is that when I run Hive, it fails to create a metastore. 问题是,当我运行Hive时,它无法创建元存储。

When I run Hive I get the following errors: 当我运行Hive时,出现以下错误:

Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:444)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:672)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:616)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
    at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1449)
    at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:63)
    at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:73)
    at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2661)
    at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2680)
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:425)
    ... 7 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1447)
    ... 12 more
Caused by: MetaException(message:Could not connect to meta store using any of the URIs provided. Most recent failure: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused
        at org.apache.thrift.transport.TSocket.open(TSocket.java:185)
        at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.open(HiveMetaStoreClient.java:358)
        at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:215)
        at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:73)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
        at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1447)
        at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:63)
        at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:73)
        at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2661)
        at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2680)
        at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:425)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:672)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:616)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at org.apache.thrift.transport.TSocket.open(TSocket.java:180)
        ... 20 more
)
at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.open(HiveMetaStoreClient.java:404)
    at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:215)
    at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:73)
    ... 17 more

My conf/hive-site.xml is as follows: 我的conf / hive-site.xml如下:

<property>
<name>hive.metastore.uris</name>
<value>thrift://ec2..........amazonaws.com:8080</value>
<description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore. </description>

<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:presto://ec2...........amazonaws.com:9083/hive;databaseName=metastore_db;create=true</value>
<description>JDBC connect string for a JDBC metastore</description>

<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>presto-jdbc-0.90.jar</value>
<description>Driver class name for a JDBC metastore</description>

Can I use presto to create my metastore or do I have to use mySQL or derby? 我可以使用presto创建我的metastore还是必须使用mySQL或derby? If I can, I would greatly appreciate any help I can get solving this. 如果可以的话,我将不胜感激,可以为您解决这个问题提供任何帮助。

Thanks! 谢谢!

Thanks for the replies so far. 到目前为止,感谢您的答复。

@Dain Sundstrom: I tried your suggestion of the bootstrap action, but had no real joy. @Dain Sundstrom:我尝试了您对自举操作的建议,但没有真正的喜悦。

Having done more research into the hive structure, I don't think it is possible to use presto as I was trying. 在对蜂巢结构进行了更多研究之后,我认为无法像我尝试的那样使用presto。 From what I understand now, presto uses hive as its database, but hive itself needs an underlying database of mySQL or derby which is where I was going wrong. 根据我现在的理解,presto使用hive作为其数据库,但是hive本身需要mySQL或derby的基础数据库,这正是我出问题的地方。 So my plan is to now install mySQL, link hive to it, and do it that way. 所以我的计划是现在安装mySQL,将配置单元链接到它,然后以这种方式进行。 Step 2 of that plan is pray it works without too much trouble. 该计划的第2步是祈祷它工作起来没有太多麻烦。

Thanks for your help. 谢谢你的帮助。

In theory you should be able to do this. 从理论上讲,您应该能够做到这一点。 But Presto needs a backend; 但是Presto需要后端。 which backed in Presto using for your metastore db? Presto支持哪个数据库用于您的元存储数据库? Whichever backend you use, it needs to support inserts. 无论使用哪种后端,都需要支持插入。

EMR有一个Presto引导操作 ,应为您处理所有设置。

You may use the following steps when storing your metastore to MySQL: 将元存储存储到MySQL时,可以使用以下步骤:

CREATE DATABASE metastore_db;

CREATE USER 'hiveuser'@'%' IDENTIFIED BY 'hivepassword';

GRANT all on *.* to 'hiveuser'@localhost identified by 'hivepassword';

flush privileges;

Once done add the below to your hive-site.xml in $HIVE_HOME/conf/ 完成后,将以下内容添加到$ HIVE_HOME / conf /中的hive-site.xml中

<property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://10.0.0.96/metastore_db?createDatabaseIfNotExist=true</value>
        <description>metadata is stored in a MySQL server</description>
        </property>

        <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
        <description>MySQL JDBC driver class</description>
        </property>

        <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>hiveuser</value>
        <description>user name for connecting to mysql server </description>
        </property>

        <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>hivepassword</value>
        <description>password for connecting to mysql server </description>
        </property>

        <property>
        <name>hive.metastore.uris</name>
        <value>thrift://10.0.0.96:9083</value>
        <description>Hive metastore Thrift server</description>
        </property>

Then start the metastore service : 然后启动metastore服务:

hive --service metastore & 蜂巢-服务metastore和

Just comment if you want to know more or you get stuck at something. 如果您想了解更多或陷入困境,请发表评论。

Regards, Devi Prasad. 此致,Devi Prasad。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM