1

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

错误

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

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 教程的每一步。
而且我还尝试了在 Stackoverflow 上找到的解决方案,例如使用 bash 而不是 sh 来运行脚本和使用 sudo。

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

我确实在 stackoverflow 上看到了类似的问题
但是在那篇文章中没有回答任何可行的解决方案,提出这个问题的人说他已经解决了这个问题。我没有足够的声誉来评论和联系该用户 masterX。

4

2 回答 2

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.
于 2019-02-01T07:05:07.317 回答
0

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

于 2019-01-18T05:06:44.577 回答