Failed with exception MetaException(message:javax.jdo.JDODataStoreException: Error(s) were found while auto-creating/validating the datastore for classes.


hive (db_emp)> load data local inpath '/opt/datas/emp.txt' into table emp_part partition(`date`='2018120');

在加載數據到HDFS上時,報錯:

Failed with exception MetaException(message:javax.jdo.JDODataStoreException: Error(s) were found while auto-creating/validating the datastore for classes. The errors are printed in the log, and are attached to this exception.

問題解決:

1.刪除hive元數據庫(mysql中metastore)

2.手動創建metastore,執行SQL語句:show create database metastore;

mysql> create database metastore;
Query OK, 1 row affected (0.00 sec)

mysql> show create database metastore;
+--------------+-------------------------------------------------------------------------+
| Database | Create Database |
+--------------+-------------------------------------------------------------------------+
| metastore | CREATE DATABASE `metastore` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+--------------+-------------------------------------------------------------------------+
1 row in set (0.00 sec)

3.執行SQL語句:alter database metastore  character set latin1;

mysql> alter database metastore character set latin1;
Query OK, 1 row affected (0.00 sec)

4.到hive配置conf下的hive-site.xml中修改元數據庫

5.給要load data 的數據賦予權限

6.啟動hive

[xningge@hadoop01 hive-0.13.1-cdh5.3.6]$ bin/hive

Logging initialized using configuration in file:/opt/modules/cdh/hive-0.13.1-cdh5.3.6/conf/hive-log4j.properties
hive (default)> show databases;
OK
database_name
default
Time taken: 0.182 seconds, Fetched: 1 row(s)
hive (default)> create database db_emp;
OK
Time taken: 0.222 seconds
hive (default)> create table emp_part(
> empno int ,
> ename string ,
> job string ,
> mgr int ,
> hiredate string,
> sal double ,
> comm double ,
> deptno int
> )PARTITIONED BY(`date` string)
> row format delimited fields terminated by '\t';
OK
Time taken: 0.348 seconds
hive (default)> load data local inpath '/opt/datas/emp.txt' into table emp_part partition(`date`='2018120');
Loading data to table default.emp_part partition (date=2018120)
Partition default.emp_part{date=2018120} stats: [numFiles=1, numRows=0, totalSize=657, rawDataSize=0]
OK
Time taken: 1.159 seconds

7.打開瀏覽器進入http://hadoop01.xningge.com:50070

 

 問題解決,如果大家按我的步驟還是不成功,給我留言。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM