HADOOP安装HIVE
hive安装配置
eg: 版本2.3.8
HADOOP配置HA集群
添加环境变量
# <<<<<< hive start
export HIVE_HOME=/home/hadoop/hive-2.3.8
export PATH=$PATH:$HIVE_HOME/bin
# >>>>>> hive end
配置文件$HIVE_HOME/conf/hive-env.sh
HADOOP_HOME=/home/hadoop/hadoop-3.2.2
配置mysql-connector链接文件
mysql官网下载连接文件 mysql-connector-java-8.0.24.tar.gz
- 使用版本大于5.7的连接文件时javax.jdo.option.ConnectionDriverName配置参数为com.mysql.cj.jdbc.Driver
- 使用版本小于等于5.7的连接文件时javax.jdo.option.ConnectionDriverName配置参数为com.mysql.jdbc.Driver
配置文件$HIVE_HOME/conf/hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://master:3306/hive?createDatabaseIfNotExist=TRUE&useSSL=FALSE</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.cj.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
<description>password to use against metastore database</description>
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/home/hadoop/hive-2.3.8/tmp</value>
<description>Local scratch space for Hive jobs</description>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/home/hadoop/hive-2.3.8/tmp</value>
<description>Temporary local directory for added resources in the remote file system.</description>
</property>
jar包冲突问题
- 删除hive中的guava文件
mv $HIVE_HOEM/lib/guava-14.0.1.jar $HIVE_HOEM/lib/guava-14.0.1.back
- 复制$HADOOP_HOME/share/hadoop/common/lib/guava-27.0-jre.jar
cp $HADOOP_HOME/share/hadoop/common/lib/guava-27.0-jre.jar $HIVE_HOEM/lib/
复制文件至从节点中
scp -r /home/hadoop/hive-2.3.8 hadoop@node1:/home/hadoop/
scp -r /home/hadoop/hive-2.3.8 hadoop@node2:/home/hadoop/
初始化仓库
schematool -initSchema -dbType mysql