Hadoop集群搭建(六):hadoop配置namenode服务
?
六:配置時間同步:
找到虛擬機設置:點擊選項-->找到VMware Tools,打開時間同步即可:
?
?
注:如果你是創(chuàng)建一臺虛擬機,其他幾臺都是這臺克隆過去的,就可以不用配置時間同步也可以進行。
?
?
?
七:配置文件
?
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的數(shù)據(jù)將保存的本地的位置)
更改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的路徑:(實際的數(shù)據(jù)存放的位置)
修改的文件:(這里我設置的目錄是:/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 morecontributor license agreements.? See the NOTICE file distributed withthis 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 withthe License.? You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations 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,創(chuàng)建路徑,修改目錄權限
(1)創(chuàng)建nn目錄:
命令:
[root@hadoop1 conf]# mkdir -p /data/nn?
?
(2)創(chuàng)建dn目錄:[root@hadoop1 conf]# mkdir -p /data/dn
命令:
[root@hadoop1 conf]# mkdir -p /data/dn?
?
(3)切換Hadoop2在hadoop2上也創(chuàng)建這兩個目錄:(操作相同)
?
(4)修改目錄權限:
命令:
[root@hadoop1 conf]# chown -R hdfs:hdfs /data?
?
(5)查看文件權限:
?
(6)更改目錄組權限:(三臺虛擬機執(zhí)行一樣的操作)
命令:
[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,拷貝配置文件:將文件發(fā)送給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上的瀏覽器繼續(xù)查看節(jié)點:
?
命令查看一下進程:
?
?
(7)在hadoop3上啟動hadoop-hdfs-datanode服務:
命令:
[root@hadoop3 init.d]# service hadoop-hdfs-datanode start?
?
(8)瀏覽器查看節(jié)點信息:
?
?
命令查看進程:
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
總結
以上是生活随笔為你收集整理的Hadoop集群搭建(六):hadoop配置namenode服务的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: 【转载】KMP算法详解
 - 下一篇: 多线程编程-条件变量