启动命令时出现错误yarn.sh
。这是错误输出:
$ start-yarn.sh
starting yarn daemons
mkdir: cannot create directory `/logs': Permission denied
chown: cannot access `/logs': No such file or directory
starting resourcemanager, logging to /logs/yarn-hduser-resourcemanager-ubuntu.out
/usr/local/hadoop/sbin/yarn-daemon.sh: line 124: /logs/yarn-hduser-resourcemanager-ubuntu.out: No such file or directory
head: cannot open `/logs/yarn-hduser-resourcemanager-ubuntu.out' for reading: No such file or directory
/usr/local/hadoop/sbin/yarn-daemon.sh: line 129: /logs/yarn-hduser-resourcemanager-ubuntu.out: No such file or directory
/usr/local/hadoop/sbin/yarn-daemon.sh: line 130: /logs/yarn-hduser-resourcemanager-ubuntu.out: No such file or directory
localhost: mkdir: cannot create directory `/logs': Permission denied
localhost: chown: cannot access `/logs': No such file or directory
localhost: starting nodemanager, logging to /logs/yarn-hduser-nodemanager-ubuntu.out
localhost: /usr/local/hadoop/sbin/yarn-daemon.sh: line 124: /logs/yarn-hduser-nodemanager-ubuntu.out: No such file or directory
localhost: head: cannot open `/logs/yarn-hduser-nodemanager-ubuntu.out' for reading: No such file or directory
localhost: /usr/local/hadoop/sbin/yarn-daemon.sh: line 129: /logs/yarn-hduser-nodemanager-ubuntu.out: No such file or directory
localhost: /usr/local/hadoop/sbin/yarn-daemon.sh: line 130: /logs/yarn-hduser-nodemanager-ubuntu.out: No such file or directory
答案1
该脚本正在尝试创建一个名为的目录/logs
,但失败了,因为您的用户没有创建该目录的权限。简单的解决方案是使用以下命令运行该脚本sudo
:
sudo start-yarn.sh
但请注意,脚本与在 中创建目录无关/
。此脚本有何用途?为什么需要创建/logs
?您可能需要在脚本中设置一个变量。请在此处发布脚本,或查找包含以下内容的行:
PREFIX=""
您的脚本中可能存在该内容或类似内容,并允许您设置它将在其中工作的基目录。将其设置为类似内容~/yarn/
。您真的不想在其中创建随机目录/
,如果该脚本确实这样做,我甚至会认为这是一个错误。