Hive2.3.5的安装

这节到了hive2.3.5的安装了,我之前已经安装了hbase和zookeeper,当然,还有mysql,并且实际中没有用默认的derby,而是利用mysql做元数据库。只需要在master节点安装mysql就可以了,slave节点不用安装即可。并且安装过程中很容易出现我下面问题中出现的问题1,所以遇到马上解决掉最好。

(1)首先放上下载地址:http://mirror.bit.edu.cn/apache/hive/hive-2.3.5/

我的安装版本是这样的,当然你安装时也可以按照你自己的环境进行下载安装,大体流程应该一样的。

(2)下载之后进行解压,一如既往地放在/opt/文件夹下

tar -zxvf apache-hive-2.3.5-bin.tar.gz

修改环境变量

vim /etc/profile

export HIVE_HOME=/opt/apache-hive-2.3.5-bin
export PATH=$PATH:$HIVE_HOME/bin

激活环境变量

source /etc/profile

(3)修改hive配置文件

cd /opt/apache-hive-2.3.5-bin/conf

cp hive-default.xml.template hive-site.xml

vim hive-site.xml

这里我放上我的所有hive-site.xml的代码:

<?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>
  <!-- WARNING!!! This file is auto generated for documentation purposes ONLY! -->
  <!-- WARNING!!! Any changes you make to this file will be ignored by Hive.   -->
  <!-- WARNING!!! You must make your changes in hive-site.xml instead.         -->
  <!-- Hive Execution Parameters -->
  <!-- 插入的代码 -->
    <property>
        <name>hive.metastore.local</name>
        <value>true</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>hive</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>mysql</value>
    </property>
   <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://master:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>
</configuration>

(4)将mysql的jdbc驱动程序放在hive的/lib/目录下,并且给他一定的权限

chmod 777 mysql-connector-java-5.1.7-bin.jar

(5)准备就绪,我的流程是在mysql下创建一个hive数据库,并且对于上面配置文件中对应的用户和密码进行创建

首先看下mysql服务器是否开启了

service mysql status

已经开启了

登录:

mysql -uroot -p1234

CREATE USER 'hive' IDENTIFIED BY  'mysql';

GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' WITH GRANT OPTION;

退出重新登录,并且利用hive用户进行hive数据库的创建

mysql -uhive -pmysql

create database hive;

show databases;

发现已经创建成功了,就可以去初始化hive了

(6)初始化hive

schematool -dbType mysql -initSchema

(7)成功后进入hive shell,进行一些操作试试手就可以了

 

bin/hive shell

show databases;

create database bai;

create table bai;

...

不报错的话就说明成功了,要是报错的话,哈哈下面我列了几个常见的问题也是我出现的问题,可以看下

Q1:Caused by: java.net.ConnectException: Connection refused (Connection refused)

   看看这个端口状态:
    $ netstat -an | grep "3306"
    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN 

    Mysql服务只监听本地(127.0.0.1)的端口,没有监听网络机器,在/etc/mysql/下:
cd    /etc/mysql/

vim ./mysql.conf.d/mysqld.cnf
    注释掉127.0.0.1

Q2:连接MySQL时发出的警告WARN: Establishing SSL connection without server's identity verification

在连接后面加上&amp;useSSL=false(这里我已经加上了)

Q3:重点在元数据库的初始化与创建阶段容易出错

Q4:启动hive时可能会遇到Required table missing : "DBS`" in Catalog "" Schema "(这个问题我没有解决,因为配置文件已经被改造过了,这些配置已经没有了)

在配置文件hive-sit.xml中,将datanucleus.schema.autoCreateAll的值改为true

Q5:

首先进入hive/bin目录下

执行命令   ./hive --service metastore &

然后进入hive数据库

暂时就这些,有些东西遇到再继续添加吧

 

 

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yann.bai

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值