一、报错信息:hive> show databases;
FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
解决办法:1.删除mysql中的元数据库(metastore,查看你的元数据名称)
2.执行:schematool -dbType mysql -initSchema -verbose(初始化元数据库)
如果上述方法不能解决解决,重装Hive
二、报错信息: hive> select * from stu;
OK
2023-12-30 17:55:23,388 INFO [e1c5e7c8-3d37-4d92-bb45-29d7bc1fc86c main] mapred.FileInputFormat: Total input files to process : 6
Failed with exception java.io.IOException:org.apache.hadoop.hdfs.BlockMissingException: Could not obtain block: BP-109232521-192.168.159.120-1697362807330:blk_1073741847_1023 file=/hive/warehouse/stu/000000_0
Time taken: 1.725 seconds
解决办法:上述产生的报错原因是在我重新安装Hive后出现的,经过分析发现是HDFS的目录文件有问题,删除hdfs上创建hive目录
相关指令:
bash
hadoop fs -rm -r /hive/warehouse
hadoop fs -rm -r /tmp/hive/
在hdfs上重新创建hive目录并授权
相关指令:
bash
[qiangzi@master ~]$ hadoop fs -mkdir -p /hive/warehouse
[qiangzi@master ~]$ hadoop fs -mkdir -p /tmp/hive/
[qiangzi@master ~]$ hadoop fs -chmod -R 777 /hive/warehouse
[qiangzi@master ~]$ hadoop fs -chmod -R 777 /tmp/hive