Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Hive failed to create table, drop table failed

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Hive failed to create the table and reported an error:

CREATE TABLE pokes (foo INT, bar STRING);

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:javax.jdo.JDODataStoreException: An exception was thrown while adding/validating class(es) : Specified key was too long; max key length is 767 bytes

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes

Solution:

mysql> SET @@global.innodb_large_prefix = 1;

mysql> ALTER DATABASE hivedb character set latin1;

Second, the drop table reported the wrong card master, the log did not see the information,

Solution:

Method 1: Finally found the problem is mysql5.6.30, changed a mysql5.1 database version, solve the problem

Method 2: For mysql 5.6.30 bugs, you need to manually initialize the hive metastore, otherwise the user will get stuck when dropping the table. In the dmp-gateway database (mysql specified in the configuration file)

[root@DMP-GATEWAY ~]# cd /opt/amos/hive/bin/

[root@DMP-GATEWAY bin]# ./ schematool -dbType mysql -initSchema

Results:

Starting metastore schema initialization to 1.2.0

Initialization script hive-schema-1.2.0.mysql.sql

Initialization script completed

View database:

[root@DMP-GATEWAY ~]# mysql -uroot -p

mysql> show databases;

--------------------

Database

--------------------

information_schema

exp

hive

hivedb can see that the hivedb database was created

3. After mestatore initialization, hivedb database will be automatically created, all tables will be cleared, or

drop database hivedb

create database hivedb

source hive-txn-schema-0.14.0.mysql.sql

source hive-schema-1.2.0.mysql.sql

Git Address:

https://github.com/apache/hive/tree/release-1.2.1/metastore/scripts/upgrade/mysql

IV. Error reporting

no library native-lzo

yum install -y lzo required

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report