Java 如何设置hadoop环境变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20849667/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set up hadoop environment variables
提问by JBT
I am following this pagein the official documentation. I also downloaded hadoop 2.2.0 and placed it under $HOME/opt
. Now I have this file structure:
我在官方文档中关注此页面。我还下载了 hadoop 2.2.0 并将其放在$HOME/opt
. 现在我有这个文件结构:
$ ls -1 ~/opt/hadoop-2.2.0/
LICENSE.txt
NOTICE.txt
README.txt
bin/
etc/
include/
lib/
libexec/
sbin/
share/
$ ls -1 ~/opt/hadoop-2.2.0/share/hadoop/
common/
hdfs/
httpfs/
mapreduce/
tools/
yarn/
In the page I mentioned above, there is this paragraph:
在我上面提到的页面中,有这么一段:
Assuming you have installed hadoop-common/hadoop-hdfs and exported $HADOOP_COMMON_HOME/$HADOOP_HDFS_HOME, untar hadoop mapreduce tarball and set environment variable $HADOOP_MAPRED_HOME to the untarred directory. Set $HADOOP_YARN_HOME the same as $HADOOP_MAPRED_HOME.
假设您已经安装了 hadoop-common/hadoop-hdfs 并导出了 $HADOOP_COMMON_HOME/$HADOOP_HDFS_HOME,解压 hadoop mapreduce tarball 并将环境变量 $HADOOP_MAPRED_HOME 设置到解压目录。将 $HADOOP_YARN_HOME 设置为与 $HADOOP_MAPRED_HOME 相同。
So, my question is, given my file structure, how should I set up the hadoop environment variables ($HADOOP_COMMON_HOME, $HADOOP_HDFS_HOME, $HADOOP_YARN_HOME, etc)? Thank you very much.
所以,我的问题是,鉴于我的文件结构,我应该如何设置 hadoop 环境变量($HADOOP_COMMON_HOME、$HADOOP_HDFS_HOME、$HADOOP_YARN_HOME 等)?非常感谢。
采纳答案by zhutoulala
You could set them as following, last 2 are not mandatory to get HDFS and YARN working though.
您可以将它们设置如下,但最后 2 个不是让 HDFS 和 YARN 工作所必需的。
HADOOP_COMMON_HOME=$HOME/opt/hadoop-2.2.0/
HADOOP_HDFS_HOME=$HOME/opt/hadoop-2.2.0/share/hadoop/hdfs
HADOOP_YARN_HOME=$HOME/opt/hadoop-2.2.0/share/hadoop/yarn