使用MSCK命令修复Hive表分区

#当前没有partition元信息
hive> show partitions cr_cdma_bsi_mscktest;
OK
Time taken: 0.104 seconds

#创建两个分区目录 hive
> dfs -mkdir /user/hive/warehouse/cr_cdma_bsi_mscktest/month=201603; hive> dfs -mkdir /user/hive/warehouse/cr_cdma_bsi_mscktest/month=201604;

#使用MSCK修复分区 hive
> msck repair table cr_cdma_bsi_mscktest; OK Partitions not in metastore: cr_cdma_bsi_mscktest:month=201603 Partitions not in metastore: cr_cdma_bsi_mscktest:month=201604 Repair: Added partition to metastore cr_cdma_bsi_mscktest:month=201603 Repair: Added partition to metastore cr_cdma_bsi_mscktest:month=201604 Time taken: 0.286 seconds, Fetched: 2 row(s)


#再次查看,发现已经成功更新元信息 hive
> show partitions cr_cdma_bsi_mscktest; OK month=201603 month=201604 Time taken: 0.102 seconds, Fetched: 1 row(s)
posted @ 2020-04-01 17:05  马小纪  阅读(682)  评论(0编辑  收藏  举报