找不到hadoop start-xxx.sh命令,语法错误

时间:2019-01-17 10:35:25

标签: macos hadoop syntax-error

我在MacOS上安装了Hadoop。我都尝试按照在Hadoop documentaion和Brew上发布的方法进行操作。但是,每当我尝试运行start-dfs.shstart-yarn.shstart-all.sh时,它只会引发以下错误:

Error

如果您不想单击屏幕快照的图像,则终端的错误会粘贴在此处的文本中:

Starting resourcemanager
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-functions.sh: line 398: syntax error near unexpected token `<'
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-functions.sh: line 398: `  done < <(for text in "${input[@]}"; do'
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 70: hadoop_deprecate_envvar: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 87: hadoop_bootstrap: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 104: hadoop_parse_args: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 105: shift: : numeric argument required
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 265: hadoop_need_reexec: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 273: hadoop_verify_user_perm: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/yarn: line 232: hadoop_validate_classname: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/yarn: line 233: hadoop_exit_with_usage: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 293: hadoop_add_client_opts: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 300: hadoop_subcommand_opts: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 303: hadoop_generic_java_subcmd_handler: command not found
Starting nodemanagers
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-functions.sh: line 398: syntax error near unexpected token `<'
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-functions.sh: line 398: `  done < <(for text in "${input[@]}"; do'
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 70: hadoop_deprecate_envvar: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 87: hadoop_bootstrap: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 104: hadoop_parse_args: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 105: shift: : numeric argument required
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 265: hadoop_need_reexec: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/../libexec/hadoop-config.sh: line 273: hadoop_verify_user_perm: command not found
/usr/local/Cellar/hadoop/3.1.1/libexec/bin/yarn: line 232: hadoop_validate_classname: command not found

我已经完成了Hadoop tutorial上的所有步骤。
而且我还尝试了在Stackoverflow上找到的解决方案,例如使用bash而不是sh来运行脚本并使用sudo。

我的MacOS版本是:10.14
Hadoop版本为:3.1.1

我确实看到了similar question on stackoverflow
但是在那个帖子中没有任何可行的解决方案被回答,问这个问题的人说他已经解决了。我没有足够的声誉来评论和联系该用户masterX。

2 个答案:

答案 0 :(得分:0)

检查启动文件的权限。可能存在权限问题。 您是否为Hadoop作业创建了其他用户?

答案 1 :(得分:0)

该错误可能有很多原因:

  1. 这可能是由于Hadoop环境变量的配置错误所致。尝试export HADOOP_HOME=/usr/local/Cellar/hadoop/3.1.1/
  2. 可能需要权限:请尝试sudo chown YOURUSERNAME:YOURUSERNAME /usr/local/Cellar/hadoop/3.1.1/ -R