Hadoop学习笔记(24)Linux CLI的作业调度(原始方式)

截止目前,命令行(CLI)界面常用到的有linux的CLI、hive的CLI、mysql的CLI。而hive的CLI、mysql的CLI都是需要在linux的CLI输入命令hive或者mysql才能进入。

[admin@master ~]$ hive
[admin@master ~]$ mysql

一、在Linux的CLI进行hive交互

1、如何在linux的CLI界面执行hive的命令语句,而不需要进入到hive的CLI中?
在linux的CLI中输入命令hive --help --service cli,可以查询hive的交互命令

[admin@master ~]$ hive --help --service cli
21/05/30 01:32:56 WARN conf.HiveConf: HiveConf of name hive.metastore.local does not exist
usage: hive
 -d,--define <key=value>          Variable subsitution to apply to hive
                                  commands. e.g. -d A=B or --define A=B
    --database <databasename>     Specify the database to use
 -e <quoted-query-string>         SQL from command line
 -f <filename>                    SQL from files
 -H,--help                        Print help information
    --hiveconf <property=value>   Use value for given property
    --hivevar <key=value>         Variable subsitution to apply to hive
                                  commands. e.g. --hivevar A=B
 -i <filename>                    Initialization SQL file
 -S,--silent                      Silent mode in interactive shell
 -v,--verbose                     Verbose mode (echo executed SQL to the
                                  console)
[admin@master ~]$ 

2、常用hive交互命令
(1)hive -d 指定义hive的变量

(2)hive -e 指执行hive的SQL命令行。

[admin@master ~]$ hive -e 'show databases'
[admin@master ~]$ hive -e 'select * from sougou.table_partition limit 5'

(3)hive -f 指执行.sql文件

[admin@master ~]$ hive -f 'uidcount.sql'

(4)hive -H 指查看帮助
(5)hive -i 指初始化.sql文件

[admin@master ~]$ hive -i 'uidcount.sql'

(6)hive -S 指切换到交互式shell中的静默模式
(7)hive -v 指详细模式(将执行的SQL回显到控制台)

二、Linux CLI调度Hadoop Mapreduce

三、Linux CLI调度Hive

如上已说明linux跟hive是如何交互的,那么我们只需要把需要执行的代码封装到一个linux执行文件(.sh格式),然后执行这个文件即可实现调度。
1、编写linux执行文件(.sh格式)。hive_uidcount.sh文件中,比较常用hive -e或者hive -f。

[admin@master ~]$ vim hive_uidcount.sh

在这里插入图片描述

2、使用bash命令执行.sh文件

[admin@master ~]$ bash hive_uidcount.sh

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值