前言:
本篇文章针对于2020秋季学期的复习操作,一是对该学期的巩固,二是让老师知道他的努力没有白费,同时,在此感谢徐老师对我们的精心教导…
本次需要用到的材料
- jdk-8u112-linux-x64.tar.gz
jdk官网下载 - hadoop-2.7.6.tar.gz
hadoop官网下载清华镜像下载 当然可能低版本下载不到了,没关系以下是我的百度网盘链接可供下载→https://pan.baidu.com/s/1F0dl4368hlWR18mHzoZKwA
→t123
前提
- 打开虚拟机并用finalShell连接
- 在root目录下创建一个自己放东西的目录(我的是opt)在其目录下再建一个放安装包的目录(我的是soft)
- 将我们的两个安装包“拉”进soft目录下
以下是实操
ok!
安装jdk
这里有一个安装软件的口号→上传解压重命名环境变量source生效
这里的上传已经弄好了,接下来是解压,由于我想解压到opt目录下而我们的安装包在/opt/soft/里面,所以我的解压命令是↓
tar -zxvf jdk-8u112-linux-x64.tar.gz -C …/
重命名!!
mv jdk1.8.0_112/ jdk
环境变量
由于是第一次配置环境变量我们得了解清楚我们的liunx是怎么运作的怎样更加高效的工作,那么这里我们的环境变量就设置在了/opt/etc/profile.d/bigdata-etc.sh里面
具体操作↓
vim /etc/profile.d/bigdata-etc.sh
注意点: #后面空格经验之举!!!
source生效↓
source /etc/profile.d/bigdata-etc.sh
这里可以用查看版本来验证是否成功安装jdk
→javac -version
→java -version
安装hadoop
相信有了安装jdk的经验,hadoop还难吗?
要这么简单为什么要分开来操作了?
下面是实操
同样是解压重命名环境变量,这里就不多说了
这里需要将bin和sbin都配置进去!!
# 配置jdk环境变量
export JAVA_HOME=/opt/jdk
export PATH=$PATH:$JAVA_HOME/bin
# 配置hadoop环境变量
export HADOOP_HOME=/opt/hadoop
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
最后source生效
source /etc/profile.d/bigdata-etc.sh
最后这里有个finalShell好用的操作
清空页面Ctrl+l
liunx操作
↑↓键调用历史命令,可以定制历史命令条数,这里就不介绍了
测试
测试一
hadoop version
测试二
运行mapreduce示例程序grep
目的→
统计源目录(input)下所有资源中的内容以dfs开头的行数
①准备计算源
[root@Mymaster hadoop]# mkdir ~/input
[root@Mymaster ~]# cd input/
[root@Mymaster input]# vim Test.txt
hadoop jar /opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.6.jar grep ~/input ~/output 'dfs[a-z.]'
21/01/13 18:34:20 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
21/01/13 18:34:20 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
21/01/13 18:34:20 INFO input.FileInputFormat: Total input paths to process : 1
21/01/13 18:34:20 INFO mapreduce.JobSubmitter: number of splits:1
21/01/13 18:34:20 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local437625394_0001
21/01/13 18:34:21 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
21/01/13 18:34:21 INFO mapreduce.Job: Running job: job_local437625394_0001
21/01/13 18:34:21 INFO mapred.LocalJobRunner: OutputCommitter set in config null
21/01/13 18:34:21 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 18:34:21 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
21/01/13 18:34:21 INFO mapred.LocalJobRunner: Waiting for map tasks
21/01/13 18:34:21 INFO mapred.LocalJobRunner: Starting task: attempt_local437625394_0001_m_000000_0
21/01/13 18:34:21 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 18:34:21 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ]
21/01/13 18:34:21 INFO mapred.MapTask: Processing split: file:/root/input/Test.txt:0+31
21/01/13 18:34:21 INFO mapred.MapTask: (EQUATOR) 0 kvi 26214396(104857584)
21/01/13 18:34:21 INFO mapred.MapTask: mapreduce.task.io.sort.mb: 100
21/01/13 18:34:21 INFO mapred.MapTask: soft limit at 83886080
21/01/13 18:34:21 INFO mapred.MapTask: bufstart = 0; bufvoid = 104857600
21/01/13 18:34:21 INFO mapred.MapTask: kvstart = 26214396; length = 6553600
21/01/13 18:34:21 INFO mapred.MapTask: Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer
21/01/13 18:34:21 INFO mapred.LocalJobRunner:
21/01/13 18:34:21 INFO mapred.MapTask: Starting flush of map output
21/01/13 18:34:21 INFO mapred.MapTask: Spilling map output
21/01/13 18:34:21 INFO mapred.MapTask: bufstart = 0; bufend = 39; bufvoid = 104857600
21/01/13 18:34:21 INFO mapred.MapTask: kvstart = 26214396(104857584); kvend = 26214388(104857552); length = 9/6553600
21/01/13 18:34:21 INFO mapred.MapTask: Finished spill 0
21/01/13 18:34:21 INFO mapred.Task: Task:attempt_local437625394_0001_m_000000_0 is done. And is in the process of committing
21/01/13 18:34:21 INFO mapred.LocalJobRunner: map
21/01/13 18:34:21 INFO mapred.Task: Task 'attempt_local437625394_0001_m_000000_0' done.
21/01/13 18:34:21 INFO mapred.Task: Final Counters for attempt_local437625394_0001_m_000000_0: Counters: 18
File System Counters
FILE: Number of bytes read=296008
FILE: Number of bytes written=588377
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Map input records=6
Map output records=3
Map output bytes=39
Map output materialized bytes=36
Input split bytes=90
Combine input records=3
Combine output records=2
Spilled Records=2
Failed Shuffles=0
Merged Map outputs=0
GC time elapsed (ms)=90
Total committed heap usage (bytes)=212860928
File Input Format Counters
Bytes Read=31
21/01/13 18:34:21 INFO mapred.LocalJobRunner: Finishing task: attempt_local437625394_0001_m_000000_0
21/01/13 18:34:21 INFO mapred.LocalJobRunner: map task executor complete.
21/01/13 18:34:21 INFO mapred.LocalJobRunner: Waiting for reduce tasks
21/01/13 18:34:21 INFO mapred.LocalJobRunner: Starting task: attempt_local437625394_0001_r_000000_0
21/01/13 18:34:21 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 18:34:21 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ]
21/01/13 18:34:21 INFO mapred.ReduceTask: Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@480c6baa
21/01/13 18:34:21 INFO reduce.MergeManagerImpl: MergerManager: memoryLimit=334338464, maxSingleShuffleLimit=83584616, mergeThreshold=220663392, ioSortFactor=10, memToMemMergeOutputsThreshold=10
21/01/13 18:34:21 INFO reduce.EventFetcher: attempt_local437625394_0001_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events
21/01/13 18:34:21 INFO reduce.LocalFetcher: localfetcher#1 about to shuffle output of map attempt_local437625394_0001_m_000000_0 decomp: 32 len: 36 to MEMORY
21/01/13 18:34:21 INFO reduce.InMemoryMapOutput: Read 32 bytes from map-output for attempt_local437625394_0001_m_000000_0
21/01/13 18:34:21 INFO reduce.MergeManagerImpl: closeInMemoryFile -> map-output of size: 32, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->32
21/01/13 18:34:21 INFO reduce.EventFetcher: EventFetcher is interrupted.. Returning
21/01/13 18:34:21 INFO mapred.LocalJobRunner: 1 / 1 copied.
21/01/13 18:34:21 INFO reduce.MergeManagerImpl: finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs
21/01/13 18:34:21 INFO mapred.Merger: Merging 1 sorted segments
21/01/13 18:34:21 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 25 bytes
21/01/13 18:34:21 INFO reduce.MergeManagerImpl: Merged 1 segments, 32 bytes to disk to satisfy reduce memory limit
21/01/13 18:34:21 INFO reduce.MergeManagerImpl: Merging 1 files, 36 bytes from disk
21/01/13 18:34:21 INFO reduce.MergeManagerImpl: Merging 0 segments, 0 bytes from memory into reduce
21/01/13 18:34:21 INFO mapred.Merger: Merging 1 sorted segments
21/01/13 18:34:21 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 25 bytes
21/01/13 18:34:21 INFO mapred.LocalJobRunner: 1 / 1 copied.
21/01/13 18:34:21 INFO Configuration.deprecation: mapred.skip.on is deprecated. Instead, use mapreduce.job.skiprecords
21/01/13 18:34:21 INFO mapred.Task: Task:attempt_local437625394_0001_r_000000_0 is done. And is in the process of committing
21/01/13 18:34:21 INFO mapred.LocalJobRunner: 1 / 1 copied.
21/01/13 18:34:21 INFO mapred.Task: Task attempt_local437625394_0001_r_000000_0 is allowed to commit now
21/01/13 18:34:21 INFO output.FileOutputCommitter: Saved output of task 'attempt_local437625394_0001_r_000000_0' to file:/root/input/grep-temp-2131710143/_temporary/0/task_local437625394_0001_r_000000
21/01/13 18:34:21 INFO mapred.LocalJobRunner: reduce > reduce
21/01/13 18:34:21 INFO mapred.Task: Task 'attempt_local437625394_0001_r_000000_0' done.
21/01/13 18:34:21 INFO mapred.Task: Final Counters for attempt_local437625394_0001_r_000000_0: Counters: 24
File System Counters
FILE: Number of bytes read=296112
FILE: Number of bytes written=588553
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Combine input records=0
Combine output records=0
Reduce input groups=2
Reduce shuffle bytes=36
Reduce input records=2
Reduce output records=2
Spilled Records=2
Shuffled Maps =1
Failed Shuffles=0
Merged Map outputs=1
GC time elapsed (ms)=0
Total committed heap usage (bytes)=212860928
Shuffle Errors
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
File Output Format Counters
Bytes Written=140
21/01/13 18:34:21 INFO mapred.LocalJobRunner: Finishing task: attempt_local437625394_0001_r_000000_0
21/01/13 18:34:21 INFO mapred.LocalJobRunner: reduce task executor complete.
21/01/13 18:34:22 INFO mapreduce.Job: Job job_local437625394_0001 running in uber mode : false
21/01/13 18:34:22 INFO mapreduce.Job: map 100% reduce 100%
21/01/13 18:34:22 INFO mapreduce.Job: Job job_local437625394_0001 completed successfully
21/01/13 18:34:22 INFO mapreduce.Job: Counters: 30
File System Counters
FILE: Number of bytes read=592120
FILE: Number of bytes written=1176930
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Map input records=6
Map output records=3
Map output bytes=39
Map output materialized bytes=36
Input split bytes=90
Combine input records=3
Combine output records=2
Reduce input groups=2
Reduce shuffle bytes=36
Reduce input records=2
Reduce output records=2
Spilled Records=4
Shuffled Maps =1
Failed Shuffles=0
Merged Map outputs=1
GC time elapsed (ms)=90
Total committed heap usage (bytes)=425721856
Shuffle Errors
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
File Input Format Counters
Bytes Read=31
File Output Format Counters
Bytes Written=140
21/01/13 18:34:22 INFO jvm.JvmMetrics: Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized
21/01/13 18:34:22 INFO input.FileInputFormat: Total input paths to process : 1
21/01/13 18:34:22 INFO mapreduce.JobSubmitter: number of splits:1
21/01/13 18:34:22 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local685543909_0002
21/01/13 18:34:22 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
21/01/13 18:34:22 INFO mapreduce.Job: Running job: job_local685543909_0002
21/01/13 18:34:22 INFO mapred.LocalJobRunner: OutputCommitter set in config null
21/01/13 18:34:22 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 18:34:22 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
21/01/13 18:34:22 INFO mapred.LocalJobRunner: Waiting for map tasks
21/01/13 18:34:22 INFO mapred.LocalJobRunner: Starting task: attempt_local685543909_0002_m_000000_0
21/01/13 18:34:22 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 18:34:22 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ]
21/01/13 18:34:22 INFO mapred.MapTask: Processing split: file:/root/input/grep-temp-2131710143/part-r-00000:0+128
21/01/13 18:34:22 INFO mapred.MapTask: (EQUATOR) 0 kvi 26214396(104857584)
21/01/13 18:34:22 INFO mapred.MapTask: mapreduce.task.io.sort.mb: 100
21/01/13 18:34:22 INFO mapred.MapTask: soft limit at 83886080
21/01/13 18:34:22 INFO mapred.MapTask: bufstart = 0; bufvoid = 104857600
21/01/13 18:34:22 INFO mapred.MapTask: kvstart = 26214396; length = 6553600
21/01/13 18:34:22 INFO mapred.MapTask: Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer
21/01/13 18:34:22 INFO mapred.LocalJobRunner:
21/01/13 18:34:22 INFO mapred.MapTask: Starting flush of map output
21/01/13 18:34:22 INFO mapred.MapTask: Spilling map output
21/01/13 18:34:22 INFO mapred.MapTask: bufstart = 0; bufend = 26; bufvoid = 104857600
21/01/13 18:34:22 INFO mapred.MapTask: kvstart = 26214396(104857584); kvend = 26214392(104857568); length = 5/6553600
21/01/13 18:34:22 INFO mapred.MapTask: Finished spill 0
21/01/13 18:34:22 INFO mapred.Task: Task:attempt_local685543909_0002_m_000000_0 is done. And is in the process of committing
21/01/13 18:34:22 INFO mapred.LocalJobRunner: map
21/01/13 18:34:22 INFO mapred.Task: Task 'attempt_local685543909_0002_m_000000_0' done.
21/01/13 18:34:22 INFO mapred.Task: Final Counters for attempt_local685543909_0002_m_000000_0: Counters: 17
File System Counters
FILE: Number of bytes read=592255
FILE: Number of bytes written=1175758
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Map input records=2
Map output records=2
Map output bytes=26
Map output materialized bytes=36
Input split bytes=115
Combine input records=0
Spilled Records=2
Failed Shuffles=0
Merged Map outputs=0
GC time elapsed (ms)=60
Total committed heap usage (bytes)=385351680
File Input Format Counters
Bytes Read=140
21/01/13 18:34:22 INFO mapred.LocalJobRunner: Finishing task: attempt_local685543909_0002_m_000000_0
21/01/13 18:34:22 INFO mapred.LocalJobRunner: map task executor complete.
21/01/13 18:34:22 INFO mapred.LocalJobRunner: Waiting for reduce tasks
21/01/13 18:34:22 INFO mapred.LocalJobRunner: Starting task: attempt_local685543909_0002_r_000000_0
21/01/13 18:34:22 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 18:34:22 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ]
21/01/13 18:34:22 INFO mapred.ReduceTask: Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@2b831f1f
21/01/13 18:34:22 INFO reduce.MergeManagerImpl: MergerManager: memoryLimit=334338464, maxSingleShuffleLimit=83584616, mergeThreshold=220663392, ioSortFactor=10, memToMemMergeOutputsThreshold=10
21/01/13 18:34:22 INFO reduce.EventFetcher: attempt_local685543909_0002_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events
21/01/13 18:34:22 INFO reduce.LocalFetcher: localfetcher#2 about to shuffle output of map attempt_local685543909_0002_m_000000_0 decomp: 32 len: 36 to MEMORY
21/01/13 18:34:22 INFO reduce.InMemoryMapOutput: Read 32 bytes from map-output for attempt_local685543909_0002_m_000000_0
21/01/13 18:34:22 INFO reduce.MergeManagerImpl: closeInMemoryFile -> map-output of size: 32, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->32
21/01/13 18:34:22 INFO reduce.EventFetcher: EventFetcher is interrupted.. Returning
21/01/13 18:34:22 WARN io.ReadaheadPool: Failed readahead on ifile
EBADF: Bad file descriptor
at org.apache.hadoop.io.nativeio.NativeIO$POSIX.posix_fadvise(Native Method)
at org.apache.hadoop.io.nativeio.NativeIO$POSIX.posixFadviseIfPossible(NativeIO.java:267)
at org.apache.hadoop.io.nativeio.NativeIO$POSIX$CacheManipulator.posixFadviseIfPossible(NativeIO.java:146)
at org.apache.hadoop.io.ReadaheadPool$ReadaheadRequestImpl.run(ReadaheadPool.java:206)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
21/01/13 18:34:22 INFO mapred.LocalJobRunner: 1 / 1 copied.
21/01/13 18:34:22 INFO reduce.MergeManagerImpl: finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs
21/01/13 18:34:22 INFO mapred.Merger: Merging 1 sorted segments
21/01/13 18:34:22 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 22 bytes
21/01/13 18:34:22 INFO reduce.MergeManagerImpl: Merged 1 segments, 32 bytes to disk to satisfy reduce memory limit
21/01/13 18:34:22 INFO reduce.MergeManagerImpl: Merging 1 files, 36 bytes from disk
21/01/13 18:34:22 INFO reduce.MergeManagerImpl: Merging 0 segments, 0 bytes from memory into reduce
21/01/13 18:34:22 INFO mapred.Merger: Merging 1 sorted segments
21/01/13 18:34:22 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 22 bytes
21/01/13 18:34:22 INFO mapred.LocalJobRunner: 1 / 1 copied.
21/01/13 18:34:22 INFO mapred.Task: Task:attempt_local685543909_0002_r_000000_0 is done. And is in the process of committing
21/01/13 18:34:22 INFO mapred.LocalJobRunner: 1 / 1 copied.
21/01/13 18:34:22 INFO mapred.Task: Task attempt_local685543909_0002_r_000000_0 is allowed to commit now
21/01/13 18:34:22 INFO output.FileOutputCommitter: Saved output of task 'attempt_local685543909_0002_r_000000_0' to file:/root/output/_temporary/0/task_local685543909_0002_r_000000
21/01/13 18:34:22 INFO mapred.LocalJobRunner: reduce > reduce
21/01/13 18:34:22 INFO mapred.Task: Task 'attempt_local685543909_0002_r_000000_0' done.
21/01/13 18:34:22 INFO mapred.Task: Final Counters for attempt_local685543909_0002_r_000000_0: Counters: 24
File System Counters
FILE: Number of bytes read=592359
FILE: Number of bytes written=1175820
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Combine input records=0
Combine output records=0
Reduce input groups=2
Reduce shuffle bytes=36
Reduce input records=2
Reduce output records=2
Spilled Records=2
Shuffled Maps =1
Failed Shuffles=0
Merged Map outputs=1
GC time elapsed (ms)=0
Total committed heap usage (bytes)=385351680
Shuffle Errors
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
File Output Format Counters
Bytes Written=26
21/01/13 18:34:22 INFO mapred.LocalJobRunner: Finishing task: attempt_local685543909_0002_r_000000_0
21/01/13 18:34:22 INFO mapred.LocalJobRunner: reduce task executor complete.
21/01/13 18:34:23 INFO mapreduce.Job: Job job_local685543909_0002 running in uber mode : false
21/01/13 18:34:23 INFO mapreduce.Job: map 100% reduce 100%
21/01/13 18:34:23 INFO mapreduce.Job: Job job_local685543909_0002 completed successfully
21/01/13 18:34:23 INFO mapreduce.Job: Counters: 30
File System Counters
FILE: Number of bytes read=1184614
FILE: Number of bytes written=2351578
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Map input records=2
Map output records=2
Map output bytes=26
Map output materialized bytes=36
Input split bytes=115
Combine input records=0
Combine output records=0
Reduce input groups=2
Reduce shuffle bytes=36
Reduce input records=2
Reduce output records=2
Spilled Records=4
Shuffled Maps =1
Failed Shuffles=0
Merged Map outputs=1
GC time elapsed (ms)=60
Total committed heap usage (bytes)=770703360
Shuffle Errors
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
File Input Format Counters
Bytes Read=140
File Output Format Counters
Bytes Written=26
验证结果
cat output/*
测试三:运行mapreduce示例程序wordcount
目的:
统计指定的源目录下所有的资源(文件)中每个单词出现的总次数。(将所有文件中相同的单词都会进行累计)
准备计算源(这里插播有反扒机制)
[root@Mymaster ~]# mkdir input2
[root@Mymaster ~]# cd input2/
[root@Mymaster input2]# vim heheda.txt
[root@Mymaster input2]# vim haha.txt
hadoop jar /opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.6.jar wordcount ~/input2 ~/output2
21/01/13 19:01:01 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
21/01/13 19:01:01 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
21/01/13 19:01:01 INFO input.FileInputFormat: Total input paths to process : 2
21/01/13 19:01:01 INFO mapreduce.JobSubmitter: number of splits:2
21/01/13 19:01:01 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local1702293927_0001
21/01/13 19:01:01 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
21/01/13 19:01:01 INFO mapreduce.Job: Running job: job_local1702293927_0001
21/01/13 19:01:01 INFO mapred.LocalJobRunner: OutputCommitter set in config null
21/01/13 19:01:01 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 19:01:01 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
21/01/13 19:01:01 INFO mapred.LocalJobRunner: Waiting for map tasks
21/01/13 19:01:01 INFO mapred.LocalJobRunner: Starting task: attempt_local1702293927_0001_m_000000_0
21/01/13 19:01:01 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 19:01:01 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ]
21/01/13 19:01:01 INFO mapred.MapTask: Processing split: file:/root/input2/heheda.txt:0+95
21/01/13 19:01:01 INFO mapred.MapTask: (EQUATOR) 0 kvi 26214396(104857584)
21/01/13 19:01:01 INFO mapred.MapTask: mapreduce.task.io.sort.mb: 100
21/01/13 19:01:01 INFO mapred.MapTask: soft limit at 83886080
21/01/13 19:01:01 INFO mapred.MapTask: bufstart = 0; bufvoid = 104857600
21/01/13 19:01:01 INFO mapred.MapTask: kvstart = 26214396; length = 6553600
21/01/13 19:01:01 INFO mapred.MapTask: Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer
21/01/13 19:01:01 INFO mapred.LocalJobRunner:
21/01/13 19:01:01 INFO mapred.MapTask: Starting flush of map output
21/01/13 19:01:01 INFO mapred.MapTask: Spilling map output
21/01/13 19:01:01 INFO mapred.MapTask: bufstart = 0; bufend = 155; bufvoid = 104857600
21/01/13 19:01:01 INFO mapred.MapTask: kvstart = 26214396(104857584); kvend = 26214340(104857360); length = 57/6553600
21/01/13 19:01:01 INFO mapred.MapTask: Finished spill 0
21/01/13 19:01:01 INFO mapred.Task: Task:attempt_local1702293927_0001_m_000000_0 is done. And is in the process of committing
21/01/13 19:01:01 INFO mapred.LocalJobRunner: map
21/01/13 19:01:01 INFO mapred.Task: Task 'attempt_local1702293927_0001_m_000000_0' done.
21/01/13 19:01:01 INFO mapred.Task: Final Counters for attempt_local1702293927_0001_m_000000_0: Counters: 18
File System Counters
FILE: Number of bytes read=296179
FILE: Number of bytes written=589373
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Map input records=5
Map output records=15
Map output bytes=155
Map output materialized bytes=191
Input split bytes=93
Combine input records=15
Combine output records=15
Spilled Records=15
Failed Shuffles=0
Merged Map outputs=0
GC time elapsed (ms)=6
Total committed heap usage (bytes)=212860928
File Input Format Counters
Bytes Read=95
21/01/13 19:01:01 INFO mapred.LocalJobRunner: Finishing task: attempt_local1702293927_0001_m_000000_0
21/01/13 19:01:01 INFO mapred.LocalJobRunner: Starting task: attempt_local1702293927_0001_m_000001_0
21/01/13 19:01:01 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 19:01:01 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ]
21/01/13 19:01:01 INFO mapred.MapTask: Processing split: file:/root/input2/haha.txt:0+83
21/01/13 19:01:01 INFO mapred.MapTask: (EQUATOR) 0 kvi 26214396(104857584)
21/01/13 19:01:01 INFO mapred.MapTask: mapreduce.task.io.sort.mb: 100
21/01/13 19:01:01 INFO mapred.MapTask: soft limit at 83886080
21/01/13 19:01:01 INFO mapred.MapTask: bufstart = 0; bufvoid = 104857600
21/01/13 19:01:01 INFO mapred.MapTask: kvstart = 26214396; length = 6553600
21/01/13 19:01:01 INFO mapred.MapTask: Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer
21/01/13 19:01:01 INFO mapred.LocalJobRunner:
21/01/13 19:01:01 INFO mapred.MapTask: Starting flush of map output
21/01/13 19:01:01 INFO mapred.MapTask: Spilling map output
21/01/13 19:01:01 INFO mapred.MapTask: bufstart = 0; bufend = 131; bufvoid = 104857600
21/01/13 19:01:01 INFO mapred.MapTask: kvstart = 26214396(104857584); kvend = 26214352(104857408); length = 45/6553600
21/01/13 19:01:01 INFO mapred.MapTask: Finished spill 0
21/01/13 19:01:01 INFO mapred.Task: Task:attempt_local1702293927_0001_m_000001_0 is done. And is in the process of committing
21/01/13 19:01:01 INFO mapred.LocalJobRunner: map
21/01/13 19:01:01 INFO mapred.Task: Task 'attempt_local1702293927_0001_m_000001_0' done.
21/01/13 19:01:01 INFO mapred.Task: Final Counters for attempt_local1702293927_0001_m_000001_0: Counters: 18
File System Counters
FILE: Number of bytes read=296465
FILE: Number of bytes written=589556
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Map input records=4
Map output records=12
Map output bytes=131
Map output materialized bytes=151
Input split bytes=91
Combine input records=12
Combine output records=11
Spilled Records=11
Failed Shuffles=0
Merged Map outputs=0
GC time elapsed (ms)=0
Total committed heap usage (bytes)=318242816
File Input Format Counters
Bytes Read=83
21/01/13 19:01:01 INFO mapred.LocalJobRunner: Finishing task: attempt_local1702293927_0001_m_000001_0
21/01/13 19:01:01 INFO mapred.LocalJobRunner: map task executor complete.
21/01/13 19:01:01 INFO mapred.LocalJobRunner: Waiting for reduce tasks
21/01/13 19:01:01 INFO mapred.LocalJobRunner: Starting task: attempt_local1702293927_0001_r_000000_0
21/01/13 19:01:01 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 19:01:01 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ]
21/01/13 19:01:01 INFO mapred.ReduceTask: Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@5caf2357
21/01/13 19:01:01 INFO reduce.MergeManagerImpl: MergerManager: memoryLimit=334338464, maxSingleShuffleLimit=83584616, mergeThreshold=220663392, ioSortFactor=10, memToMemMergeOutputsThreshold=10
21/01/13 19:01:01 INFO reduce.EventFetcher: attempt_local1702293927_0001_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events
21/01/13 19:01:01 INFO reduce.LocalFetcher: localfetcher#1 about to shuffle output of map attempt_local1702293927_0001_m_000000_0 decomp: 187 len: 191 to MEMORY
21/01/13 19:01:01 INFO reduce.InMemoryMapOutput: Read 187 bytes from map-output for attempt_local1702293927_0001_m_000000_0
21/01/13 19:01:01 INFO reduce.MergeManagerImpl: closeInMemoryFile -> map-output of size: 187, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->187
21/01/13 19:01:01 WARN io.ReadaheadPool: Failed readahead on ifile
EBADF: Bad file descriptor
at org.apache.hadoop.io.nativeio.NativeIO$POSIX.posix_fadvise(Native Method)
at org.apache.hadoop.io.nativeio.NativeIO$POSIX.posixFadviseIfPossible(NativeIO.java:267)
at org.apache.hadoop.io.nativeio.NativeIO$POSIX$CacheManipulator.posixFadviseIfPossible(NativeIO.java:146)
at org.apache.hadoop.io.ReadaheadPool$ReadaheadRequestImpl.run(ReadaheadPool.java:206)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
21/01/13 19:01:01 INFO reduce.LocalFetcher: localfetcher#1 about to shuffle output of map attempt_local1702293927_0001_m_000001_0 decomp: 147 len: 151 to MEMORY
21/01/13 19:01:01 INFO reduce.InMemoryMapOutput: Read 147 bytes from map-output for attempt_local1702293927_0001_m_000001_0
21/01/13 19:01:01 INFO reduce.MergeManagerImpl: closeInMemoryFile -> map-output of size: 147, inMemoryMapOutputs.size() -> 2, commitMemory -> 187, usedMemory ->334
21/01/13 19:01:01 WARN io.ReadaheadPool: Failed readahead on ifile
EBADF: Bad file descriptor
at org.apache.hadoop.io.nativeio.NativeIO$POSIX.posix_fadvise(Native Method)
at org.apache.hadoop.io.nativeio.NativeIO$POSIX.posixFadviseIfPossible(NativeIO.java:267)
at org.apache.hadoop.io.nativeio.NativeIO$POSIX$CacheManipulator.posixFadviseIfPossible(NativeIO.java:146)
at org.apache.hadoop.io.ReadaheadPool$ReadaheadRequestImpl.run(ReadaheadPool.java:206)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
21/01/13 19:01:01 INFO reduce.EventFetcher: EventFetcher is interrupted.. Returning
21/01/13 19:01:01 INFO mapred.LocalJobRunner: 2 / 2 copied.
21/01/13 19:01:01 INFO reduce.MergeManagerImpl: finalMerge called with 2 in-memory map-outputs and 0 on-disk map-outputs
21/01/13 19:01:01 INFO mapred.Merger: Merging 2 sorted segments
21/01/13 19:01:01 INFO mapred.Merger: Down to the last merge-pass, with 2 segments left of total size: 312 bytes
21/01/13 19:01:01 INFO reduce.MergeManagerImpl: Merged 2 segments, 334 bytes to disk to satisfy reduce memory limit
21/01/13 19:01:01 INFO reduce.MergeManagerImpl: Merging 1 files, 336 bytes from disk
21/01/13 19:01:01 INFO reduce.MergeManagerImpl: Merging 0 segments, 0 bytes from memory into reduce
21/01/13 19:01:01 INFO mapred.Merger: Merging 1 sorted segments
21/01/13 19:01:01 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 321 bytes
21/01/13 19:01:01 INFO mapred.LocalJobRunner: 2 / 2 copied.
21/01/13 19:01:01 INFO Configuration.deprecation: mapred.skip.on is deprecated. Instead, use mapreduce.job.skiprecords
21/01/13 19:01:01 INFO mapred.Task: Task:attempt_local1702293927_0001_r_000000_0 is done. And is in the process of committing
21/01/13 19:01:01 INFO mapred.LocalJobRunner: 2 / 2 copied.
21/01/13 19:01:01 INFO mapred.Task: Task attempt_local1702293927_0001_r_000000_0 is allowed to commit now
21/01/13 19:01:01 INFO output.FileOutputCommitter: Saved output of task 'attempt_local1702293927_0001_r_000000_0' to file:/root/output2/_temporary/0/task_local1702293927_0001_r_000000
21/01/13 19:01:01 INFO mapred.LocalJobRunner: reduce > reduce
21/01/13 19:01:01 INFO mapred.Task: Task 'attempt_local1702293927_0001_r_000000_0' done.
21/01/13 19:01:01 INFO mapred.Task: Final Counters for attempt_local1702293927_0001_r_000000_0: Counters: 24
File System Counters
FILE: Number of bytes read=297207
FILE: Number of bytes written=590035
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Combine input records=0
Combine output records=0
Reduce input groups=16
Reduce shuffle bytes=342
Reduce input records=26
Reduce output records=16
Spilled Records=26
Shuffled Maps =2
Failed Shuffles=0
Merged Map outputs=2
GC time elapsed (ms)=0
Total committed heap usage (bytes)=318242816
Shuffle Errors
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
File Output Format Counters
Bytes Written=143
21/01/13 19:01:01 INFO mapred.LocalJobRunner: Finishing task: attempt_local1702293927_0001_r_000000_0
21/01/13 19:01:01 INFO mapred.LocalJobRunner: reduce task executor complete.
21/01/13 19:01:02 INFO mapreduce.Job: Job job_local1702293927_0001 running in uber mode : false
21/01/13 19:01:02 INFO mapreduce.Job: map 100% reduce 100%
21/01/13 19:01:02 INFO mapreduce.Job: Job job_local1702293927_0001 completed successfully
21/01/13 19:01:02 INFO mapreduce.Job: Counters: 30
File System Counters
FILE: Number of bytes read=889851
FILE: Number of bytes written=1768964
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
Map-Reduce Framework
Map input records=9
Map output records=27
Map output bytes=286
Map output materialized bytes=342
Input split bytes=184
Combine input records=27
Combine output records=26
Reduce input groups=16
Reduce shuffle bytes=342
Reduce input records=26
Reduce output records=16
Spilled Records=52
Shuffled Maps =2
Failed Shuffles=0
Merged Map outputs=2
GC time elapsed (ms)=6
Total committed heap usage (bytes)=849346560
Shuffle Errors
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
File Input Format Counters
Bytes Read=178
File Output Format Counters
Bytes Written=143
[root@Mymaster ~]# cd output2
[root@Mymaster output2]# ll
总用量 4
-rw-r--r-- 1 root root 131 1月 13 19:01 part-r-00000
-rw-r--r-- 1 root root 0 1月 13 19:01 _SUCCESS
[root@Mymaster output2]# cat part-r-00000
Khaleesi 2
Link 2
My 2
are 1
bye 2
hello 1
hi 1
home 2
https://blog.csdn.net/m0_52080234 2
is 2
my 2
name 2
ok 1
page 2
to 2
you 1
[root@Mymaster output2]#
搞定!!
那么到了这一步就说明hadoop是没有问题的
安装hadoop伪分布式集群
简单介绍
hadoop伪分布式集群搭建好之后:
一台服务器,这个服务器上运行着多个进程
NameNode → 负责接收客户端存取的请求,并存储一些元数据(描述数据的数据)信息。类比:项目经理
DataNode → 负责hdfs上资源的具体的存和取。类比:项目组中的程序员
SecondaryNameNode → 用来协助NameName进程对元数据信息进行管理。类比:经理助理(秘书)
类比:一家公司就一个员工,这个员工充当了各种角色。(老板,员工,经理,程序员,出纳,…)
那么,下面是正式实操
免密登陆
介绍
首先看一下没有操作之前的样子
[root@Mymaster output2]# cd
[root@Mymaster ~]# ll ~/.ssh/
ls: 无法访问/root/.ssh/: 没有那个文件或目录
[root@Mymaster ~]# ll .ssh/
ls: 无法访问.ssh/: 没有那个文件或目录
[root@Mymaster ~]# ssh Mymaster
"The authenticity of host ‘mymaster (192.168.8.201)’ can’t be established.
ECDSA key fingerprint is SHA256:S18Xnq5jGlaByGMauuqmae8WCIN88kze704KfHa40jY.
ECDSA key fingerprint is MD5:e6:c6:37:60:2d:dd:d3:e5:bd:8d:00:cb:32:38:00:26.
Are you sure you want to continue connecting (yes/no)? y
Please type ‘yes’ or ‘no’: yes
Warning: Permanently added ‘mymaster,192.168.8.201’ (ECDSA) to the list of known hosts.
root@mymaster’s password:
Last login: Wed Jan 13 16:54:28 2021 from 192.168.8.1
[root@Mymaster ~]#
开始实施
生成公钥和私钥(rsa → 非对称加密)
私钥:产生后,在当前的节点上,不在网络上传输。
公钥:产生后,将公钥拷贝给授信用户,数据在网络上传输的,即使被拦截,也没有影响。
这里一直回车就好了
[root@Mymaster ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:+EgMgcNF/l7UsdKrTAgsPh/40esK5c9DT3rVXLJDnxY root@Mymaster
The key’s randomart image is:
±–[RSA 2048]----+
| . ++ . |
| +o . o o |
| …= o + |
| . o * + . .o E |
| + + B S .+ = o |
| * =.B… = + |
| . +.+++. o |
| . +o o |
| …+o |
±—[SHA256]-----+
[root@Mymaster ~]#
再次查看发现生成了文件,可以自行查看一下
[root@Mymaster ~]# exit
登出
Connection to mymaster closed.
[root@Mymaster ~]# ll .ssh/
总用量 12
-rw------- 1 root root 1675 1月 13 19:35 id_rsa
-rw-r–r-- 1 root root 395 1月 13 19:35 id_rsa.pub
-rw-r–r-- 1 root root 184 1月 13 19:32 known_hosts
[root@Mymaster ~]#
下面就是将公钥拷贝给授信用户
[root@master ~]# ssh-copy-id -i root@master
输入密码
搞定
[root@Mymaster ~]# ssh-copy-id -i root@Mymaster
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/root/.ssh/id_rsa.pub”
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keys
root@mymaster’s password:
Number of key(s) added: 1
Now try logging into the machine, with: “ssh ‘root@Mymaster’”
and check to make sure that only the key(s) you wanted were added.
[root@Mymaster ~]#
验证一下
[root@Mymaster ~]# ssh Mymaster
Last login: Wed Jan 13 19:41:38 2021 from mymaster
[root@Mymaster ~]#
不需要输入密码就成了
再看看文件情况
[root@Mymaster ~]# ll .ssh/
总用量 16
-rw------- 1 root root 395 1月 13 19:42 authorized_keys
-rw------- 1 root root 1675 1月 13 19:35 id_rsa
-rw-r--r-- 1 root root 395 1月 13 19:35 id_rsa.pub
-rw-r--r-- 1 root root 184 1月 13 19:32 known_hosts
[root@Mymaster ~]#
以下是对其的理解可供参考!!!
伪分布式对机器的要求不是很高,学习大数据相关知识大可用伪分布式集群,但想要学习原滋原味的大数据技术建议搭建完全分布式集群,这是徐老师的原话,现在感觉确实如此!!
定制参数
↓ core-site.xml ↓
[root@Mymaster ~]# cd /opt/hadoop/etc/hadoop/
[root@Mymaster hadoop]# vim core-site.xml
添加如下配置
<configuration>
<!--
配置分布式文件系统的schema和ip以及port,默认8020
schema: 协议,hdfs; 如:网络协议http,https
扩展: hadoop1.x的默认端口是9000,hadoop2.x的默认端口是8020,使用哪一个都可以
-->
<property>
<name>fs.defaultFS</name>
<value>hdfs://Mymaster/</value>
</property>
</configuration>
注意:除了注释内容其他地方都必须是英文输入法状态输入的,特别是空格!!!
↓ hdfs-site.xml ↓
[root@master hadoop]# vim hdfs-site.xml
添加如下配置
<configuration>
<!--
配置副本数,注意,伪分布模式只能是1。
特别强调:hdfs中副本数包含了本身,如:真实的hadoop分布式集群中,副本数是3 (也包含了自己)
副本机制:是为了提高容错性,集群中某台或是某部分节点宕机(情形:发生了不可预测的事件)了,不影
响整个集群的运作,数据不会丢失。
-->
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
格式化NameNode
[root@Mymaster hadoop]# hdfs namenode -format
[root@Mymaster hadoop]# hdfs namenode -format
21/01/13 20:21:16 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = Mymaster/192.168.8.201
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 2.7.6
STARTUP_MSG: classpath = /opt/hadoop/etc/hadoop:/opt/hadoop/share/hadoop/common/lib/commons-compress-1.4.1.jar:/opt/hadoop/share/hadoop/common/lib/commons-cli-1.2.jar:/opt/hadoop/share/hadoop/common/lib/jettison-1.1.jar:/opt/hadoop/share/hadoop/common/lib/curator-framework-2.7.1.jar:/opt/hadoop/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/opt/hadoop/share/hadoop/common/lib/slf4j-api-1.7.10.jar:/opt/hadoop/share/hadoop/common/lib/commons-digester-1.8.jar:/opt/hadoop/share/hadoop/common/lib/httpclient-4.2.5.jar:/opt/hadoop/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/opt/hadoop/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/opt/hadoop/share/hadoop/common/lib/jersey-server-1.9.jar:/opt/hadoop/share/hadoop/common/lib/mockito-all-1.8.5.jar:/opt/hadoop/share/hadoop/common/lib/commons-httpclient-3.1.jar:/opt/hadoop/share/hadoop/common/lib/jersey-core-1.9.jar:/opt/hadoop/share/hadoop/common/lib/xmlenc-0.52.jar:/opt/hadoop/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/opt/hadoop/share/hadoop/common/lib/jersey-json-1.9.jar:/opt/hadoop/share/hadoop/common/lib/curator-client-2.7.1.jar:/opt/hadoop/share/hadoop/common/lib/avro-1.7.4.jar:/opt/hadoop/share/hadoop/common/lib/commons-net-3.1.jar:/opt/hadoop/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/opt/hadoop/share/hadoop/common/lib/log4j-1.2.17.jar:/opt/hadoop/share/hadoop/common/lib/gson-2.2.4.jar:/opt/hadoop/share/hadoop/common/lib/hamcrest-core-1.3.jar:/opt/hadoop/share/hadoop/common/lib/commons-io-2.4.jar:/opt/hadoop/share/hadoop/common/lib/commons-configuration-1.6.jar:/opt/hadoop/share/hadoop/common/lib/activation-1.1.jar:/opt/hadoop/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/opt/hadoop/share/hadoop/common/lib/jets3t-0.9.0.jar:/opt/hadoop/share/hadoop/common/lib/apacheds-i18n-2.0.0-M15.jar:/opt/hadoop/share/hadoop/common/lib/jetty-util-6.1.26.jar:/opt/hadoop/share/hadoop/common/lib/commons-collections-3.2.2.jar:/opt/hadoop/share/hadoop/common/lib/zookeeper-3.4.6.jar:/opt/hadoop/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/opt/hadoop/share/hadoop/common/lib/commons-beanutils-core-1.8.0.jar:/opt/hadoop/share/hadoop/common/lib/jsch-0.1.54.jar:/opt/hadoop/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/opt/hadoop/share/hadoop/common/lib/commons-math3-3.1.1.jar:/opt/hadoop/share/hadoop/common/lib/hadoop-auth-2.7.6.jar:/opt/hadoop/share/hadoop/common/lib/servlet-api-2.5.jar:/opt/hadoop/share/hadoop/common/lib/commons-logging-1.1.3.jar:/opt/hadoop/share/hadoop/common/lib/jsr305-3.0.0.jar:/opt/hadoop/share/hadoop/common/lib/commons-beanutils-1.7.0.jar:/opt/hadoop/share/hadoop/common/lib/xz-1.0.jar:/opt/hadoop/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/opt/hadoop/share/hadoop/common/lib/jetty-sslengine-6.1.26.jar:/opt/hadoop/share/hadoop/common/lib/curator-recipes-2.7.1.jar:/opt/hadoop/share/hadoop/common/lib/snappy-java-1.0.4.1.jar:/opt/hadoop/share/hadoop/common/lib/guava-11.0.2.jar:/opt/hadoop/share/hadoop/common/lib/hadoop-annotations-2.7.6.jar:/opt/hadoop/share/hadoop/common/lib/httpcore-4.2.5.jar:/opt/hadoop/share/hadoop/common/lib/junit-4.11.jar:/opt/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar:/opt/hadoop/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/opt/hadoop/share/hadoop/common/lib/paranamer-2.3.jar:/opt/hadoop/share/hadoop/common/lib/netty-3.6.2.Final.jar:/opt/hadoop/share/hadoop/common/lib/jsp-api-2.1.jar:/opt/hadoop/share/hadoop/common/lib/asm-3.2.jar:/opt/hadoop/share/hadoop/common/lib/stax-api-1.0-2.jar:/opt/hadoop/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/opt/hadoop/share/hadoop/common/lib/commons-codec-1.4.jar:/opt/hadoop/share/hadoop/common/lib/jetty-6.1.26.jar:/opt/hadoop/share/hadoop/common/lib/htrace-core-3.1.0-incubating.jar:/opt/hadoop/share/hadoop/common/lib/commons-lang-2.6.jar:/opt/hadoop/share/hadoop/common/hadoop-common-2.7.6-tests.jar:/opt/hadoop/share/hadoop/common/hadoop-common-2.7.6.jar:/opt/hadoop/share/hadoop/common/hadoop-nfs-2.7.6.jar:/opt/hadoop/share/hadoop/hdfs:/opt/hadoop/share/hadoop/hdfs/lib/xml-apis-1.3.04.jar:/opt/hadoop/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/opt/hadoop/share/hadoop/hdfs/lib/netty-all-4.0.23.Final.jar:/opt/hadoop/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/opt/hadoop/share/hadoop/hdfs/lib/jersey-server-1.9.jar:/opt/hadoop/share/hadoop/hdfs/lib/jersey-core-1.9.jar:/opt/hadoop/share/hadoop/hdfs/lib/xmlenc-0.52.jar:/opt/hadoop/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/opt/hadoop/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/opt/hadoop/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/opt/hadoop/share/hadoop/hdfs/lib/commons-io-2.4.jar:/opt/hadoop/share/hadoop/hdfs/lib/jetty-util-6.1.26.jar:/opt/hadoop/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/opt/hadoop/share/hadoop/hdfs/lib/xercesImpl-2.9.1.jar:/opt/hadoop/share/hadoop/hdfs/lib/servlet-api-2.5.jar:/opt/hadoop/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/opt/hadoop/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/opt/hadoop/share/hadoop/hdfs/lib/guava-11.0.2.jar:/opt/hadoop/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/opt/hadoop/share/hadoop/hdfs/lib/netty-3.6.2.Final.jar:/opt/hadoop/share/hadoop/hdfs/lib/asm-3.2.jar:/opt/hadoop/share/hadoop/hdfs/lib/commons-codec-1.4.jar:/opt/hadoop/share/hadoop/hdfs/lib/jetty-6.1.26.jar:/opt/hadoop/share/hadoop/hdfs/lib/htrace-core-3.1.0-incubating.jar:/opt/hadoop/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/opt/hadoop/share/hadoop/hdfs/hadoop-hdfs-nfs-2.7.6.jar:/opt/hadoop/share/hadoop/hdfs/hadoop-hdfs-2.7.6-tests.jar:/opt/hadoop/share/hadoop/hdfs/hadoop-hdfs-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/lib/commons-compress-1.4.1.jar:/opt/hadoop/share/hadoop/yarn/lib/guice-3.0.jar:/opt/hadoop/share/hadoop/yarn/lib/commons-cli-1.2.jar:/opt/hadoop/share/hadoop/yarn/lib/jettison-1.1.jar:/opt/hadoop/share/hadoop/yarn/lib/protobuf-java-2.5.0.jar:/opt/hadoop/share/hadoop/yarn/lib/jersey-server-1.9.jar:/opt/hadoop/share/hadoop/yarn/lib/jersey-core-1.9.jar:/opt/hadoop/share/hadoop/yarn/lib/jackson-mapper-asl-1.9.13.jar:/opt/hadoop/share/hadoop/yarn/lib/jersey-json-1.9.jar:/opt/hadoop/share/hadoop/yarn/lib/jackson-xc-1.9.13.jar:/opt/hadoop/share/hadoop/yarn/lib/leveldbjni-all-1.8.jar:/opt/hadoop/share/hadoop/yarn/lib/guice-servlet-3.0.jar:/opt/hadoop/share/hadoop/yarn/lib/log4j-1.2.17.jar:/opt/hadoop/share/hadoop/yarn/lib/commons-io-2.4.jar:/opt/hadoop/share/hadoop/yarn/lib/activation-1.1.jar:/opt/hadoop/share/hadoop/yarn/lib/jetty-util-6.1.26.jar:/opt/hadoop/share/hadoop/yarn/lib/commons-collections-3.2.2.jar:/opt/hadoop/share/hadoop/yarn/lib/zookeeper-3.4.6.jar:/opt/hadoop/share/hadoop/yarn/lib/jersey-guice-1.9.jar:/opt/hadoop/share/hadoop/yarn/lib/jackson-core-asl-1.9.13.jar:/opt/hadoop/share/hadoop/yarn/lib/jaxb-impl-2.2.3-1.jar:/opt/hadoop/share/hadoop/yarn/lib/javax.inject-1.jar:/opt/hadoop/share/hadoop/yarn/lib/jersey-client-1.9.jar:/opt/hadoop/share/hadoop/yarn/lib/servlet-api-2.5.jar:/opt/hadoop/share/hadoop/yarn/lib/commons-logging-1.1.3.jar:/opt/hadoop/share/hadoop/yarn/lib/jsr305-3.0.0.jar:/opt/hadoop/share/hadoop/yarn/lib/xz-1.0.jar:/opt/hadoop/share/hadoop/yarn/lib/jaxb-api-2.2.2.jar:/opt/hadoop/share/hadoop/yarn/lib/guava-11.0.2.jar:/opt/hadoop/share/hadoop/yarn/lib/zookeeper-3.4.6-tests.jar:/opt/hadoop/share/hadoop/yarn/lib/jackson-jaxrs-1.9.13.jar:/opt/hadoop/share/hadoop/yarn/lib/netty-3.6.2.Final.jar:/opt/hadoop/share/hadoop/yarn/lib/asm-3.2.jar:/opt/hadoop/share/hadoop/yarn/lib/stax-api-1.0-2.jar:/opt/hadoop/share/hadoop/yarn/lib/aopalliance-1.0.jar:/opt/hadoop/share/hadoop/yarn/lib/commons-codec-1.4.jar:/opt/hadoop/share/hadoop/yarn/lib/jetty-6.1.26.jar:/opt/hadoop/share/hadoop/yarn/lib/commons-lang-2.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-server-nodemanager-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-server-common-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-server-tests-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-common-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-client-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-registry-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-server-web-proxy-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-server-sharedcachemanager-2.7.6.jar:/opt/hadoop/share/hadoop/yarn/hadoop-yarn-api-2.7.6.jar:/opt/hadoop/share/hadoop/mapreduce/lib/commons-compress-1.4.1.jar:/opt/hadoop/share/hadoop/mapreduce/lib/guice-3.0.jar:/opt/hadoop/share/hadoop/mapreduce/lib/protobuf-java-2.5.0.jar:/opt/hadoop/share/hadoop/mapreduce/lib/jersey-server-1.9.jar:/opt/hadoop/share/hadoop/mapreduce/lib/jersey-core-1.9.jar:/opt/hadoop/share/hadoop/mapreduce/lib/jackson-mapper-asl-1.9.13.jar:/opt/hadoop/share/hadoop/mapreduce/lib/avro-1.7.4.jar:/opt/hadoop/share/hadoop/mapreduce/lib/leveldbjni-all-1.8.jar:/opt/hadoop/share/hadoop/mapreduce/lib/guice-servlet-3.0.jar:/opt/hadoop/share/hadoop/mapreduce/lib/log4j-1.2.17.jar:/opt/hadoop/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/opt/hadoop/share/hadoop/mapreduce/lib/commons-io-2.4.jar:/opt/hadoop/share/hadoop/mapreduce/lib/jersey-guice-1.9.jar:/opt/hadoop/share/hadoop/mapreduce/lib/jackson-core-asl-1.9.13.jar:/opt/hadoop/share/hadoop/mapreduce/lib/javax.inject-1.jar:/opt/hadoop/share/hadoop/mapreduce/lib/xz-1.0.jar:/opt/hadoop/share/hadoop/mapreduce/lib/snappy-java-1.0.4.1.jar:/opt/hadoop/share/hadoop/mapreduce/lib/hadoop-annotations-2.7.6.jar:/opt/hadoop/share/hadoop/mapreduce/lib/junit-4.11.jar:/opt/hadoop/share/hadoop/mapreduce/lib/paranamer-2.3.jar:/opt/hadoop/share/hadoop/mapreduce/lib/netty-3.6.2.Final.jar:/opt/hadoop/share/hadoop/mapreduce/lib/asm-3.2.jar:/opt/hadoop/share/hadoop/mapreduce/lib/aopalliance-1.0.jar:/opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.6.jar:/opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.7.6-tests.jar:/opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-common-2.7.6.jar:/opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-2.7.6.jar:/opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-2.7.6.jar:/opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.7.6.jar:/opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.7.6.jar:/opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-app-2.7.6.jar:/opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-2.7.6.jar:/opt/hadoop/contrib/capacity-scheduler/*.jar
STARTUP_MSG: build = https://shv@git-wip-us.apache.org/repos/asf/hadoop.git -r 085099c66cf28be31604560c376fa282e69282b8; compiled by ‘kshvachk’ on 2018-04-18T01:33Z
STARTUP_MSG: java = 1.8.0_112
/
21/01/13 20:21:16 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
21/01/13 20:21:16 INFO namenode.NameNode: createNameNode [-format]
Formatting using clusterid: CID-13191200-7b05-4e3c-b436-56b9507c0e4a
21/01/13 20:21:16 INFO namenode.FSNamesystem: No KeyProvider found.
21/01/13 20:21:16 INFO namenode.FSNamesystem: fsLock is fair: true
21/01/13 20:21:16 INFO namenode.FSNamesystem: Detailed lock hold time metrics enabled: false
21/01/13 20:21:16 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit=1000
21/01/13 20:21:16 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true
21/01/13 20:21:16 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000
21/01/13 20:21:16 INFO blockmanagement.BlockManager: The block deletion will start around 2021 一月 13 20:21:16
21/01/13 20:21:16 INFO util.GSet: Computing capacity for map BlocksMap
21/01/13 20:21:16 INFO util.GSet: VM type = 64-bit
21/01/13 20:21:16 INFO util.GSet: 2.0% max memory 889 MB = 17.8 MB
21/01/13 20:21:16 INFO util.GSet: capacity = 2^21 = 2097152 entries
21/01/13 20:21:16 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false
21/01/13 20:21:16 INFO blockmanagement.BlockManager: defaultReplication = 1
21/01/13 20:21:16 INFO blockmanagement.BlockManager: maxReplication = 512
21/01/13 20:21:16 INFO blockmanagement.BlockManager: minReplication = 1
21/01/13 20:21:16 INFO blockmanagement.BlockManager: maxReplicationStreams = 2
21/01/13 20:21:16 INFO blockmanagement.BlockManager: replicationRecheckInterval = 3000
21/01/13 20:21:16 INFO blockmanagement.BlockManager: encryptDataTransfer = false
21/01/13 20:21:16 INFO blockmanagement.BlockManager: maxNumBlocksToLog = 1000
21/01/13 20:21:16 INFO namenode.FSNamesystem: fsOwner = root (auth:SIMPLE)
21/01/13 20:21:16 INFO namenode.FSNamesystem: supergroup = supergroup
21/01/13 20:21:16 INFO namenode.FSNamesystem: isPermissionEnabled = true
21/01/13 20:21:16 INFO namenode.FSNamesystem: HA Enabled: false
21/01/13 20:21:16 INFO namenode.FSNamesystem: Append Enabled: true
21/01/13 20:21:16 INFO util.GSet: Computing capacity for map INodeMap
21/01/13 20:21:16 INFO util.GSet: VM type = 64-bit
21/01/13 20:21:16 INFO util.GSet: 1.0% max memory 889 MB = 8.9 MB
21/01/13 20:21:16 INFO util.GSet: capacity = 2^20 = 1048576 entries
21/01/13 20:21:16 INFO namenode.FSDirectory: ACLs enabled? false
21/01/13 20:21:16 INFO namenode.FSDirectory: XAttrs enabled? true
21/01/13 20:21:16 INFO namenode.FSDirectory: Maximum size of an xattr: 16384
21/01/13 20:21:16 INFO namenode.NameNode: Caching file names occuring more than 10 times
21/01/13 20:21:16 INFO util.GSet: Computing capacity for map cachedBlocks
21/01/13 20:21:16 INFO util.GSet: VM type = 64-bit
21/01/13 20:21:16 INFO util.GSet: 0.25% max memory 889 MB = 2.2 MB
21/01/13 20:21:16 INFO util.GSet: capacity = 2^18 = 262144 entries
21/01/13 20:21:16 INFO namenode.FSNamesystem: dfs.namenode.safemode.threshold-pct = 0.9990000128746033
21/01/13 20:21:16 INFO namenode.FSNamesystem: dfs.namenode.safemode.min.datanodes = 0
21/01/13 20:21:16 INFO namenode.FSNamesystem: dfs.namenode.safemode.extension = 30000
21/01/13 20:21:16 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 10
21/01/13 20:21:16 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10
21/01/13 20:21:16 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25
21/01/13 20:21:16 INFO namenode.FSNamesystem: Retry cache on namenode is enabled
21/01/13 20:21:16 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
21/01/13 20:21:16 INFO util.GSet: Computing capacity for map NameNodeRetryCache
21/01/13 20:21:16 INFO util.GSet: VM type = 64-bit
21/01/13 20:21:16 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB
21/01/13 20:21:16 INFO util.GSet: capacity = 2^15 = 32768 entries
21/01/13 20:21:16 INFO namenode.FSImage: Allocated new BlockPoolId: BP-2100367676-192.168.8.201-1610540476704
21/01/13 20:21:16 INFO common.Storage: Storage directory /tmp/hadoop-root/dfs/name has been successfully formatted.
21/01/13 20:21:16 INFO namenode.FSImageFormatProtobuf: Saving image file /tmp/hadoop-root/dfs/name/current/fsimage.ckpt_0000000000000000000 using no compression
21/01/13 20:21:16 INFO namenode.FSImageFormatProtobuf: Image file /tmp/hadoop-root/dfs/name/current/fsimage.ckpt_0000000000000000000 of size 320 bytes saved in 0 seconds.
21/01/13 20:21:16 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
21/01/13 20:21:16 INFO util.ExitUtil: Exiting with status 0
21/01/13 20:21:16 INFO namenode.NameNode: SHUTDOWN_MSG:
/
SHUTDOWN_MSG: Shutting down NameNode at Mymaster/192.168.8.201
************************************************************/
[root@Mymaster hadoop]#
到了这一步,我们就可以启动了!!
[root@Mymaster hadoop]# start-dfs.sh
[root@Mymaster hadoop]# start-dfs.sh
Starting namenodes on [Mymaster]
Mymaster: starting namenode, logging to /opt/hadoop/logs/hadoop-root-namenode-Mymaster.out
The authenticity of host ‘localhost (::1)’ can’t be established.
ECDSA key fingerprint is SHA256:S18Xnq5jGlaByGMauuqmae8WCIN88kze704KfHa40jY.
ECDSA key fingerprint is MD5:e6:c6:37:60:2d:dd:d3:e5:bd:8d:00:cb:32:38:00:26.
Are you sure you want to continue connecting (yes/no)? yes
localhost: Warning: Permanently added ‘localhost’ (ECDSA) to the list of known hosts.
localhost: starting datanode, logging to /opt/hadoop/logs/hadoop-root-datanode-Mymaster.out
Starting secondary namenodes [0.0.0.0]
The authenticity of host ‘0.0.0.0 (0.0.0.0)’ can’t be established.
ECDSA key fingerprint is SHA256:S18Xnq5jGlaByGMauuqmae8WCIN88kze704KfHa40jY.
ECDSA key fingerprint is MD5:e6:c6:37:60:2d:dd:d3:e5:bd:8d:00:cb:32:38:00:26.
Are you sure you want to continue connecting (yes/no)? yes
0.0.0.0: Warning: Permanently added ‘0.0.0.0’ (ECDSA) to the list of known hosts.
0.0.0.0: starting secondarynamenode, logging to /opt/hadoop/logs/hadoop-root-secondarynamenode-Mymaster.out
[root@Mymaster hadoop]#
查看进程对不对
[root@Mymaster hadoop]# jps
11312 SecondaryNameNode
13126 Jps
10567 NameNode
11004 DataNode
[root@Mymaster hadoop]#
使用web ui查看hdfs
浏览器输入
http://mymaster:50070/
验证集群
上传验证
[root@Mymaster hadoop]# cd
[root@Mymaster ~]# cd input
[root@Mymaster input]# hdfs dfs -mkdir /input
[root@Mymaster input]# hdfs dfs -put *.txt /input
[root@Mymaster input]# hdfs dfs -cat hdfs://Mymaster:8020/input/*
dfsa
ddasf
dfsf
dfsaa
sdfs
aaa
[root@Mymaster input]# hdfs dfs -cat input/*
cat: `input/*': No such file or directory
[root@Mymaster input]# hdfs dfs -cat /input/*
dfsa
ddasf
dfsf
dfsaa
sdfs
aaa
[root@Mymaster input]#
这里可以带协议也可以不带
web ul查看
下载验证
[root@Mymaster input]# cd
[root@Mymaster ~]# mkdir download
[root@Mymaster ~]# cd download/
[root@Mymaster download]#
[root@Mymaster download]# hdfs dfs -get /input/* ./hdfs资源.txt
[root@Mymaster download]# ll
总用量 4
-rw-r--r-- 1 root root 31 1月 13 20:44 hdfs资源.txt
[root@Mymaster download]# cat hdfs资源.txt
dfsa
ddasf
dfsf
dfsaa
sdfs
aaa
[root@Mymaster download]#
wordcount案例
yarn jar /opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.6.jar wordcount /input hdfs://master:8020/output
[root@Mymaster download]# yarn jar /opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.6.jar wordcount /input hdfs://Mymaster:8020/output
21/01/13 20:48:53 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
21/01/13 20:48:53 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
21/01/13 20:48:54 INFO input.FileInputFormat: Total input paths to process : 1
21/01/13 20:48:54 INFO mapreduce.JobSubmitter: number of splits:1
21/01/13 20:48:54 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local912645392_0001
21/01/13 20:48:54 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
21/01/13 20:48:54 INFO mapreduce.Job: Running job: job_local912645392_0001
21/01/13 20:48:54 INFO mapred.LocalJobRunner: OutputCommitter set in config null
21/01/13 20:48:54 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 20:48:54 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
21/01/13 20:48:54 INFO mapred.LocalJobRunner: Waiting for map tasks
21/01/13 20:48:54 INFO mapred.LocalJobRunner: Starting task: attempt_local912645392_0001_m_000000_0
21/01/13 20:48:54 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
21/01/13 20:48:54 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ]
21/01/13 20:48:54 INFO mapred.MapTask: Processing split: hdfs://Mymaster/input/Test.txt:0+31
21/01/13 20:48:54 INFO mapred.MapTask: (EQUATOR) 0 kvi 26214396(104857584)
21/01/13 20:48:54 INFO mapred.MapTask: mapreduce.task.io.sort.mb: 100
21/01/13 20:48:54 INFO mapred.MapTask: soft limit at 83886080
21/01/13 20:48:54 INFO mapred.MapTask: bufstart = 0; bufvoid = 104857600
21/01/13 20:48:54 INFO mapred.MapTask: kvstart = 26214396; length = 6553600
21/01/13 20:48:54 INFO mapred.MapTask: Map output collector class = org.apache.hadoop.mapred.MapTaskKaTeX parse error: Double subscript at position 522: …12645392_0001_m_̲000000_0 is don…POSIX.posix_fadvise(Native Method)
at org.apache.hadoop.io.nativeio.NativeIOPOSIXReadaheadRequestImpl.run(ReadaheadPool.java:206)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
21/01/13 20:48:55 INFO reduce.EventFetcher: EventFetcher is interrupted… Returning
21/01/13 20:48:55 INFO mapred.LocalJobRunner: 1 / 1 copied.
21/01/13 20:48:55 INFO reduce.MergeManagerImpl: finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs
21/01/13 20:48:55 INFO mapred.Merger: Merging 1 sorted segments
21/01/13 20:48:55 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 63 bytes
21/01/13 20:48:55 INFO reduce.MergeManagerImpl: Merged 1 segments, 69 bytes to disk to satisfy reduce memory limit
21/01/13 20:48:55 INFO reduce.MergeManagerImpl: Merging 1 files, 73 bytes from disk
21/01/13 20:48:55 INFO reduce.MergeManagerImpl: Merging 0 segments, 0 bytes from memory into reduce
21/01/13 20:48:55 INFO mapred.Merger: Merging 1 sorted segments
21/01/13 20:48:55 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 63 bytes
21/01/13 20:48:55 INFO mapred.LocalJobRunner: 1 / 1 copied.
21/01/13 20:48:55 INFO Configuration.deprecation: mapred.skip.on is deprecated. Instead, use mapreduce.job.skiprecords
21/01/13 20:48:55 INFO mapred.Task: Task:attempt_local912645392_0001_r_000000_0 is done. And is in the process of committing
21/01/13 20:48:55 INFO mapred.LocalJobRunner: 1 / 1 copied.
21/01/13 20:48:55 INFO mapred.Task: Task attempt_local912645392_0001_r_000000_0 is allowed to commit now
21/01/13 20:48:55 INFO output.FileOutputCommitter: Saved output of task ‘attempt_local912645392_0001_r_000000_0’ to hdfs://Mymaster:8020/output/_temporary/0/task_local912645392_0001_r_000000
21/01/13 20:48:55 INFO mapred.LocalJobRunner: reduce > reduce
21/01/13 20:48:55 INFO mapred.Task: Task ‘attempt_local912645392_0001_r_000000_0’ done.
21/01/13 20:48:55 INFO mapred.Task: Final Counters for attempt_local912645392_0001_r_000000_0: Counters: 29
File System Counters
FILE: Number of bytes read=296159
FILE: Number of bytes written=588185
FILE: Number of read operatinotallow=0
FILE: Number of large read operatinotallow=0
FILE: Number of write operatinotallow=0
HDFS: Number of bytes read=31
HDFS: Number of bytes written=43
HDFS: Number of read operatinotallow=8
HDFS: Number of large read operatinotallow=0
HDFS: Number of write operatinotallow=3
Map-Reduce Framework
Combine input records=0
Combine output records=0
Reduce input groups=6
Reduce shuffle bytes=73
Reduce input records=6
Reduce output records=6
Spilled Records=6
Shuffled Maps =1
Failed Shuffles=0
Merged Map outputs=1
GC time elapsed (ms)=0
Total committed heap usage (bytes)=269484032
Shuffle Errors
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
File Output Format Counters
Bytes Written=43
21/01/13 20:48:55 INFO mapred.LocalJobRunner: Finishing task: attempt_local912645392_0001_r_000000_0
21/01/13 20:48:55 INFO mapred.LocalJobRunner: reduce task executor complete.
21/01/13 20:48:55 INFO mapreduce.Job: Job job_local912645392_0001 running in uber mode : false
21/01/13 20:48:55 INFO mapreduce.Job: map 100% reduce 100%
21/01/13 20:48:55 INFO mapreduce.Job: Job job_local912645392_0001 completed successfully
21/01/13 20:48:55 INFO mapreduce.Job: Counters: 35
File System Counters
FILE: Number of bytes read=592140
FILE: Number of bytes written=1176297
FILE: Number of read operatinotallow=0
FILE: Number of large read operatinotallow=0
FILE: Number of write operatinotallow=0
HDFS: Number of bytes read=62
HDFS: Number of bytes written=43
HDFS: Number of read operatinotallow=13
HDFS: Number of large read operatinotallow=0
HDFS: Number of write operatinotallow=4
Map-Reduce Framework
Map input records=6
Map output records=6
Map output bytes=55
Map output materialized bytes=73
Input split bytes=95
Combine input records=6
Combine output records=6
Reduce input groups=6
Reduce shuffle bytes=73
Reduce input records=6
Reduce output records=6
Spilled Records=12
Shuffled Maps =1
Failed Shuffles=0
Merged Map outputs=1
GC time elapsed (ms)=0
Total committed heap usage (bytes)=538968064
Shuffle Errors
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
File Input Format Counters
Bytes Read=31
File Output Format Counters
Bytes Written=43
[root@Mymaster download]#
查看结果
[root@Mymaster download]# hdfs dfs -cat /output/*
aaa 1
ddasf 1
dfsa 1
dfsaa 1
dfsf 1
sdfs 1
[root@Mymaster download]#
到这里集群几乎是没有问题的!
注意:集群这玩意是个娇妻,我们初学者经常会开关机,也就存在集群弄坏的情况!!干这行需要注意每个细节才能早点下班,少掉点头发…所以,我们每次用完集群不要用它的时候一定要先关集群再关机,目前只有hadoop集群,所以只需要先关hadoop集群即可
实操
[root@Mymaster download]# stop-
stop-all.cmd stop-balancer.sh stop-dfs.sh stop-yarn.cmd
stop-all.sh stop-dfs.cmd stop-secure-dns.sh stop-yarn.sh
[root@Mymaster download]# stop-dfs.sh
Stopping namenodes on [Mymaster]
Mymaster: stopping namenode
localhost: stopping datanode
Stopping secondary namenodes [0.0.0.0]
0.0.0.0: stopping secondarynamenode
[root@Mymaster download]# jps
45198 Jps
[root@Mymaster download]#
这里有个小技巧,单机tab键自动补齐,双击查看有哪些可用的操作
最后要是jps没有进程表示关闭成功!!
我们就可以安安心心的关机了!!