Hive部署

1、下载hive-1.1.0-cdh5.15.1.tar.gz到本地

(1)依据hadoop版本5.15.1,从而下载Hive的版本5.15.1

 [hadoop@hadoop000 software]$ ls
 hadoop-2.6.0-cdh5.15.1.tar.gz

(2)下载地址:https://archive.cloudera.com/p/cdh5/cdh5

压缩包保存的路径:D:\Hadoop

(3)从本地上传至服务器

输入:scp hive-1.1.0-cdh5.15.1.tar.gz hadoop@192.168.131.101:~/software/

然后输入密码:123456

(4)解压

在进入到software/:cd software/

查看文件内存大小:ll -lh

解压到服务器~/app/:

[hadoop@hadoop000 software]$ tar -zxvf hive-1.1.0-cdh5.15.1.tar.gz -C ~/app/

在app文件中显示hive-1.1.0-cdh5.15.1,即ok

 

2、将解压后的路径/home/hadoop/app/hive-1.1.0-cdh5.15.1拷贝到系统变量里

[hadoop@hadoop000 app]$ cd hive-1.1.0-cdh5.15.1
[hadoop@hadoop000 hive-1.1.0-cdh5.15.1]$ ls
auxlib  conf  docs      hcatalog  LICENSE  README.txt         scripts
bin     data  examples  lib       NOTICE   RELEASE_NOTES.txt
[hadoop@hadoop000 hive-1.1.0-cdh5.15.1]$ pwd
/home/hadoop/app/hive-1.1.0-cdh5.15.1
[hadoop@hadoop000 hive-1.1.0-cdh5.15.1]$ vi ~/.bash_profile

vi ~/.bash_profile中,添加导出Hive的路径

export HIVE_HOME=/home/hadoop/app/hive-1.1.0-cdh5.15.1
export PATH=$HIVE_HOME/bin:$PATH

生效

[hadoop@hadoop000 hive-1.1.0-cdh5.15.1]$ source ~/.bash_profile

查看Hive的home

[hadoop@hadoop000 hive-1.1.0-cdh5.15.1]$ echo $HIVE_HOME
/home/hadoop/app/hive-1.1.0-cdh5.15.1

 查看目录结构

[hadoop@hadoop000 hive-1.1.0-cdh5.15.1]$ ll
total 416
drwxr-xr-x 2 hadoop hadoop     48 Aug  9  2018 auxlib
drwxr-xr-x 3 hadoop hadoop    119 Aug  9  2018 bin  //存放脚本
drwxr-xr-x 2 hadoop hadoop    219 Nov 25  2018 conf //配置信息
drwxr-xr-x 3 hadoop hadoop     21 Aug  9  2018 data  //sql脚本数据信息
drwxr-xr-x 6 hadoop hadoop    110 Aug  9  2018 docs
drwxr-xr-x 4 hadoop hadoop     34 Aug  9  2018 examples
drwxr-xr-x 7 hadoop hadoop     68 Aug  9  2018 hcatalog
drwxr-xr-x 4 hadoop hadoop   8192 Nov 25  2018 lib  //hive所依赖的jar包
-rw-r--r-- 1 hadoop hadoop  24754 Aug  9  2018 LICENSE
-rw-r--r-- 1 hadoop hadoop    397 Aug  9  2018 NOTICE
-rw-r--r-- 1 hadoop hadoop   4048 Aug  9  2018 README.txt
-rw-r--r-- 1 hadoop hadoop 376416 Aug  9  2018 RELEASE_NOTES.txt
drwxr-xr-x 3 hadoop hadoop     23 Aug  9  2018 scripts

 

3、开始配置,添加HIVE_HOME到系统环境变量

[hadoop@hadoop000 hive-1.1.0-cdh5.15.1]$ cd conf/

(1)修改hive-env.sh

[hadoop@hadoop000 conf]$ ls
beeline-log4j.properties.template  hive-exec-log4j.properties.template  ivysettings.xml
hive-log4j.properties.template
hive-env.sh.template               hive-site.xml
[hadoop@hadoop000 conf]$ cp hive-env.sh.template hive-env.sh

 [hadoop@hadoop000 ~]$ echo $HADOOP_HOME
 /home/hadoop/app/hadoop-2.6.0-cdh5.15.1

 

 [hadoop@hadoop000 conf]$ vi hive-env.sh

# Set HADOOP_HOME to point to a specific hadoop install directory
# HADOOP_HOME=${bin}/../../hadoop

HADOOP_HOME=/home/hadoop/app/hadoop-2.6.0-cdh5.15.1

(2)修改hive-site.xml

在这里面配置mysql的信息

[hadoop@hadoop000 conf]$ vi hive-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:mysql://hadoop000:3306/hadoop_hive?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>root</value>
</property>

<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>root</value>
</property>
</configuration>

 

4、MySQL驱动jar包

使用MySQL,则需要驱动jar包

[hadoop@hadoop000 software]$ ls
mysql-connector-java-5.1.27-bin.jar

将驱动拷贝到以下路径:/home/hadoop/app/hive-1.1.0-cdh5.15.1/lib

[hadoop@hadoop000 software]$ cp mysql-connector-java-5.1.27-bin.jar /home/hadoop/app/hive-1.1.0-cdh5.15.1/lib

 [hadoop@hadoop000 lib]$ ll mysql-connector-java-5.1.27-bin.jar
  -rw-r--r-- 1 hadoop hadoop 872303 Nov 25 2018 mysql-connector-java-5.1.27-bin.jar

 

5、前提是要准备安装一个MySQL数据库

     yum install安装一个MySQL数据库

 

posted @ 2021-07-30 16:45  酱汁怪兽  阅读(71)  评论(0编辑  收藏  举报