跑第一个hadoop自带示例遇到的错误

装完hadoop跑一个算圆周率pi值的示例的时候,先在hadoop的安装位置找到那个传说中的

hadoop-examples-xxxx.jar,xxxx因版本而异

由于安装的hadoop是2.7.0,位置在xxx/share/hadoop/mapreduce/里,xxx为hadoop安装根目录,这个东西也因为和书上的版本不同位置不太一样要自己找。

开四个job算圆周率

hadoop jar hadoop-mapreduce-examples-2.7.0.jar pi 4 1000

得到下面的错误:

java.io.IOException: Cannot create input directory QuasiMonteCarlo_1442130301493_820011182/in
	at org.apache.hadoop.examples.QuasiMonteCarlo.estimatePi(QuasiMonteCarlo.java:283)
	at org.apache.hadoop.examples.QuasiMonteCarlo.run(QuasiMonteCarlo.java:354)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
	at org.apache.hadoop.examples.QuasiMonteCarlo.main(QuasiMonteCarlo.java:363)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:71)
	at org.apache.hadoop.util.ProgramDriver.run(ProgramDriver.java:144)
	at org.apache.hadoop.examples.ExampleDriver.main(ExampleDriver.java:74)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
	at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

他说无法创建一个啥临时文件,猜测就是权限问题,修改了mapreduce目录的权限使其可写,在跑就可以了。

Number of Maps  = 4
Samples per Map = 1000
Wrote input for Map #0
Wrote input for Map #1
Wrote input for Map #2
Wrote input for Map #3
Starting Job
15/09/13 15:46:12 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
15/09/13 15:46:12 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
15/09/13 15:46:12 INFO input.FileInputFormat: Total input paths to process : 4
15/09/13 15:46:12 INFO mapreduce.JobSubmitter: number of splits:4
15/09/13 15:46:13 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local1667226124_0001
15/09/13 15:46:13 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
15/09/13 15:46:13 INFO mapreduce.Job: Running job: job_local1667226124_0001
15/09/13 15:46:13 INFO mapred.LocalJobRunner: OutputCommitter set in config null
15/09/13 15:46:13 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
15/09/13 15:46:13 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
15/09/13 15:46:13 INFO mapred.LocalJobRunner: Waiting for map tasks
15/09/13 15:46:13 INFO mapred.LocalJobRunner: Starting task: attempt_local1667226124_0001_m_000000_0
…………
…………
15/09/13 15:46:14 INFO mapred.LocalJobRunner: Finishing task: attempt_local1667226124_0001_r_000000_0
15/09/13 15:46:14 INFO mapred.LocalJobRunner: reduce task executor complete.
15/09/13 15:46:14 INFO mapreduce.Job: Job job_local1667226124_0001 running in uber mode : false
15/09/13 15:46:14 INFO mapreduce.Job:  map 100% reduce 100%
15/09/13 15:46:14 INFO mapreduce.Job: Job job_local1667226124_0001 completed successfully
15/09/13 15:46:14 INFO mapreduce.Job: Counters: 30
	File System Counters
		FILE: Number of bytes read=1379291
		FILE: Number of bytes written=2739253
		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=8
		Map output bytes=72
		Map output materialized bytes=112
		Input split bytes=660
		Combine input records=0
		Combine output records=0
		Reduce input groups=2
		Reduce shuffle bytes=112
		Reduce input records=8
		Reduce output records=0
		Spilled Records=16
		Shuffled Maps =4
		Failed Shuffles=0
		Merged Map outputs=4
		GC time elapsed (ms)=154
		Total committed heap usage (bytes)=1356857344
	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=520
	File Output Format Counters 
		Bytes Written=109
Job Finished in 2.592 seconds
Estimated value of Pi is 3.14000000000000000000

 

 

 

 

 

你可能感兴趣的:(hadoop,linux)