Hive drop table table_name一直卡死状态

用drop删除表的时候,一直处于卡死状态,也不报错,如下图所示

Hive drop table table_name一直卡死状态_第1张图片

后来发现是Hive元数据存储编码问题,编码不能为utf8,所以我进入数据库看了一下MySQL的编码,如下图

Hive drop table table_name一直卡死状态_第2张图片

所以要将编码改回来,方法:在MySQL配置文件中修改,并删除原有的数据库,新建一个一样的数据库。

Hive drop table table_name一直卡死状态_第3张图片

Hive drop table table_name一直卡死状态_第4张图片

Hive drop table table_name一直卡死状态_第5张图片

Hive drop table table_name一直卡死状态_第6张图片

启动mysql,退出root
[root@master Desktop]# service mysql start;
Starting MySQL… [ OK ]
[root@master Desktop]# su - gznc

进入mysql,删除hive用户下的hive数据库,重新创建数据库

[gznc@master ~]$ mysql -u hive -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.5.52-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| hive |
| mysql |
| performance_schema |
| test |
| tt |
+——————–+
6 rows in set (0.18 sec)

mysql> drop database hive;
Query OK, 34 rows affected (0.33 sec)

mysql> create database hive;
Quered (0.00 sec)

退出MySQL,[root@master gznc]# su - gznc
[gznc@master ~]$ gedit hive-0.13.1/conf/hive-site.xml
Hive drop table table_name一直卡死状态_第7张图片
Hive drop table table_name一直卡死状态_第8张图片

[gznc@master ~]$ hive

Logging initialized using configuration in file:/home/gznc/hive-0.13.1/conf/hive-log4j.properties
hive> show tables;
OK
Time taken: 1.852 seconds
hive> create table student(id int,name string) row format delimited fields terminated by ‘,’;
OK
Time taken: 1.036 seconds
hive> load data local inpath ‘/home/gznc/Desktop/student.txt’ overwrite into table student;
Copying data from file:/home/gznc/Desktop/student.txt
Copying file: file:/home/gznc/Desktop/student.txt
Loading data to table default.student
rmr: DEPRECATED: Please use ‘rm -r’ instead.
Deleted hdfs://master:9000/home/gznc/hive-0.13.1/warehouse/student
Table default.student stats: [numFiles=1, numRows=0, totalSize=35, rawDataSize=0]
OK
Time taken: 1.792 seconds
hive> select * from student;
OK
1 张三
2 lisi
3 wangwu
4 zhaoliu
Time taken: 0.353 seconds, Fetched: 4 row(s)
hive> show tables;
OK
student
Time takconds, Fetched: 1 row(s)
hive> drop table student;
OK
Time taken: 1.028 seconds
hive> show tables;
OK
Time taken: 0.024 seconds

你可能感兴趣的:(hive)