0

I have been following http://saphanatutorial.com/hadoop-installation-on-windows-7-using-cygwin/ tutorial for hadoop installation in windows7
Everything went fine, however I am facing issues while formatting the name node.
I am failing in executing format command bin/hadoop namenode -format
As soon as I hit this command i get following error:

$ bin/hadoop namenode -format
bin/hadoop: line 2: $'\r': command not found
bin/hadoop: line 17: $'\r': command not found
bin/hadoop: line 18: $'\r': command not found
bin/hadoop: line 56: $'\r': command not found
bin/hadoop: line 58: cd: $'bin\r': No such file or directory
bin/hadoop: line 59: $'\r': command not found
bin/hadoop: line 67: syntax error near unexpected token `$'in\r''
'in/hadoop: line 67: `case "`uname`" in

I followed solution mentioned in export JAVA_HOME with spaces in Cygwin and made required changes in hadoop-env.sh file and systems variable path in computer properties.

Still the issue is not resolved. Could you please let me know where am i going wrong.
PFB the hadoop-env.sh file configuration:

# Set Hadoop-specific environment variables here.

# The only required environment variable is JAVA_HOME.  All others are
# optional.  When running a distributed configuration it is best to
# set JAVA_HOME in this file, so that it is correctly defined on
# remote nodes.

# The java implementation to use.  Required.
 export JAVA_HOME="/cygdrive/c/PROGRA~1/Java/jdk1.7.0_80"

# Extra Java CLASSPATH elements.  Optional.
# export HADOOP_CLASSPATH=

# The maximum amount of heap to use, in MB. Default is 1000.
# export HADOOP_HEAPSIZE=2000

# Extra Java runtime options.  Empty by default.
# export HADOOP_OPTS=-server

# Command specific options appended to HADOOP_OPTS when specified
export HADOOP_NAMENODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_NAMENODE_OPTS"
export HADOOP_SECONDARYNAMENODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_SECONDARYNAMENODE_OPTS"
export HADOOP_DATANODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_DATANODE_OPTS"
export HADOOP_BALANCER_OPTS="-Dcom.sun.management.jmxremote $HADOOP_BALANCER_OPTS"
export HADOOP_JOBTRACKER_OPTS="-Dcom.sun.management.jmxremote $HADOOP_JOBTRACKER_OPTS"
# export HADOOP_TASKTRACKER_OPTS=
# The following applies to multiple commands (fs, dfs, fsck, distcp etc)
# export HADOOP_CLIENT_OPTS

# Extra ssh options.  Empty by default.
# export HADOOP_SSH_OPTS="-o ConnectTimeout=1 -o SendEnv=HADOOP_CONF_DIR"

# Where log files are stored.  $HADOOP_HOME/logs by default.
# export HADOOP_LOG_DIR=${HADOOP_HOME}/logs

# File naming remote slave hosts.  $HADOOP_HOME/conf/slaves by default.
# export HADOOP_SLAVES=${HADOOP_HOME}/conf/slaves

# host:path where hadoop code should be rsync'd from.  Unset by default.
# export HADOOP_MASTER=master:/home/$USER/src/hadoop

# Seconds to sleep between slave commands.  Unset by default.  This
# can be useful in large clusters, where, e.g., slave rsyncs can
# otherwise arrive faster than the master can service them.
# export HADOOP_SLAVE_SLEEP=0.1

# The directory where pid files are stored. /tmp by default.
# NOTE: this should be set to a directory that can only be written to by 
#       the users that are going to run the hadoop daemons.  Otherwise there is
#       the potential for a symlink attack.
# export HADOOP_PID_DIR=/var/hadoop/pids

# A string representing this instance of hadoop. $USER by default.
# export HADOOP_IDENT_STRING=$USER

# The scheduling priority for daemon processes.  See 'man nice'.
# export HADOOP_NICENESS=10
Community
  • 1
  • 1
  • From which location you apply the format command? – Ramesh Maharjan May 20 '17 at 10:13
  • I am applying the command from hadoop home directory – Anvesha Saxena May 20 '17 at 10:23
  • Try `bin/hadoop` only and tell me what is the output. An error or options? – Ramesh Maharjan May 20 '17 at 10:37
  • Same Error: $ bin/hadoop bin/hadoop: line 2: $'\r': command not found bin/hadoop: line 17: $'\r': command not found bin/hadoop: line 18: $'\r': command not found bin/hadoop: line 56: $'\r': command not found bin/hadoop: line 58: cd: $'bin\r': No such file or directory bin/hadoop: line 59: $'\r': command not found bin/hadoop: line 67: syntax error near unexpected token `$'in\r'' 'in/hadoop: line 67: `case "`uname`" in – Anvesha Saxena May 20 '17 at 10:41
  • what I am guessing is that your bin/hadoop file is malformed. Try to remove the \r in the line numbers shown in the error. If it doesn't help try to replace the file from the original extracted folder. – Ramesh Maharjan May 20 '17 at 10:44
  • Thank you , the solution provided by you, worked, able to start the name node. – Anvesha Saxena May 23 '17 at 06:12
  • great to hear that . shall I answer the same in the answer below – Ramesh Maharjan May 23 '17 at 06:22

0 Answers0