修改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://localhost/</value>
</property>
</configuration>
修改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.replication</name>
<value>1</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>localhost:8021</value>
</property>
</configuration>
然后将SSH设置成不用输入密码就能登录:
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
测试修改是否生效:
ssh localhost
格式化HDFS:
hadoop namenode -format
启动HDFS和MapReduce
start-dfs.sh
start-mapred.sh
验证HDFS是否启动成功:
http://localhost:50070/
验证MapReduce是否启动成功:
http://localhost:50030/
也可查看后台进程,如果namenode,secondary namenode,datanode.这3个进程表示HDFS启动成功,如果有JobTracker和TaskTracker进程表示MapReduce启动成功