Aevi
Aevi

Reputation: 11

trying format namenode but permission denied?

In addition to previous asked question

I am trying to format namenode in hdfs but says: permission denied

for which I had not any responses but again I am posting what I have done to remove permissions to get job done:

I have tried command: Both below commands are from thread: Permission denied at hdfs

  1. sudo -u hduser bash

    1. edits hdfs-site.xml

      using as:hduser@Ubuntu:/usr/hadoop/hadoop-2.7.1/etc/hadoop$ sudo gedit hdfs-site.xml
      In this I have added permission as false:

<property>
        <name>dfs.permissions</name>
        <value>false</value>
    </property>

and running the command again :

hduser@Ubuntu:/usr/hadoop/hadoop-2.7.1$ bin/hdfs namenode -format bin/hdfs: line 304: /root/software/jdk1.8.0_45/bin/java: Permission denied bin/hdfs: line 304: exec: /root/software/jdk1.8.0_45/bin/java: cannot execute: Permission denied

and when I use it with sudo

It gives :

hduser@Ubuntu:/usr/hadoop/hadoop-2.7.1$ sudo bin/hdfs namenode -format bin/hdfs: line 304: /root/software/jdk1.8.0_45/bin/java: No such file or directory

What could be the solution.

Upvotes: 0

Views: 1492

Answers (2)

Aevi
Aevi

Reputation: 11

hduser@Ubuntu:/usr/hadoop/hadoop-2.7.1/etc/hadoop$ echo $JAVA_HOME

hduser@Ubuntu:/usr/hadoop/hadoop-2.7.1/etc/hadoop$ echo $JAVA_HOME

By the way It started with the command sbin/start-all.sh and then jps But namenode is not started yet. What to do for that @Bovas_Chinnathambi

Upvotes: 0

Bovas Chinnathambi
Bovas Chinnathambi

Reputation: 1

Updated my answer with the previous post:

In this case, you can try installing openjdk in your machine and set it for hadoop.

  1. For installing openjdk use the command sudo apt-get install openjdk-7-jdk. It will be installed in the path /usr/lib/jvm. Once installed, change the JAVA_HOME environment variable in the file ~/.bashrc to your latest open jdk's path and execute the file by the command 'source ~/.bashrc'.
  2. After setting environment at the system level, we have to set it in the hadoop environment as well. Open the file ${HADOOP_HOME}/etc/hadoop/hadoop-env.sh and change the value of the variable JAVA_HOME to your latest open jdk path

Hopefully this should solve your issue.

Note: Verify the java path after setting, by the command echo $JAVA_HOME

Previous post:

This could not be the issue with Hadoop, Since the hadoop process is not able to execute the java itself.

  1. Make sure you have the execute permission for your jdk directory.(type 'll' after navigating to the parent directory of your jdk directory, it will show the permission levels).
  2. If its not in the executable level, change the mode to execute for the jdk directory, by running the command "sudo chmod -Rf a+x jdk_directory_name".

FYI: Its not recommendable to have the jdk directory in the root folder, since hadoop or java can be run by any of the users on the machine. So you can move the jdk directory to /usr/lib or /opt/ directories.

Upvotes: 0

Related Questions