本文介绍了苏多·哈杜普vs苏·哈杜普的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人在遇到hadoop命令时遇到了一个奇怪的环境问题并被迫使用SU而不是SUDO吗?

Has anybody got into a strange environment issue and been forced to use SU rather than SUDO when calling hadoop commands?

sudo su -c 'hadoop fs -ls /' hdfs

Found 4 items
drwxr-xr-x   - hdfs   hdfs          0 2014-02-11 12:33 /apps
drwx------   - mapred hdfs          0 2014-03-10 10:25 /mapred
drwxrwxrwx   - hdfs   hdfs          0 2014-03-10 10:26 /tmp
drwxr-xr-x   - hdfs   hdfs          0 2014-02-11 12:34 /user

环境允许查找可执行文件:

The environment allows finding of the executable:

sudo -u hdfs 'hadoop'

Usage: hadoop [--config confdir] COMMAND
where COMMAND is one of:
  namenode -format     format the DFS filesystem
...
  fs                   run a generic filesystem user client
...
...
Most commands print help when invoked w/o parameters.
sudo -u hdfs 'hadoop fs -ls /'

sudo: hadoop fs -ls: command not found

我想知道这是否是环境问题,但这没有给我任何提示:

I wondered if it was an environment issue, but this gave me no hints:

sudo su -c 'env' hdfs | sort >sudo_su.txt
sudo -u hdfs 'env' | sort >sudo.txt
diff sudo.txt sudo_su.txt

11a12
> PWD=/home/user
14c15,16
 SHLVL=1
> SUDO_COMMAND=/bin/su -c env hdfs
20a23
> _=/usr/bin/env

推荐答案

在您的hadoop命令周围加上引号:

Drop the quotes around your hadoop command:

sudo -u hdfs hadoop fs -ls /

这篇关于苏多·哈杜普vs苏·哈杜普的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 14:26