Hadoop combat-05. Configure a small Hadoop cluster (3 hosts)

Configure a 3-host hadoop small cluster:

Two more clones of the previously configured pseudo-distributed ubuntu virtual machine, a total of three copies

Because the configuration of the three machines is the same, it can save a lot of installation, jdk, ssh, hadoop installation

Assign roles to these 3 machines:

ubuntu1 172.19.43.178  master,namenode,jobtracker-master

ubuntu2 172.19.43.114  slave1,datanode,tasktracker-slave1

ubuntu3 172,19.43.98   slave2,datanode,tasktracker-slave2

 

Set /ect/hosts and /etc/hostname on 3 hosts respectively

/etc/hosts

127.0.0.1

172.19.43.178   master

172.19.43.114   slave1

172.19.43.98    slave2

/etc/hostname

hostname master/slave1/slave2


 

Because these 3 machines have the same configuration, the ssh configuration key is the same, so no special operation is done, otherwise the master file will be copied to the two slaves

#scp authorized_keys slave1:~/.ssh/

#scp authorized_keys slave2:~/.ssh/

 

Now try to see if you can log in to the slave from the master without a password, and the login is successful.

#ssh slave1

#ssh slave2


Reconfigure the three files core-site.xml, hdfs-site.xml, mapred-site.xml and the two files of masters and slaves

The masters and slaves of the three hosts are configured as follows:

Reformat the hdfs of the 3 machines separately,

# bin / hadoop purpose-format



Start hadoop on the master host

#bin/start-all.sh

在master上启动服务后,其他slave的也会跟着启动。


查看启动是否成功


 

补充点教材上的排错知识:

如果大家在安装的时候遇到问题,或者按步骤安装完成却不能运行Hadoop,那么建议仔细查看日志信息。Hadoop记录了详尽的日志信息,日志文件保存在logs文件夹内。

 

无论是启动还是以后会经常用到的MapReduce中的每一个Job,或是HDFS等相关信息,Hadoop均存有日志文件以供分析。

 

例如:NameNode和DataNode的namespaceID不一致,这个错误是很多人在安装时都会遇到的。日志信息为:

 

java.io.IOException: Incompatible namespaceIDs in /root/tmp/dfs/data:namenode namespaceID = 1307672299; datanode namespaceID = 389959598

 

若HDFS一直没有启动,读者可以查询日志,并通过日志进行分析,日志提示信息显示了NameNode和DataNode的namespaceID不一致。

 

这个问题一般是由于两次或两次以上格式化NameNode造成的,有两种方法可以解决,第一种方法是删除DataNode的所有资料,第二种方法就是修改每个DataNode的namespaceID(位于/dfs/data/current/VERSION文件中)或修改NameNode的namespaceID(位于/dfs/name/current/VERSION文件中)。使其一致。

 

下面这两种方法在实际应用也可能会用到。

 

1)重启坏掉的DataNode或JobTracker。当Hadoop集群的某单个节点出现问题时,一般不必重启整个系统,只须重启这个节点,它会自动连入整个集群。

 

在坏死的节点上输入如下命令即可:

bin/Hadoop-daemon.sh start datanode

bin/Hadoop-daemon.sh start jobtracker

 

2)动态加入DataNode或TaskTracker。下面这条命令允许用户动态地将某个节点加入到集群中。

bin/Hadoop-daemon.sh --config ./conf start datanode

bin/Hadoop-daemon.sh --config ./conf start tasktracker

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327106856&siteId=291194637