0
点赞
收藏
分享

微信扫一扫

Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析

小典典Rikako 2022-10-19 阅读 93

温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看。


Fayson的github:https://github.com/fayson/cdhproject


1.问题描述



在使用Hue创建Ssh的Oozie工作流,在Shell脚本中执行sudo命令失败,异常如下:

测试shell脚本


#!/bin/bashsudo mkdir /dfs/myshell


运行异常:


Log Upload Time: Mon Dec 18 05:22:07 -0500 2017

Log Length: 400
We trust you have received the usual lecture from the local SystemAdministrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.sudo: no tty present and no askpass program specifiedFailing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1]


Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_hadoop


2.问题复现



1.使用Fayson用户登录Hue,创建一个Shell Workflow的工作流


Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_hive_02


2.将test.sh脚本上传至当前工作流的workspace/lib目录下


Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_hive_03

Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_hive_04


3.保存工作流,点击运行,作业执行失败


Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_h5_05


失败日志如下


Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_hadoop_06


3.问题解决



1.使用root用户修改/etc/sudoers文件,将fayson用户修改为拥有sudo权限的用户


在/etc/sudoers文件末尾增加如下配置


fayson          ALL=(ALL)       NOPASSWD: ALL


Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_h5_07


将配置文件中的如下信息注释


#
# Disable "ssh hostname sudo <cmd>", because it will show the password in clear.
# You have to run "ssh -t hostname sudo <cmd>".
#
#Defaults requiretty


Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_hive_08


注意:这里需要集为群所有节点的fayson用户添加sudo权限。


2.再次运行作业


Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_hadoop_09


3.保存作业并执行


Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_h5_10


4.总结



  • 在Oozie的Ssh Action脚本中有需要使用Sudo权限去执行的命令,则需要为fayson用户添加Sudo权限,否则是无法执行Sudo命令的。
  • 在非Kerberos环境下如果需要切换不同的用户执行hadoop命令,可以使用exportHADOOP_USER_NAME=hive在Shell加载执行用户。



为天地立心,为生民立命,为往圣继绝学,为万世开太平。

温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看。








推荐关注Hadoop实操,第一时间,分享更多Hadoop干货,欢迎转发和分享。

Hue中使用Oozie创建Ssh工作流时sudo命令执行失败问题分析_hive_11

原创文章,欢迎转载,转载请注明:转载自微信公众号Hadoop实操


举报

相关推荐

0 条评论