[Hive]编译部署-hive-1.1.0-cdh5.7.0
2.部署
解压 # tar -xzvf ~/software/hive-1.1.0-cdh5.7.0.tar.gz -C ~/app/
配置环境变量
export HIVE_HOME=/home/hadoop/app/hive-1.1.0-cdh5.7.0
export PATH=$HIVE_HOME/bin:$PATH
下载mysql驱动包
用MVN下,新建一个Pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Spider</groupId>
<artifactId>Spider</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.17</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<excludeTransitive>false</excludeTransitive>
<stripVersion>true</stripVersion>
<outputDirectory>./lib</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
执行后,Jar包即在./lib文件夹 # mvn dependency:copy-dependencies
拷贝驱动包到Hive # cp ~/software/test/lib/mysql-connector-java.jar ~/app/hive-1.1.0-cdh5.7.0/lib/
修改配置
#cp ~/app/hive-1.1.0-cdh5.7.0/conf/hive-env.sh.template ~/app/hive-1.1.0-cdh5.7.0/conf/hive-env.sh
#vi ~/app/hive-1.1.0-cdh5.7.0/conf/hive-env.sh
编辑如下
HADOOP_HOME=/home/hadoop/app/hadoop-2.6.0-cdh5.7.0/bin/hadoop
#vi ~/app/hive-1.1.0-cdh5.7.0/conf/hive-site.xml
编辑如下:
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://hadoop000:3306/hive_basic?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>12abAB</value>
</property>
</configuration>
日志输出修改
#cp ~/app/hive-1.1.0-cdh5.7.0/conf/hive-log4j.properties.template ~/app/hive-1.1.0-cdh5.7.0/conf/hive-log4j.properties
#vi ~/app/hive-1.1.0-cdh5.7.0/conf/hive-log4j.properties
修改如下:
hive.log.dir=/home/hadoop/app/hive-1.1.0-cdh5.7.0/logs
启动Hive (必须是Hadoop启动的前提下)
#hive
mvn dependency:copy-dependencies