Where is the class path set for hadoop

Where is the class path for a set of haupas? When I run the command below, it gives me the class path. Where is the pathpath class installed?

bin/hadoop classpath 

I am using hasoop 2.6.0

+5
source share
4 answers

As almas shaikh says, it is installed in hadoop-config.sh , but you can add more cans to it in hadoop-env.sh

Here is the corresponding code from hadoop-env.sh , which adds additional banks, such as capacity planner and aws jar's.

 export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-"/etc/hadoop"} # Extra Java CLASSPATH elements. Automatically insert capacity-scheduler. for f in $HADOOP_HOME/contrib/capacity-scheduler/*.jar; do if [ "$HADOOP_CLASSPATH" ]; then export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$f else export HADOOP_CLASSPATH=$f fi done # ... some other lines omitted # Add Aws jar export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:share/hadoop/tools/lib/* 
+4
source

Open the bash profile ( ~/.profile or ~/.bash_profile ) for editing and add the following:

  • export HADOOP_HOME="/usr/local/Cellar/hadoop" , then Replace with your own path
  • export HADOOP_CLASSPATH=$(find $HADOOP_HOME -name '*.jar' | xargs echo | tr ' ' ':') Save changes and reload .

  • source ~/.profile

+1
source

When you run the hadoop command, it issues the hadoop-config.sh file, which is located in $HADOOP_HDFS_HOME/libexec , which sets your class path (CLASSPATH), choosing banks located in different directories, namely:

 $HADOOP_HDFS_HOME/share/hadoop/mapreduce $HADOOP_HDFS_HOME/share/hadoop/common $HADOOP_HDFS_HOME/share/hadoop/hdfs etc. 
0
source

According to this blog post , it is in an environment variable named HADOOP_CLASSPATH . You can set it in the same way as any other environment variable, the specificity of which depends on the shell used. If you use bash , you can call it as export HADOOP_CLASSPATH=/path/to/wherever:/path/to/wherever/else .

-1
source

Source: https://habr.com/ru/post/1212361/


All Articles