hiveserver2 在启动时挂起。没有监听端口 10000

hiveserver2 hangs while starting. Nothing listening on port 10000

我一直在尝试架设Apache套件的本地单一大数据节点。我成功地设置了 hadoop,hdfs 和 yarn 工作正常。然而,在过去的几个小时里,我一直在尝试启动 Hive 和 运行,但没有成功。当我说 "hive --services hiveserver2" 时,它在打印出几行后挂起。我检查了是否有任何东西在端口 10000 上侦听,但有 none。 下面是命令 "hive --services hiveserver2"

的输出
2019-07-27 17:55:54: Starting HiveServer2
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/particle/apache-hive-2.3.5-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/particle/hadoop-2.9.2/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]

由于 hive-site.xml 很大,我不能在这里通过它,但是如果您怀疑任何 属性,请告诉我,我会把它粘贴在这里。我已经从 tarball 而不是 maven 安装了 Hive。

我想所有这些都与提到的某种 SLF4J 绑定冲突有关 但我不知道处理它所需的步骤。非常感谢您的帮助。

我多次尝试让 Hive 通过 tar-ball 和 Maven 安装工作。不管怎样,它并没有发生。

下面是我如何让蜂巢开始工作的。 (2019 年 8 月 3 日)。

首先我下载了​​最新的 Hive .tar.gz 文件(截至今天为 3.1.1)。 下载后,我确保在 ~/.bashrc 文件中设置了以下内容。请注意 Java 版本为 1.8,Hadoop 版本为 2.9.2。不确定版本是否重要,但这些设置对我有用。

export JAVA_HOME=/home/particle/jdk1.8.0_221
export PATH=$JAVA_HOME/bin:$PATH
export HADOOP_HOME=/home/particle/hadoop-2.9.2
export PATH=$HADOOP_HOME/bin:$PATH
export HIVE_HOME=/home/particle/apache-hive-3.1.1-bin
export PATH=$HIVE_HOME/bin:$PATH

之后,我获取了 ~/.bashrc 文件(如下)。

source ~/.bashrc

在进一步进行之前,我确保 DFS 和 YARN 以及 运行。如果没有,请用 $HADOOP_HOME/sbin/start-dfs.sh 和 $HADOOP_HOME/sbin/start-yarn.sh start。用jps确认Namenode、SecondaryNameNode、DataNode、ResourceManager和NodeManager是运行.

然后我创建了几个目录并设置了所有权。有些目录可能已经存在,所以不用担心。

hadoop fs -mkdir       /tmp
hadoop fs -mkdir       /user
hadoop fs -mkdir       /user/hive/
hadoop fs -mkdir       /user/hive/warehouse
hadoop fs -chmod g+w   /tmp
hadoop fs -chmod g+w   /user/hive/warehouse

之后,我通过键入以下内容初始化了 derby 数据库。不确定是否有必要,但还是做了。

$HIVE_HOME/bin/schematool -dbType derby -initSchema

之后,我创建了一个名为'hive-site.xml' 的文件并放在$HIVE_HOME/conf 中。该文件具有以下内容。确保你做了适当的改变。我们下面要做的是设置使用 MySQL 作为 HIVE 的数据库。

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<configuration>
<property>
  <name>hadoop.proxyuser.TypeYourUserNameHereForTheOSOrVirtualOS.groups</name>
  <value>*</value>
</property>
<property>
  <name>hadoop.proxyuser.TypeYourUserNameHereForTheOSOrVirtualOS.hosts</name>
  <value>*</value>
</property>

<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:mysql://localhost/metastore?createDatabaseIfNotExist=true</value>
</property>


<property>
  <name>javax.jdo.option.ConnectionDriverName</name>
  <value>com.mysql.jdbc.Driver</value>
</property>


<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>TypeYourUserNameHereForTheOSOrVirtulOS_YouWillShortlyCreateThisUserInMySQL</value>
</property>

<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>TypeYourPassword_YouWillShortlyCreateThisPassWordInMySQL</value>
</property>

<property>
  <name>datanucleus.autoCreateSchema</name>
  <value>true</value>
</property>

<property>
  <name>datanucleus.fixedDatastore</name>
  <value>true</value>
</property>

<property>
 <name>datanucleus.autoCreateTables</name>
 <value>True</value>
 </property>
</configuration>

之后我安装了 MySQL 客户端和服务器。因为我使用的是 Ubuntu 所以我的命令很简单,如下所示。此步骤将根据您的 OS.

而改变
sudo apt-get install mysql-client mysql-server

之后,我下载了使 HIVE 工作所需的驱动程序。我使用了这个 link (https://dev.mysql.com/downloads/connector/j/5.1.html) 但这可能会有所不同,具体取决于您使用的 MySQL 版本。一旦你 unzip/untar 它,你将在 unzipped/untarred 文件夹中看到两个(或更多).jar 文件。 我在 $HIVE_HOME/lib.

中复制了两个(或全部)它们(.jar 文件)

之后我登录 mysql。由于我在安装时没有设置现有密码,因此我不得不使用以下命令。如果您已经有了 root/admin 登录名和密码,那么您可以跳过前三行。 请先确认你已经切换到以下目录 "$HIVE_HOME/scripts/metastore/upgrade/mysql/".

sudo mysql -u root
# It will first ask the super password associated with sudo
# Then it will either take you straight to the mysql prompt or it will ask for a password.
USE mysql;
CREATE USER 'YourUserNameThatYouSavedIn_hive-site.xml'@'localhost' IDENTIFIED BY 'YourPasswordThatYouSavedIn_hive-site.xml';
GRANT ALL PRIVILEGES ON *.* TO 'YourUserNameThatYouSavedIn_hive-site.xml'@'localhost';
FLUSH PRIVILEGES;
EXIT;

现在我有一个 MySQL 帐户与我在 hive-site.xml 中的设置相匹配。我使用上面创建的用户名和密码登录 MySQL 并键入以下命令,一次一个。

进入 mysql shell 后,一次输入一行。

DROP DATABASE IF EXISTS hive;
CREATE DATABASE hive;
USE hive;
SOURCE hive-schema-3.1.0.mysql.sql;
EXIT;

然后我在bashshell中输入了下面的命令。一大堆警告来了。

$HIVE_HOME/bin/schematool -dbType mysql --initSchema

然后终于到魔令了

$HIVE_HOME/bin/beeline -u jdbc:hive2://

经过大量警告后,我进入了我等待的命令提示符。下面是结果。 仍然有很多警告,但我暂时接受它。我过去 3 天一直在关注它。