安装mysql
hive2.3.0下载
/etc/profile
export HIVE_HOME=/home/hadoop/apps/hive
export PATH=$PATH:$HIVE_HOME/bin
命令行输入 source /etc/profile
jdbc connector 下载
将它拷贝到 hive/lib
目录切换到 /home/hadoop/apps/hive/conf
cp hive-env.sh.template hive-env.sh
cp hive-default.xml.template hive-site.xml
cp hive-log4j2.properties.template hive-log4j2.properties
cp hive-exec-log4j2.properties.template hive-exec-log4j2.properties
export JAVA_HOME=/usr/apps/jdk1.8.0_181-amd64
export HADOOP_HOME=/home/hadoop/apps/hadoop-2.7.6
export HIVE_HOME=/home/hadoop/apps/hive
export HIVE_CONF_DIR=/home/hadoop/apps/hive/conf
启动hadoop
hdfs dfs -mkdir -p /user/hive/warehouse
hdfs dfs -mkdir -p /user/hive/tmp
hdfs dfs -mkdir -p /user/hive/log
hdfs dfs -chmod -R 777 /user/hive/warehouse
hdfs dfs -chmod -R 777 /user/hive/tmp
hdfs dfs -chmod -R 777 /user/hive/log
hdfs dfs -chmod -R 777 /user
<property>
<name>hive.exec.scratchdirname>
<value>/user/hive/tmpvalue>
property>
<property>
<name>hive.metastore.warehouse.dirname>
<value>/user/hive/warehousevalue>
property>
<property>
<name>hive.querylog.locationname>
<value>/user/hive/logvalue>
property>
<property>
<name>javax.jdo.option.ConnectionURLname>
<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true&characterEncoding=UTF-8&useSSL=falsevalue>
property>
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
<property>
<name>javax.jdo.option.ConnectionUserNamename>
<value>rootvalue>
property>
<property>
<name>javax.jdo.option.ConnectionPasswordname>
<value>rootvalue>
property>
创建 tmp 文件夹 ,并修改权限
mkdir -p /home/hadoop/apps/hive/tmp
chmod -R 777 /home/hadoop/apps/hive/tmp
/home/hadoop/apps/hive/tmp
schematool -dbType mysql -initSchema
发现包冲突
删掉 /hive/lib 目录下 这个 jar 包
然后删掉hive 数据库,重新运行初始化命令
必须先对hadoop的core-site.xml进行配置,在文件里面添加并保存
<property>
<name>hadoop.proxyuser.hadoop.groupsname>
<value>*value>
property>
<property>
<name>hadoop.proxyuser.hadoop.hostsname>
<value>*value>
property>