centOs7下hive安裝與使用
阿新 • • 發佈:2019-07-30
環境
hadoop3.1.2
centOS 7
mysql 5.1.32
安裝
-
下載並解壓到/home/hadoop,避免沒有許可權建立metastore_db檔案
-
配置hive環境變數
-
修改配置檔案 進入hive/conf
mv hive-default.xml.template hive-default.xml
vi hive-site.xml
hive-site.xml內容如下
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value> <description>JDBC connect string for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> <description>Driver class name for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>hive</value> <description>username to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>hive</value> <description>password to use against metastore database</description> </property> </configuration>
mysql的地址localhost根據具體安裝ip修改
- 配置mysql環境 進入mysql終端,執行以下命令
create database hive;
grant all on *.* to hive@localhost identified by 'hive';
flush privileges;
在hive的lib檔案下加入mysql-connector-java-5.1.32.jar驅動,否則啟動hive會提示找不到驅動
- 初始化當前 Hive 版本的 Metastore 架構
schematool -dbType mysql -initSchema
問題
- java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveM