hadoop,hive常用命令

hadoop,hive常用命令

hadoop常用命令

# 查询目录下的所有文件
hadoop fs -ls hdfs://路径
# 删除文件
hadoop fs -rm -r -skipTrash hdfs://文件全路径

hive常用命令

-------
hive 建表语句
-------
CREATE TABLE 表名(
    字段名1 bigint,
    字段名2 string,
    ...
    字段名n bigint
) PARTITIONED by (分区字段名称 bigint) row format delimited fields terminated by '分隔符' stored as textfile;
# 注意,分区字段名称 不要在见表的分区自动中出现。


# 删除分区
ALTER TABLE 表名 drop PARTITION (分区字段=分区值)

# load 到表
alter table 表名 add partition (分区字段=分区值) location 'hdfs://?/分区字段=分区值';


# 查询该表的素有分区
show partitions 表名;

# 刷新分区数据
MSCK REPAIR TABLE 表名;
# 查询具体分区的详细信息。
desc formatted 表名 partition(分区字段=分区值);

猜你喜欢

转载自blog.csdn.net/WSYLH/article/details/129747400