Hive入门

1、在shell中创建,home/sym,存放文件

2、将文件从服务器上传到集群,

hadoop fs -put data-dns.csv /sym/

查看上传结果:

hadoop fs -ls -R /sym
 

3、从集群上传到hive仓库

hive -e "load data inpath 'hdfs:///sym/data-dns.csv' into table log_509.df_dns_log_a partition(dd='2021-04-01',hh='12');"

4、查看是否上传成功

select * from log_509.df_dns_log_a where dd='2021-04-01' and hh='13' limit 10;
 

查看hive中表的步骤

  • 1、hive
  • 2、use log_509;(base) 
  • 3、查看表:show tables
  • 4、查看表结构:desc df_dns_log_a

IDEA打包jar包:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>helloworldTest</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>hello.fileTest</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

HDFS 常用命令:

Hadoop之hadoop fs命令_恒悦sunsite的博客-CSDN博客_hadoopfs命令详解

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值