● Hadoop文件配置
配置三个xml文件,分别为:core-site.xml、hdfs-site.xml、mapred-site.xml,配置效果如下所示:
文件:core-site.xml
[root@master conf]# vi core-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
文件:hdfs-site.xml
[root@master conf]# vi hdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
文件:mapred-site.xml
[root@master conf]# vi mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
</property>
</configuration>
● hadoop格式化文件系统
切换到bin目录,找到可执行文件hadoop,执行文件系统格式化操作:
[root@master bin]# hadoop namenode -format
● 启动hadoop
[root@master bin]# ./start-all.sh
starting namenode, logging to /var/local/logs/hadoop-root-namenode-master.hadoop.out
localhost: starting datanode, logging to /var/local/logs/hadoop-root-datanode-master.hadoop.out
localhost: starting secondarynamenode, logging to /var/local/logs/hadoop-root-secondarynamenode-master.hadoop.out
starting jobtracker, logging to /var/local/logs/hadoop-root-jobtracker-master.hadoop.out
localhost: starting tasktracker, logging to /var/local/logs/hadoop-root-tasktracker-master.hadoop.out
1.1.5 Hadoop测试
[root@master hadoop]# jps
2459 JobTracker
2284 DataNode
2204 NameNode
2860 Jps
2382 SecondaryNameNode