无法在 Cygwin (Windows 10) 上的 Apache Hive 3.0.0 中初始化 HiveServer



我已经有一个由2台机器组成的Hadoop 3.0.0集群:1个namenode + RM和1个数据节点。我尝试按照此文档安装 Apache Hive 3.0.0。

当我在Cygwin上运行schematool -dbType derby -initSchema --verbose时,抛出了一个异常:

$ schematool -dbType derby -initSchema --verbose
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/BigSol/apache-hive-3.0.0-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/BigSol/hadoop-3.0.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL:        jdbc:derby:;databaseName=metastore_db;create=true
Metastore Connection Driver :    org.apache.derby.jdbc.EmbeddedDriver
Metastore connection User:       APP
Starting metastore schema initialization to 3.0.0
org.apache.hadoop.hive.metastore.HiveMetaException: Unknown version specified for initialization: 3.0.0
org.apache.hadoop.hive.metastore.HiveMetaException: Unknown version specified for initialization: 3.0.0
at org.apache.hadoop.hive.metastore.MetaStoreSchemaInfo.generateInitFileName(MetaStoreSchemaInfo.java:137)
at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:580)
at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:562)
at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:1445)
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:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:239)
at org.apache.hadoop.util.RunJar.main(RunJar.java:153)
*** schemaTool failed ***

在查看引发异常的代码行时,我发现 Hive 试图找到位于%HIVE_HOME%scriptsmetastoreupgradederbyhive-schema-3.0.0.derby.sql的 SQL 架构。

我怀疑Cygwin搞砸了路径,所以Hive没有找到那个模式。

我的问题:

  1. 如何更正路径(或解决问题(?
  2. 是否有批处理文件*.sh等效于%HIVE_HOME%binHive 2.1.1 目录中的文件?

我找到了解决方案。在Linux机器上运行schematool并将metastore_db目录复制到Windows机器后,我设法启动了HiveServer2,但beelineCLI说找不到C:cygdrivecBigSolapache-hive-3.0.0-binlibhive-beeline-3.1.0.jar中的jar。

事实证明,Cygwin中的java解析了错误的路径。我从C:cygdrivecC:做了一个象征性的链接,它奏效了。

最新更新