前提:已解压hive包改名后放于/usr/local/src
准备好mysql jar包
cd /usr/local/src/hive/lib/
将mysql jar包拖进去
cd /usr/local/src/hadoop/
sbin/start-all.sh
hdfs dfs -mkdir -p /usr/hive/warehouse
hdfs dfs -mkdir -p /usr/hive/tmp
hdfs dfs -mkdir -p /usr/hive/log
hdfs dfs -chmod g+w /usr/hive/warehouse
hdfs dfs -chmod g+w /usr/hive/tmp
hdfs dfs -chmod g+w /usr/hive/log
vi /etc/profile
export HIVE_HOME=/usr/local/src/hive
export PATH=$PATH:${HIVE_HOME}/bin
source /etc/profile
cd /usr/local/src/hive/conf/
cp hive-env.sh.template hive-env.sh
vi hive-env.sh
export JAVA_HOME=/usr/local/src/jdk
export HADOOP_HOME=/usr/local/src/hadoop
export HIVE_HOME=/usr/local/src/hive
...
export HIVE_CONF_DIR=${HIVE_HOME}/conf
...
export HIVE_AUX_JARS_PATH=/usr/local/src/hive/lib/*
输入hive启动
出现hive>则成功
(
若出现ls:无法访问......*.jar:没有那个文件或目录
则cd /usr/local/src/hive/bin
vi hive
将sparkAssemblyPath='ls ${SPARK_HOME}/lib/spark-assembly-*.jar'
改成......='ls ${SPARK_HOME}/jars/*.jar'
)
(
若仍报错,显示
Logging initialized using configuration in jar:file:/usr/local/src/hive/lib/hive-common-1.2.2.jar!......
.....[ERROR] Terminal initialization failed; falling back to unsupported......
则
cp /usr/local/src/hive/lib/jline-2.12.jar /usr/local/src/hadoop/share/hadoop/yarn/lib/
再输入hive启动
)