hadoop复习 1搭建
参考http://hadoop.apache.org/docs/r1.0.4/cn/quickstart.html
环境变量
hadoop-env.sh export JAVA_HOME=/usr/local/java/jdk1.6.0_45/
修改两个配置文件
[root@centos54conf]#cathdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>fs.default.name</name>
<value>localhost:9000</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>[root@centos54conf]#catmapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>$
<name>mapred.job.tracker</name>$
<value>localhost:9001</value>$
</property>$
</configuration>ssh本机互信,略
为了ssh
vim /etc/hosts ::1^I^Ilocalhost6.localdomain localhost
export HADOOP_HOME=/data/hadoop/hadoop-1.2.1 export HADOOP_CONF_DIR=$HADOOP_HOME/conf
初始化hdfs
bin/hadoopnamenode-format
bin/start-all.sh
启动后几个进程
root@centos54 bin]# jps 23275 NameNode 23396 DataNode 23543 SecondaryNameNode 23641 JobTracker 23768 TaskTracker
运行wordcount的例子
mkdirhaoning
cdhaoning
../bin/hadoop fs -put ../conf input ../bin/hadoop jar ../hadoop-examples-1.2.1.jar grep input output 'dfs[a-z.]+'
[root@centos54 haoning]# tree
.
|-- input
| |-- capacity-scheduler.xml
| |-- configuration.xsl
| |-- core-site.xml
| |-- fair-scheduler.xml
| |-- hadoop-env.sh
| |-- hadoop-metrics2.properties
| |-- hadoop-policy.xml
| |-- hdfs-site.xml
| |-- log4j.properties
| |-- mapred-queue-acls.xml
| |-- mapred-site.xml
| |-- masters
| |-- slaves
| |-- ssl-client.xml.example
| |-- ssl-server.xml.example
| |-- task-log4j.properties
| `-- taskcontroller.cfg
`-- output
|-- _SUCCESS
`-- part-00000得到的结果 [root@centos54 haoning]# cat output/* 1 dfs.replication 1 dfs.server.namenode. 1 dfsadmin
验证结果
cd input [root@centos54 input]# grep dfs * hadoop-env.sh:# The following applies to multiple commands (fs, dfs, fsck, distcp etc) hadoop-policy.xml: dfsadmin and mradmin commands to refresh the security policy in-effect. hdfs-site.xml: <name>dfs.replication</name> log4j.properties:log4j.logger.org.apache.hadoop.hdfs.server.namenode.FSNamesystem.audit=WARN [root@centos54 input]#
NameNode-http://localhost:50070/
JobTracker-http://localhost:50030/
~
相关推荐
WeiHHH 2020-09-23
Aleks 2020-08-19
WeiHHH 2020-08-17
飞鸿踏雪0 2020-07-26
tomli 2020-07-26
deyu 2020-07-21
strongyoung 2020-07-19
eternityzzy 2020-07-19
Elmo 2020-07-19
飞鸿踏雪0 2020-07-09
飞鸿踏雪0 2020-07-04
xieting 2020-07-04
WeiHHH 2020-06-28
genshengxiao 2020-06-26
Hhanwen 2020-06-25