加载数据到HDFS上时,报错: Failed with exception MetaException(message:javax.jdo.JDODataStoreException

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

扫描二维码关注公众号,回复: 11808126 查看本文章

[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

猜你喜欢

转载自blog.csdn.net/Dreamy_zsy/article/details/103176605
今日推荐