分享

【解决】HIVE如何执行?

lixiaoliang7 发表于 2014-12-24 07:57:37 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 11 21751
本帖最后由 lixiaoliang7 于 2014-12-24 10:08 编辑

我在CRT执行HIVE时,当我把CRT关闭后,任务就会被KILL掉。 那是因为CRT是客户端嘛(我是hive登录到shell中执行脚本的)
请问我应该如何执行脚本,关闭CRT后任务不会被KILL掉?

已有(12)人评论

跳转到指定楼层
bioger_hit 发表于 2014-12-24 08:19:34
试一下在命令后面加上”&“这个符号,表示在后台执行。
回复

使用道具 举报

lixiaoliang7 发表于 2014-12-24 09:48:17
bioger_hit 发表于 2014-12-24 04:19
试一下在命令后面加上”&“这个符号,表示在后台执行。

我试过,依然不行。当我把CRT会话关闭后,该任务一样会被KILL掉…
回复

使用道具 举报

w123aw 发表于 2014-12-24 12:39:38



楼主,的是什么语句:可以参考下面:


1, 查jobs:

hadoop11:/usr/lib/hive # jobs
[1]+ Running nohup hive --service hiveserver -p 10000 & (wd: /usr/lib/hadoop-0.20.2/bin)

hadoop11:/usr/lib/hive # jobs -l
[1]+ 5813 Running nohup hive --service hiveserver -p 10000 & (wd: /usr/lib/hadoop-0.20.2/bin)

2,后台进程转到前台

hadoop11:/usr/lib/hive # fg %1
nohup hive --service hiveserver -p 10000 (wd: /usr/lib/hadoop-0.20.2/bin)

ctrl + z
可以将一个正在前台执行的命令放到后台,并且暂停
3,命令道后台运行:

hadoop11:/usr/lib/hive # nohup hive --service hiveserver -p 10000 &
[1] 12550
hadoop11:/usr/lib/hive # nohup: appending output to `nohup.out'

4,杀掉job:

hadoop11:~ # nohup hive --service hiveserver -p 10000 &
[1] 13284
nohup: appending output to `nohup.out'
hadoop11:~ # jobs -l
[1]+ 13284 Running nohup hive --service hiveserver -p 10000 &
hadoop11:~ # kill -9 13284
-bash: kill: (13284) - No such process
[1]+ Done nohup hive --service hiveserver -p 10000
hadoop11:~ # nohup hive --service hiveserver -p 10000 &
[1] 13368
nohup: appending output to `nohup.out'
hadoop11:~ # kill %1
-bash: kill: (13368) - No such process
[1]+ Done nohup hive --service hiveserver -p 10000



回复

使用道具 举报

xuanxufeng 发表于 2014-12-24 12:43:48

加上“&”是可以的,楼主可能尝试出错了
参考如下:


  1. $ nohup hive -e "select * from wyp" >> local/wyp.txt &
  2. $ hive -e "select * from wyp" >> local/wyp.txt &
复制代码




回复

使用道具 举报

howtodown 发表于 2014-12-24 12:48:05
关闭可能找不到了,但是不关闭,后台执行,应该问题不大。
回复

使用道具 举报

lixiaoliang7 发表于 2014-12-24 14:07:49
xuanxufeng 发表于 2014-12-24 08:43
加上“&”是可以的,楼主可能尝试出错了
参考如下:

感谢
nohup hive -e "select * from wyp" >> local/wyp.txt &   这样是可以的
如果不加上nohup,关掉客户端后,任务就会被 kill掉
回复

使用道具 举报

lixiaoliang7 发表于 2014-12-24 14:12:53
测试了一下。 添加nohub后,关闭终端后,任务是会继续进行的  而&是直接在后台运行,但是你关闭终端后,任务会挂掉。
回复

使用道具 举报

hahaxixi 发表于 2014-12-24 15:57:35
lixiaoliang7 发表于 2014-12-24 14:12
测试了一下。 添加nohub后,关闭终端后,任务是会继续进行的  而&是直接在后台运行,但是你关闭终端后,任 ...

学习了!!!!
回复

使用道具 举报

12下一页
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条