问题描述
我已经自制安装了hadoop,但是现在在执行权限控制时遇到了问题hadoop namenode -format和./start-all.sh命令.
I've homebrew installed hadoop but now having permission control problems when doinghadoop namenode -format and ./start-all.sh command.
我认为这是因为我将设置放在"core-site.xml"中.我将"/tmp/$ {name}"放在"hadoop.tmp.dir"下.
I think it's because I put settings in "core-site.xml". The "hadoop.tmp.dir" I put "/tmp/${name}" under.
现在,它给我的namenode -format错误是:无法创建文件夹,权限被拒绝.即使是我sudo这个命令,但在start-all.sh命令中,仍然拒绝了许多权限.我尝试sudo start-all.sh,但是密码(我仅在Mac上为管理员使用此密码),但也拒绝了.
Now it's giving me error in namenode -format as: can't create folder, permission denied.Even I sudo this command, but in the start-all.sh command, still a lot of permissions are denied. I tried to sudo start-all.sh but the password (I only use this pass for my admin on mac) but denied also.
我认为是因为权限问题.反正有我可以解决的吗?
I think it's because of the permission issues. Is there anyway I can fix it?
谢谢!
推荐答案
因此,当您运行Hadoop时,它将内容存储在您在hdfs-site.xml文件中配置的数据,名称和tmp目录中.如果您未设置这些设置,它们将指向$ {hadoop.tmp.dir}/dfs/data,在您的情况下为/tmp dir.这不是您要存储数据的地方.首先,您需要将这些添加到您的hdfs配置文件中.
So when you run Hadoop it stores things in the data, name, and tmp dirs that you configure in the hdfs-site.xml file. If you don't set these settings they will point to ${hadoop.tmp.dir}/dfs/data, in your case the /tmp dir. This is not where you want your data stored. You will first need to add these to your hdfs config file, among other settings.
在主控上:
<property>
<name>dfs.data.dir</name>
<value>/app/hadoop/data</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>/app/hadoop/name</value>
</property>
在从属上:
<property>
<name>dfs.data.dir</name>
<value>/app/hadoop/data</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>master:/app/hadoop/name</value>
</property>
现在,一旦完成,您实际上必须创建这些目录.因此,在master上创建以下目录:/app/hadoop/name,/app/hadoop/data和/app/hadoop/tmp.在从站上创建相同的目录,除了名称dir.
Now once this is done you must actually make those directories. So create the following dirs on master :/app/hadoop/name, /app/hadoop/data, and /app/hadoop/tmp.Create the same on slaves except the name dir.
现在,您需要设置权限,以便Hadoop可以使用它们.第二行只是为了确定.
Now you need to set the permissions so that they can be used by Hadoop.The second line just to be sure.
sudo chown <hadoop user>:<hadoop user> /app/hadoop/name /app/hadoop/data /app/hadoop/tmp
sudo chmod 0777 /app/hadoop/name /app/hadoop/data /app/hadoop/tmp
尝试一下,看看是否可行.如果不是全部答案,我可以回答问题.
Try that, see if it works. I can answer questions if it's not the whole answer.
这篇关于Hadoop权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!