
安装准备

tar zxvf apache-hive-3.1.2-bin.tar.gzmv apache-hive-3.1.2-bin hive
解决hadoop、hive之间guava版本差异
cd /export/server/hiverm -rf lib/guava-19.0.jarcp /export/server/hadoop-3.3.0/share/hadoop/common/lib/guava-27.0-jre.jar ./lib/修改hive环境变量文件 添加Hadoop_HOME
cd /export/server/hive/conf/mv hive-env.sh.template hive-env.shvim hive-env.shiexport HADOOP_HOME=/export/server/hadoop-3.3.0
export HIVE_CONF_DIR=/export/server/hive/conf
export HIVE_AUX_JARS_PATH=/export/server/hive/lib

初始化metadata
cd /export/server/hivebin/schematool -dbType derby -initSchema
启动hive服务
bin/hive

rpm -qa|grep mariadb
mkdir /export/software/mysqltar xvf mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
yum -y install libaiorpm -ivh mysql-community-common-5.7.29-1.el7.x86_64.rpm mysql-community-libs-5.7.29-1.el7.x86_64.rpm mysql-community-client-5.7.29-1.el7.x86_64.rpm mysql-community-server-5.7.29-1.el7.x86_64.rpm
mysqld --initializechown mysql:mysql /var/lib/mysql -Rsystemctl start mysqld.servicecat /var/log/mysqld.log
mysql -u root -pEnter password:alter user user() identified by "hadoop";
use mysql;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'hadoop' WITH GRANT OPTION;
FLUSH PRIVILEGES;
systemctl stop mysqldsystemctl status mysqldsystemctl start mysqldsystemctl enable mysqldsystemctl list-unit-files | grep mysqldcd /export/server/tar zxvf apache-hive-3.1.2-bin.tar.gzmv apache-hive-3.1.2-bin hive
cd /export/server/hiverm -rf lib/guava-19.0.jarcp /export/server/hadoop-3.3.0/share/hadoop/common/lib/guava-27.0-jre.jar ./lib/
cd /export/server/hive/conf/mv hive-env.sh.template hive-env.shvim hive-env.shexport HADOOP_HOME=/export/server/hadoop-3.3.0
export HIVE_CONF_DIR=/export/server/hive/conf
export HIVE_AUX_JARS_PATH=/export/server/hive/lib
vim hive-site.xml
javax.jdo.option.ConnectionURL
jdbc:mysql://node1:3306/hive?createDatabaseIfNotExist=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
root
javax.jdo.option.ConnectionPassword
hadoop
hive.metastore.event.db.notification.api.auth
false
hive.metastore.schema.verification
false
cd /export/server/hivebin/schematool -initSchema -dbType mysql -verbosbin/hive



基于本地模式的基础上,将hive-site.xml修改为:
javax.jdo.option.ConnectionURL
jdbc:mysql://node1:3306/hive?createDatabaseIfNotExist=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
root
javax.jdo.option.ConnectionPassword
hadoop
hive.server2.thrift.bind.host
node1
hive.metastore.uris
thrift://node1:9083
hive.metastore.event.db.notification.api.auth
false
hive.metastore.schema.verification
false
Metastore Hiveserver2启动
/export/server/hive/bin/hive --service metastorenohup /export/server/hive/bin/hive --service metastore &/export/server/hive/bin/hive --service metastore --hiveconf hive.root.logger=DEBUG,console