七、修改每台机子的主机名,为了以后方便,修改方式:
- 命令:hostname newName
- 修改/etc/sysconfig/network:
NETWORKING=yesHOSTNAME=datanode6
3. 修改/etc/hosts文件,我尚没尝试使用同步工具,因此我是先修改namenode的配置再使用scp命令复制到其它机子上的。
192.168.0.113 posa
192.168.0.118 datanode6
192.168.0.119 secondarynamenode
192.168.0.111 datanode2
192.168.0.121 datanode13
192.168.0.125 datanode16
192.168.0.116 datanode21
每台机子修改后,要重启服务:/etc/init.d/network restart
此时如果使用命令hostname发现主机名没有成功改动,重启电脑即可。
八、配置Hadoop
在NameNode:
- slaves文件,运行datanode和tasktracker守护进程,我下面使用主机名,因为已经配置好hosts文件
datanode2
datanode13
datanode6
datanode16
datanode21 - masters,运行secondaryNamenode守护进程
secondarynamenode - conf/core-site.xml文件
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://posa:8022/</value>
</property>
</configuration>
- conf/hdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.name.dir</name>
<value>/home/hadoop/hdfs/name</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>/home/hadoop/hdfs/data</value>
</property>
<property>
<name>fs.checkpoint.dir</name>
<value>/home/hadoop/hdfs/namesecondary</value>
</property>
</configuration> - mapred-site.xml文件
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>posa:8021</value>
</property>
<property>
<name>mapred.local.dir</name>
<value>/home/hadoop/mapred/local</value>
</property>
<property>
<name>mapred.system.dir</name>
<value>/tmp/hadoop/mapred/system</value>
</property>
<property>
<name>mapred.tasktracker.map.tasks.maximum</name>
<value>4</value>
</property>
<property>
<name>mapred.tasktracker.reduce.tasks.maximum</name>
<value>4</value>
</property>
<property>
<name>mapred.child.java.opts</name>
<value>-Xmx400m</value>
</property>
</configuration>
如复制到B:
scp -r hadoop-1.0.3 hadoop@B的主机名或IP:/home/hadoop/
