1.解压hive文件
tar -zxvf /usr/local/moudle/apache-hive-1.2.1-bin.tar.gz -C /usr/local/soft/
2.修改目录名称:
mv apache-hive-1.2.1-bin hive-1.2.1
3.进入hive-1.2.1下的/conf目录进行备份
cp hive-env.sh.template hive-env.sh
cp hive-default.xml.template hive-site.xml
4.配置hive的配置文件
4.1 修改hive-env.sh
增加:
HADOOP_HOME=/usr/local/soft/hadoop-2.7.6
JAVA_HOME=/usr/local/soft/jdk1.8.0_171
HIVE_HOME=/usr/local/soft/hive-1.2.1
4.2 修改hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://master:3306/hive?characterEncoding=UTF-8&createDatabaseIfNotExist=true&useSSL=false</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>123456</value>
</property>
<property>
<name>hive.querylog.location</name>
<value>/usr/local/soft/hive-1.2.1/tmp</value>
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/usr/local/soft/hive-1.2.1/tmp</value>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/usr/local/soft/hive-1.2.1/tmp</value>
</property>
5.复制mysql连接工具包到hive/lib
cd /usr/local/soft/hive-1.2.1
cp /usr/local/moudle/mysql-connector-java-5.1.49.jar /usr/local/soft/hive-1.2.1/lib/
6.删除hadoop中自带的jline-2.12.jar
位置在/usr/local/soft/hadoop-2.7.6/share/hadoop/yarn/lib/jline-2.12.jar
rm -rf /usr/local/soft/hadoop-2.7.6/share/hadoop/yarn/lib/jline-2.12.jar
7.把hive自带的jline-2.12.jar复制到hadoop中
hive中所在位置/usr/local/soft/hive-1.2.1/lib/jline-2.12.jar
cp /usr/local/soft/hive-1.2.1/lib/jline-2.12.jar /usr/local/soft/hadoop-2.7.6/share/hadoop/yarn/lib/
8.启动
先启动hadoop集群和mysql服务
hive