[hadoop@localhost ~]$ hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.9.1.jar wordcount wc.input output2 18/10/22 12:39:26 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 18/10/22 12:39:26 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id 18/10/22 12:39:26 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId= 18/10/22 12:39:26 INFO input.FileInputFormat: Total input files to process : 1 18/10/22 12:39:26 INFO mapreduce.JobSubmitter: number of splits:1 18/10/22 12:39:27 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local841462251_0001 18/10/22 12:39:27 INFO mapreduce.Job: The url to track the job: http://localhost:8080/ 18/10/22 12:39:27 INFO mapreduce.Job: Running job: job_local841462251_0001 18/10/22 12:39:27 INFO mapred.LocalJobRunner: OutputCommitter setin config null 18/10/22 12:39:27 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1 18/10/22 12:39:27 INFO output.FileOutputCommitter: FileOutputCommitter skip cleanup _temporary folders under output directory:false, ignore cleanup failures: false 18/10/22 12:39:27 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter 18/10/22 12:39:27 INFO mapred.LocalJobRunner: Waiting for map tasks 18/10/22 12:39:27 INFO mapred.LocalJobRunner: Starting task: attempt_local841462251_0001_m_000000_0 18/10/22 12:39:27 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1 18/10/22 12:39:27 INFO output.FileOutputCommitter: FileOutputCommitter skip cleanup _temporary folders under output directory:false, ignore cleanup failures: false 18/10/22 12:39:27 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ] 18/10/22 12:39:27 INFO mapred.MapTask: Processing split: file:/home/hadoop/wc.input:0+71 18/10/22 12:39:27 INFO mapred.MapTask: (EQUATOR) 0 kvi 26214396(104857584) 18/10/22 12:39:27 INFO mapred.MapTask: mapreduce.task.io.sort.mb: 100 18/10/22 12:39:27 INFO mapred.MapTask: soft limit at 83886080 18/10/22 12:39:27 INFO mapred.MapTask: bufstart = 0; bufvoid = 104857600 18/10/22 12:39:27 INFO mapred.MapTask: kvstart = 26214396; length = 6553600 18/10/22 12:39:27 INFO mapred.MapTask: Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer 18/10/22 12:39:27 INFO mapred.LocalJobRunner: 18/10/22 12:39:27 INFO mapred.MapTask: Starting flush of map output 18/10/22 12:39:27 INFO mapred.MapTask: Spilling map output 18/10/22 12:39:27 INFO mapred.MapTask: bufstart = 0; bufend = 115; bufvoid = 104857600 18/10/22 12:39:27 INFO mapred.MapTask: kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600 18/10/22 12:39:27 INFO mapred.MapTask: Finished spill 0 18/10/22 12:39:27 INFO mapred.Task: Task:attempt_local841462251_0001_m_000000_0 is done. And is in the process of committing 18/10/22 12:39:27 INFO mapred.LocalJobRunner: map 18/10/22 12:39:27 INFO mapred.Task: Task 'attempt_local841462251_0001_m_000000_0'done. 18/10/22 12:39:27 INFO mapred.LocalJobRunner: Finishing task: attempt_local841462251_0001_m_000000_0 18/10/22 12:39:27 INFO mapred.LocalJobRunner: map task executor complete. 18/10/22 12:39:27 INFO mapred.LocalJobRunner: Waiting for reduce tasks 18/10/22 12:39:27 INFO mapred.LocalJobRunner: Starting task: attempt_local841462251_0001_r_000000_0 18/10/22 12:39:27 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1 18/10/22 12:39:27 INFO output.FileOutputCommitter: FileOutputCommitter skip cleanup _temporary folders under output directory:false, ignore cleanup failures: false 18/10/22 12:39:27 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ] 18/10/22 12:39:27 INFO mapred.ReduceTask: Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@65deffe9 18/10/22 12:39:27 INFO reduce.MergeManagerImpl: MergerManager: memoryLimit=334338464, maxSingleShuffleLimit=83584616, mergeThreshold=220663392, ioSortFactor=10, memToMemMergeOutputsThreshold=10 18/10/22 12:39:27 INFO reduce.EventFetcher: attempt_local841462251_0001_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events 18/10/22 12:39:27 INFO reduce.LocalFetcher: localfetcher#1 about to shuffle output of map attempt_local841462251_0001_m_000000_0 decomp: 90 len: 94 to MEMORY 18/10/22 12:39:27 INFO reduce.InMemoryMapOutput: Read 90 bytes from map-output for attempt_local841462251_0001_m_000000_0 18/10/22 12:39:27 INFO reduce.MergeManagerImpl: closeInMemoryFile -> map-output of size: 90, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->90 18/10/22 12:39:27 INFO reduce.EventFetcher: EventFetcher is interrupted.. Returning 18/10/22 12:39:27 INFO mapred.LocalJobRunner: 1 / 1 copied. 18/10/22 12:39:27 INFO reduce.MergeManagerImpl: finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs 18/10/22 12:39:27 INFO mapred.Merger: Merging 1 sorted segments 18/10/22 12:39:27 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 81 bytes 18/10/22 12:39:27 INFO reduce.MergeManagerImpl: Merged 1 segments, 90 bytes to disk to satisfy reduce memory limit 18/10/22 12:39:27 INFO reduce.MergeManagerImpl: Merging 1 files, 94 bytes from disk 18/10/22 12:39:27 INFO reduce.MergeManagerImpl: Merging 0 segments, 0 bytes from memory into reduce 18/10/22 12:39:27 INFO mapred.Merger: Merging 1 sorted segments 18/10/22 12:39:27 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 81 bytes 18/10/22 12:39:27 INFO mapred.LocalJobRunner: 1 / 1 copied. 18/10/22 12:39:27 INFO Configuration.deprecation: mapred.skip.on is deprecated. Instead, use mapreduce.job.skiprecords 18/10/22 12:39:27 INFO mapred.Task: Task:attempt_local841462251_0001_r_000000_0 is done. And is in the process of committing 18/10/22 12:39:27 INFO mapred.LocalJobRunner: 1 / 1 copied. 18/10/22 12:39:27 INFO mapred.Task: Task attempt_local841462251_0001_r_000000_0 is allowed to commit now 18/10/22 12:39:27 INFO output.FileOutputCommitter: Saved output of task 'attempt_local841462251_0001_r_000000_0' to file:/home/hadoop/output2/_temporary/0/task_local841462251_0001_r_000000 18/10/22 12:39:27 INFO mapred.LocalJobRunner: reduce > reduce 18/10/22 12:39:27 INFO mapred.Task: Task 'attempt_local841462251_0001_r_000000_0'done. 18/10/22 12:39:27 INFO mapred.LocalJobRunner: Finishing task: attempt_local841462251_0001_r_000000_0 18/10/22 12:39:27 INFO mapred.LocalJobRunner: reduce task executor complete. 18/10/22 12:39:28 INFO mapreduce.Job: Job job_local841462251_0001 running in uber mode : false 18/10/22 12:39:28 INFO mapreduce.Job: map 100% reduce 100% 18/10/22 12:39:28 INFO mapreduce.Job: Job job_local841462251_0001 completed successfully 18/10/22 12:39:28 INFO mapreduce.Job: Counters: 30 File System Counters FILE: Number of bytes read=607284 FILE: Number of bytes written=1537636 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=11 Map output bytes=115 Map output materialized bytes=94 Input split bytes=91 Combine input records=11 Combine output records=7 Reduce input groups=7 Reduce shuffle bytes=94 Reduce input records=7 Reduce output records=7 Spilled Records=14 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=0 Total committed heap usage (bytes)=525336576 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=71 File Output Format Counters Bytes Written=72 [hadoop@localhost ~]$
[hadoop@localhost hadoop-2.9.1]$ hdfs Usage: hdfs [--config confdir] [--loglevel loglevel] COMMAND where COMMAND is one of: dfs run a filesystem command on the file systems supported in Hadoop. classpath prints the classpath namenode -format format the DFS filesystem secondarynamenode run the DFS secondary namenode namenode run the DFS namenode journalnode run the DFS journalnode zkfc run the ZK Failover Controller daemon datanode run a DFS datanode debug run a Debug Admin to execute HDFS debug commands dfsadmin run a DFS admin client dfsrouter run the DFS router dfsrouteradmin manage Router-based federation haadmin run a DFS HA admin client fsck run a DFS filesystem checking utility balancer run a cluster balancing utility jmxget get JMX exported values from NameNode or DataNode. mover run a utility to move block replicas across storage types oiv apply the offline fsimage viewer to an fsimage oiv_legacy apply the offline fsimage viewer to an legacy fsimage oev apply the offline edits viewer to an edits file fetchdt fetch a delegation token from the NameNode getconf get config values from configuration groups get the groupswhichusers belong to snapshotDiff diff two snapshots of a directory or diff the current directory contents with a snapshot lsSnapshottableDir list all snapshottable dirs owned by the current user Use -help to see options portmap run a portmap service nfs3 run an NFS version 3 gateway cacheadmin configure the HDFS cache crypto configure HDFS encryption zones storagepolicies list/get/set block storage policies version print the version
Most commands printhelp when invoked w/o parameters.
[hadoop@localhost hadoop-2.9.1]$ hdfs namenode -format 18/10/22 13:40:46 INFO namenode.NameNode: STARTUP_MSG: /************************************************************ STARTUP_MSG: Starting NameNode STARTUP_MSG: host = localhost.localdomain/127.0.0.1 STARTUP_MSG: args = [-format] STARTUP_MSG: version = 2.9.1 STARTUP_MSG: classpath = *.jar STARTUP_MSG: build = https://github.com/apache/hadoop.git -r e30710aea4e6e55e69372929106cf119af06fd0e; compiled by 'root' on 2018-04-16T09:33Z STARTUP_MSG: java = 1.8.0_91 ************************************************************/ 18/10/22 13:40:46 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT] 18/10/22 13:40:46 INFO namenode.NameNode: createNameNode [-format] 18/10/22 13:40:46 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Formatting using clusterid: CID-85451f7e-c811-4028-8eee-62d3202c00bc 18/10/22 13:40:47 INFO namenode.FSEditLog: Edit logging is async:true 18/10/22 13:40:47 INFO namenode.FSNamesystem: KeyProvider: null 18/10/22 13:40:47 INFO namenode.FSNamesystem: fsLock is fair: true 18/10/22 13:40:47 INFO namenode.FSNamesystem: Detailed lock hold time metrics enabled: false 18/10/22 13:40:47 INFO namenode.FSNamesystem: fsOwner = hadoop (auth:SIMPLE) 18/10/22 13:40:47 INFO namenode.FSNamesystem: supergroup = supergroup 18/10/22 13:40:47 INFO namenode.FSNamesystem: isPermissionEnabled = true 18/10/22 13:40:47 INFO namenode.FSNamesystem: HA Enabled: false 18/10/22 13:40:47 INFO common.Util: dfs.datanode.fileio.profiling.sampling.percentage set to 0. Disabling file IO profiling 18/10/22 13:40:47 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit: configured=1000, counted=60, effected=1000 18/10/22 13:40:47 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true 18/10/22 13:40:47 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000 18/10/22 13:40:47 INFO blockmanagement.BlockManager: The block deletion will start around 2018 十月 22 13:40:47 18/10/22 13:40:47 INFO util.GSet: Computing capacity for map BlocksMap 18/10/22 13:40:47 INFO util.GSet: VM type = 64-bit 18/10/22 13:40:47 INFO util.GSet: 2.0% max memory 889 MB = 17.8 MB 18/10/22 13:40:47 INFO util.GSet: capacity = 2^21 = 2097152 entries 18/10/22 13:40:47 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false 18/10/22 13:40:47 WARN conf.Configuration: No unit for dfs.heartbeat.interval(3) assuming SECONDS 18/10/22 13:40:47 WARN conf.Configuration: No unit for dfs.namenode.safemode.extension(30000) assuming MILLISECONDS 18/10/22 13:40:47 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.threshold-pct = 0.9990000128746033 18/10/22 13:40:47 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.min.datanodes = 0 18/10/22 13:40:47 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.extension = 30000 18/10/22 13:40:47 INFO blockmanagement.BlockManager: defaultReplication = 1 18/10/22 13:40:47 INFO blockmanagement.BlockManager: maxReplication = 512 18/10/22 13:40:47 INFO blockmanagement.BlockManager: minReplication = 1 18/10/22 13:40:47 INFO blockmanagement.BlockManager: maxReplicationStreams = 2 18/10/22 13:40:47 INFO blockmanagement.BlockManager: replicationRecheckInterval = 3000 18/10/22 13:40:47 INFO blockmanagement.BlockManager: encryptDataTransfer = false 18/10/22 13:40:47 INFO blockmanagement.BlockManager: maxNumBlocksToLog = 1000 18/10/22 13:40:47 INFO namenode.FSNamesystem: Append Enabled: true 18/10/22 13:40:47 INFO util.GSet: Computing capacity for map INodeMap 18/10/22 13:40:47 INFO util.GSet: VM type = 64-bit 18/10/22 13:40:47 INFO util.GSet: 1.0% max memory 889 MB = 8.9 MB 18/10/22 13:40:47 INFO util.GSet: capacity = 2^20 = 1048576 entries 18/10/22 13:40:47 INFO namenode.FSDirectory: ACLs enabled? false 18/10/22 13:40:47 INFO namenode.FSDirectory: XAttrs enabled? true 18/10/22 13:40:47 INFO namenode.NameNode: Caching file names occurring more than 10 times 18/10/22 13:40:47 INFO snapshot.SnapshotManager: Loaded config captureOpenFiles: falseskipCaptureAccessTimeOnlyChange: false 18/10/22 13:40:47 INFO util.GSet: Computing capacity for map cachedBlocks 18/10/22 13:40:47 INFO util.GSet: VM type = 64-bit 18/10/22 13:40:47 INFO util.GSet: 0.25% max memory 889 MB = 2.2 MB 18/10/22 13:40:47 INFO util.GSet: capacity = 2^18 = 262144 entries 18/10/22 13:40:47 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 10 18/10/22 13:40:47 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10 18/10/22 13:40:47 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25 18/10/22 13:40:47 INFO namenode.FSNamesystem: Retry cache on namenode is enabled 18/10/22 13:40:47 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis 18/10/22 13:40:47 INFO util.GSet: Computing capacity for map NameNodeRetryCache 18/10/22 13:40:47 INFO util.GSet: VM type = 64-bit 18/10/22 13:40:47 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB 18/10/22 13:40:47 INFO util.GSet: capacity = 2^15 = 32768 entries 18/10/22 13:40:47 INFO namenode.FSImage: Allocated new BlockPoolId: BP-648750324-127.0.0.1-1540186847111 18/10/22 13:40:47 INFO common.Storage: Storage directory /home/hadoop/hadoop-2.9.1/tmp/dfs/name has been successfully formatted. 18/10/22 13:40:47 INFO namenode.FSImageFormatProtobuf: Saving image file /home/hadoop/hadoop-2.9.1/tmp/dfs/name/current/fsimage.ckpt_0000000000000000000 using no compression 18/10/22 13:40:47 INFO namenode.FSImageFormatProtobuf: Image file /home/hadoop/hadoop-2.9.1/tmp/dfs/name/current/fsimage.ckpt_0000000000000000000 of size 323 bytes saved in 0 seconds . 18/10/22 13:40:47 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0 18/10/22 13:40:47 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************ SHUTDOWN_MSG: Shutting down NameNode at localhost.localdomain/127.0.0.1 ************************************************************/ [hadoop@localhost hadoop-2.9.1]$
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[hadoop@localhost hadoop-2.9.1]$ tree tmp/ tmp/ └── dfs └── name └── current ├── fsimage_0000000000000000000 ├── fsimage_0000000000000000000.md5 ├── seen_txid └── VERSION
Generic options supported are: -conf <configuration file> specify an application configuration file -D <property=value> define a value for a given property -fs <file:///|hdfs://namenode:port> specify default filesystem URL to use, overrides 'fs.defaultFS' property from configurations. -jt <local|resourcemanager:port> specify a ResourceManager -files <file1,...> specify a comma-separated list of files to be copied to the map reduce cluster -libjars <jar1,...> specify a comma-separated list of jar files to be included in the classpath -archives <archive1,...> specify a comma-separated list of archives to be unarchived on the compute machines
The general command line syntax is: command [genericOptions] [commandOptions]
# 默认没有mapred-site.xml文件,但是有个mapred-site.xml.template配置模板文件。复制模板生成mapred-site.xml。 [hadoop@localhost hadoop]$ cp mapred-site.xml.template mapred-site.xml [hadoop@localhost hadoop]$ vi mapred-site.xml [hadoop@localhost hadoop]$ cat mapred-site.xml <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. See accompanying LICENSE file. -->
<!-- Put site-specific property overrides in this file. -->