CentOS下Hive2.0.0单机模式安装详解
生活随笔
收集整理的這篇文章主要介紹了
CentOS下Hive2.0.0单机模式安装详解
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本文環境如下:
操作系統:CentOS 6 32位
Hive版本:2.0.0
JDK版本:1.8.0_77 32位
Hadoop版本:2.6.4
1. 所需要的環境
Hive 2.0需要以下運行環境:
Java 1.7以上(強烈建議使用Java 1.8)
Hadoop 2.X
2. 下載、解壓Hive安裝包
Hive官網地址: http://hive.apache.org/
例如:
3. 配置環境變量(可選)
將hive-2.0.0/bin添加到path,以方便訪問
vi /etc/profile在末尾添加:
HIVE_HOME=/opt/hive-2.0.0 PATH=$PATH:$HIVE_HOME/bin4. 啟動單機模式
Hive和Hadoop一樣,有3種啟動模式,分別是單機模式,偽分布模式,分布模式。這里先來說一下單機模式的啟動方式。
集群模式安裝在http://blog.csdn.net/lnho2015/article/details/51355511
4.1 修改配置文件
cd /opt/hive-2.0.0/conf vi hive-site.xml //也可以用hive-default.xml.template去改,不過這個文件中的配置項太多了輸入以下內容后保存:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property><name>hive.metastore.warehouse.dir</name><value>/opt/hive-2.0.0/warehouse</value><description>location of default database for the warehouse</description> </property> <property><name>javax.jdo.option.ConnectionURL</name><value>jdbc:derby:/opt/hive-2.0.0/metastore_db;create=true</value><description>JDBC connect string for a JDBC metastore</description> </property> </configuration>4.2 初始化數據庫
schematool -initSchema -dbType derby出現以下幾行說明初始化成功:
Starting metastore schema initialization to 2.0.0 Initialization script hive-schema-2.0.0.derby.sql Initialization script completed schemaTool completed4.3 啟動程序
mkdir -p /opt/hive-2.0.0/warehouse // 創建元數據存儲文件夾 chmod a+rwx /opt/hive-2.0.0/warehouse // 修改文件權限 hive如果出現hive>提示符則說明啟動成功
5. 常見錯誤
5.1 運行hive時出現
Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, don't forget to include the option to auto-create the underlying database in your JDBC connection string (e.g. ?createDatabaseIfNotExist=true for mysql)錯誤原因:
數據庫沒有初始化,請參照4.2
5.2 使用schematool初始化數據庫時出現
Initialization script hive-schema-2.0.0.derby.sql Error: FUNCTION 'NUCLEUS_ASCII' already exists. (state=X0Y68,code=30000) org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !! *** schemaTool failed ***錯誤原因:數據庫文件夾中已經存在一些文件,解決方法就是清空數據庫文件夾(也就是前面配置的/opt/hive-2.0.0/metastore_db文件夾)
總結
以上是生活随笔為你收集整理的CentOS下Hive2.0.0单机模式安装详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Leet Code OJ 28. Imp
- 下一篇: Leet Code OJ 15. 3Su