六:配置时间同步:
找到虚拟机设置:点击选项-->找到VMware Tools,打开时间同步即可:
注:如果你是创建一台虚拟机,其他几台都是这台克隆过去的,就可以不用配置时间同步也可以进行。
七:配置文件
1,进入hadoop配置文件目录:
命令:
2,更改配置文件core-site.xml :
命令:
3,所有的用户组目录:/etc/group
命令:/etc/group
4,配置hdfs-site.xml文件 :将hadoop组配置成超级用户组
命令:
[root@hadoop1 conf]# gedit hdfs-site.xml
5,配置本地存储路径:(hdfs的数据将保存的本地的位置)
更改hdfs-site.xml文件:
进入文件命令:
[root@hadoop1 conf]# gedit hdfs-site.xml
(1)Namenode的路径:(这里我设置的目录是:/data/nn)
修改文件:
<property>
<name>dfs.namenode.name.dir</name>
<value>/data/nn</value>
</property>
(2)DataNode的路径:(实际的数据存放的位置)
修改的文件:(这里我设置的目录是:/data/dn)
<property>
<name>dfs.datanode.data.dir</name>
<value>/data/dn</value>
</property>
(3)都配置完成后的文件:hdfs-site.xml
文件内容:
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>dfs.permissions.superusergroup</name>
<value>hadoop</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/data/nn</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/data/dn</value>
</property>
</configuration>
6,创建路径,修改目录权限
(1)创建nn目录:
命令:
[root@hadoop1 conf]# mkdir -p /data/nn
(2)创建dn目录:[root@hadoop1 conf]# mkdir -p /data/dn
命令:
[root@hadoop1 conf]# mkdir -p /data/dn
(3)切换Hadoop2在hadoop2上也创建这两个目录:(操作相同)
(4)修改目录权限:
命令:
[root@hadoop1 conf]# chown -R hdfs:hdfs /data
(5)查看文件权限:
(6)更改目录组权限:(三台虚拟机执行一样的操作)
命令:
[root@hadoop1 conf]# chmod -R 700 /data
7,初始化(格式化完成后nn目录就有信息)
命令:
[root@hadoop1 ~]# sudo -u hdfs hdfs namenode -format
查看nn目录信息:
8,将nn中生成的current目录拷贝到hadoop2上:
命令:
[root@hadoop1 nn]# scp -r current/ hadoop2:/data/nn
9,在hadoop2上将current文件权限改为hdfs组权限:
命令:
[root@hadoop2 nn]# chown -R hdfs:hdfs /data
10,配置管理界面:文件:hdfs-site.xml
命令:
[root@hadoop1 conf]# gedit hdfs-site.xml
文件内容:
<property>
<name>dfs.namenode.http-address</name>
<value>hadoop1:50070</value>
</property>
11,拷贝配置文件:将文件发送给hadoop2,和hadoop2的指定目录中:
命令:
[root@hadoop1 conf]# scp core-site.xml hdfs-site.xml hadoop2:/etc/hadoop/conf
[root@hadoop1 conf]# scp core-site.xml hdfs-site.xml hadoop3:/etc/hadoop/conf
12,启动服务:(有顺序)
进入服务的目录:
/etc/init.d/
查看虚拟机的所有服务:
(1)启动hadoop-hdfs-namenode服务:命令:
[root@hadoop1 init.d]# service hadoop-hdfs-namenode start
启动完查看服务是否启动:[root@hadoop1 init.d]# jps
(2)浏览器查看进程:hadoop1:50070
(3)启动hadoop-hdfs-datanode服务:
命令:
[root@hadoop1 init.d]# service hadoop-hdfs-datanode start
(4)浏览器再次查看:
Jps查看进程:
(5)在hadoop2上启动hadoop-hdfs-datanode服务:
命令:
[root@hadoop2 init.d]# service hadoop-hdfs-datanode start
(6)在hadoop1上的浏览器继续查看节点:
命令查看一下进程:
(7)在hadoop3上启动hadoop-hdfs-datanode服务:
命令:
[root@hadoop3 init.d]# service hadoop-hdfs-datanode start
(8)浏览器查看节点信息:
命令查看进程: