1. 現象:在任意位置輸入 hive,准備啟動 hive 時,報錯:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/mapred/MRVersion
2. 原因:全局變量中未 添加 hive 的路徑
3. 解決:
vi /etc/profile
添加:
export HIVE_HOME=/export/servers/apache-hive-2.1.1-bin (/export/servers/apache-hive-2.1.1-bin 未本機 hive 安裝路徑,其他機器按實際情況進行修改 )
path 添加 hive 路徑:
export PATH=:$JAVA_HOME/bin:$MAVEN_HOME/bin:$FINDBUGS_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$SQOOP_HOME/bin:$HIVE_HOME/bin:$PATH
使配置生效:source /etc/profile
5. 重試: