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

时间:2019-07-27 12:42:45

标签: service hive hadoop2

我一直在尝试建立Apache套件的本地单个大数据节点。我成功设置了hadoop和hdfs,yarn正常运行。但是,我一直在努力使Hive正常运行并运行了最后几个小时,但没有运气。当我说“ hive --services hiveserver2”时,在打印了几行之后,它挂了。我检查是否在端口10000上监听了什么,但没有。 下面是命令“ 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很大,我无法在此处粘贴它,但是如果您怀疑有任何财产,请告诉我,我将其粘贴在这里。

我想所有这些都与here中提到的某种SLF4J绑定冲突有关,但是我不知道处理该冲突所需的步骤。帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

我多次尝试使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开始。用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 db。不知道这是否有必要,但还是这么做了。

$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,所以我的命令很简单,如下所示。此步骤将根据您的操作系统而更改。

sudo apt-get install mysql-client mysql-server

之后,我下载了使HIVE正常工作所需的驱动程序。我使用了此链接(https://dev.mysql.com/downloads/connector/j/5.1.html),但这可能会因所使用的MySQL版本而异。解压缩/解压缩后,您将在解压缩/未解压缩的文件夹中看到两个(或更多).jar文件。 我将两个(或全部)(。jar文件)都复制到$ HIVE_HOME / lib中。

之后,我登录了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;

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

一旦进入mysql shell,一次键入以下几行。

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

然后我在bash shell中键入以下命令。许多警告来了。

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

然后我终于去了魔术命令。

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

在收到许多警告之后,我进入了我等待的命令提示符。结果如下。 仍然有很多警告,但我暂时会接受。我已经过去了三天。

Final Output

相关问题