持续更新
选择自己想要的版本(最新版本可能存在差异性)
环境变量 vim ~/.bashrc
# jdk
export JAVA_HOME=/home/java/jdk1.8.0_241
export PATH=$JAVA_HOME/bin:$PATH
export CLASS_PATH=$JAVA_HOME/lib/
# hadoop
export HADOOP_HOME=/home/hadoop3.x.x
export PATH=$HADOOP_HOME/bin:$PATH
source ~/.bashrc
测试是否配置成功 hadoop version
Hadoop启动的相关配置 文件路径 hadoop-3.x.x/etc/hadoop
hadoop.tmp.dir
file:/home/hadoop3/hadoop-3.1.3/tmp
Abase for other temporary directories.
fs.defaultFS
hdfs://localhost:9000
dfs.replication
1
dfs.namenode.name.dir
file:/home/hadoop3/hadoop-3.1.3/tmp/dfs/name
dfs.datanode.data.dir
file:/home/hadoop3/hadoop-3.1.3/tmp/dfs/data
yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.resourcemanager.webapp.address
0.0.0.0:23456
mapreduce.framework.name
yarn
初始化HDFS: hdfs namenode -format
在sbin目录下启动: ./start-all.sh
可能出现的问题
# 分别在 start-dfs.sh 和 stop-dfs.sh
在#!/usr/bin/env bash下一行添加
HDFS_DATANODE_USER=root
HDFS_DATANODE_SECURE_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
# 分别在start-yarn.sh 和 stop-yarn.sh
在#!/usr/bin/env bash下一行添加
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
此处浏览器验证 localhost:23456 默认的是localhost:8088
localhost:9870 hadoop3之前的版本端口为50070
下载地址文章开头
环境变量 vim ~/.bashrc
# hive
export HIVE_HOME=/home/hive
export PATH=$HIVE_HOME/bin:$PATH
javax.jdo.option.ConnectionURL
jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
root
javax.jdo.option.ConnectionPassword
123456
hive.metastore.schema.verification
false
fs.permissions.umask-mode
022
Setting a value for fs.permissions.umask-mode to work around issue in HIVE-6962.
It has no impact in hadoop 1.x line on hdfs operations.
MySQL文件地址: https://dev.mysql.com/downloads/connector/j/ 选择Platform Independent
./schematool -initSchema -dbType mysql
此处可能存在报错java.lang.NoSuchMethodError 排查如下
删除hive目录lib下中低版本的guava-14.0.1.jar包,将hadoop(hadoop\share\hadoop\common\lib)中的guava-27.0-jre.jar复制到hive的lib目录下即可。
测试hive
hive> create database hive_test;
OK
Time taken: 2.541 seconds
报错xml相关就是配置hive-site.xml错误 此处注意开头两行声明一定第一行顶格写
报错org.apache.hadoop.hive.ql.metadata.HiveException 修改hive-site.xml添加配置:
datanucleus.schema.autoCreateAll
true
在hive的conf目录下执行
schematool -dbType mysql -initSchema