gpt4 book ai didi

hadoop - sudo hadoop 与 su hadoop

转载 作者:可可西里 更新时间:2023-11-01 15:00:22 32 4
gpt4 key购买 nike

有没有人遇到奇怪的环境问题,在调用 hadoop 命令时被迫使用 SU 而不是 SUDO?

sudo su -c 'hadoop fs -ls /' hdfs
Found 4 itemsdrwxr-xr-x   - hdfs   hdfs          0 2014-02-11 12:33 /appsdrwx------   - mapred hdfs          0 2014-03-10 10:25 /mapreddrwxrwxrwx   - hdfs   hdfs          0 2014-03-10 10:26 /tmpdrwxr-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] COMMANDwhere 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/user14c15,16 SHLVL=1> SUDO_COMMAND=/bin/su -c env hdfs20a23> _=/usr/bin/env

最佳答案

将引号放在您的 hadoop 命令周围:

sudo -u hdfs hadoop fs -ls/

关于hadoop - sudo hadoop 与 su hadoop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22298519/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com