-
替换guava文件解决Hive与Hadoop之间guava版本差异(listenwind102)
cd /export/server/apache-hive-3.1.2-bin/
rm -rf lib/guava-19.0.jar
cp /export/server/hadoop-3.3.0/share/hadoop/common/lib/guava-27.0-jre.jar ./lib/
-
修改配置文件(listenwind102)
cd /export/server/apache-hive-3.1.2-bin/conf
mv hive-env.sh.template hive-env.sh
vim hive-env.sh
export HADOOP_HOME=/export/server/hadoop-3.3.0
export HIVE_CONF_DIR=/export/server/apache-hive-3.1.2-bin/conf
export HIVE_AUX_JARS_PATH=/export/server/apache-hive-3.1.2-bin/lib
vim hive-site.xml
configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://listenwind102:3306/hive3?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>hadoop</value>
</property>
<property>
<name>hive.server2.thrift.bind.host</name>
<value>listenwind102</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://listenwind102:9083</value>
</property>
<property>
<name>hive.metastore.event.db.notification.api.auth</name>
<value>false</value>
</property>
</configuration>
-
上传mysql jdbc驱动到hive安装包lib下(listenwind102)
cd /export/server/apache-hive-3.1.2-bin/lib
mysql-connector-java-5.1.32.jar
-
初始化元数据(listenwind102)
cd /export/server/apache-hive-3.1.2-bin/
bin/schematool -initSchema -dbType mysql -verbos
-
在hdfs创建hive存储目录(listenwind102)
hadoop fs -mkdir /tmp
hadoop fs -mkdir -p /user/hive/warehouse
hadoop fs -chmod g+w /tmp
hadoop fs -chmod g+w /user/hive/warehouse
-
配置环境变量(listenwind102)
vim /etc/profile
export HIVE_HOME=/export/server/apache-hive-3.1.2-bin
export PATH=$PATH:$HIVE_HOME/bin:$HIVE_HOME/sbin
-
分发环境变量(listenwind102)
scp /etc/profile listenwind103:/etc/profile
scp /etc/profile listenwind104:/etc/profile
-
分发Hive文件(listenwind102)
scp -r /export/server/apache-hive-3.1.2-bin listenwind103:/export/server/apache-hive-3.1.2-bin
scp -r /export/server/apache-hive-3.1.2-bin listenwind104:/export/server/apache-hive-3.1.2-bin
-
重置环境变量(listenwind102listenwind103listenwind104)
source /etc/profile