測試HBase數據遷移時出現MR OOM問題,在這裏記錄一下解決方法,以防忘記
異常信息
./hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot click-count-snp -copy-to hdfs://172.16.201.42:8020/hbase -mappers 10 -bandwidth 20
2019-07-09 16:01:29,407 INFO [main] snapshot.ExportSnapshot: Copy Snapshot Manifest
2019-07-09 16:01:29,722 WARN [main] mapreduce.TableMapReduceUtil: The hbase-prefix-tree module jar containing PrefixTreeCodec is not present. Continuing without it.
2019-07-09 16:01:30,793 INFO [main] snapshot.ExportSnapshot: Loading Snapshot 'click-count-snp' hfile list
2019-07-09 16:01:31,066 INFO [main] mapreduce.JobSubmitter: number of splits:1
2019-07-09 16:01:31,173 INFO [main] mapreduce.JobSubmitter: Submitting tokens for job: job_1562659148784_0003
2019-07-09 16:01:31,588 INFO [main] impl.YarnClientImpl: Submitted application application_1562659148784_0003
2019-07-09 16:01:31,615 INFO [main] mapreduce.Job: The url to track the job: http://nn1:8088/proxy/application_1562659148784_0003/
2019-07-09 16:01:31,616 INFO [main] mapreduce.Job: Running job: job_1562659148784_0003
2019-07-09 16:01:37,758 INFO [main] mapreduce.Job: Job job_1562659148784_0003 running in uber mode : false
2019-07-09 16:01:37,759 INFO [main] mapreduce.Job: map 0% reduce 0%
2019-07-09 16:01:41,811 INFO [main] mapreduce.Job: Task Id : attempt_1562659148784_0003_m_000000_0, Status : FAILED
Error: Java heap space
2019-07-09 16:01:45,851 INFO [main] mapreduce.Job: Task Id : attempt_1562659148784_0003_m_000000_1, Status : FAILED
Error: Java heap space
2019-07-09 16:01:49,872 INFO [main] mapreduce.Job: Task Id : attempt_1562659148784_0003_m_000000_2, Status : FAILED
Error: Java heap space
2019-07-09 16:01:54,895 INFO [main] mapreduce.Job: map 100% reduce 0%
2019-07-09 16:01:54,903 INFO [main] mapreduce.Job: Job job_1562659148784_0003 failed with state FAILED due to: Task failed task_1562659148784_0003_m_000000
Job failed as tasks failed. failedMaps:1 failedReduces:0
2019-07-09 16:01:55,004 INFO [main] mapreduce.Job: Counters: 11
Job Counters
Failed map tasks=4
Launched map tasks=4
Other local map tasks=4
Total time spent by all maps in occupied slots (ms)=10358
Total time spent by all reduces in occupied slots (ms)=0
Total time spent by all map tasks (ms)=10358
Total vcore-seconds taken by all map tasks=10358
Total megabyte-seconds taken by all map tasks=10606592
Map-Reduce Framework
CPU time spent (ms)=0
Physical memory (bytes) snapshot=0
Virtual memory (bytes) snapshot=0
2019-07-09 16:01:55,007 ERROR [main] snapshot.ExportSnapshot: Snapshot export failed
org.apache.hadoop.hbase.snapshot.ExportSnapshotException: Copy Files Map-Reduce Job failed
at org.apache.hadoop.hbase.snapshot.ExportSnapshot.runCopyJob(ExportSnapshot.java:804)
at org.apache.hadoop.hbase.snapshot.ExportSnapshot.run(ExportSnapshot.java:997)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.hadoop.hbase.snapshot.ExportSnapshot.innerMain(ExportSnapshot.java:1071)
at org.apache.hadoop.hbase.snapshot.ExportSnapshot.main(ExportSnapshot.java:1075)
一直在報Java heap space,本來我是開發集羣,只有三臺機器,而且沒臺都有一些關鍵服務,所以只能從設置MR參數入手,最後加了如下參數後可以正確執行。-Dmapreduce.map.memory.mb=4096 -Dmapreduce.map.java.opts=-Xmx3686m
./hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot -Dmapreduce.map.memory.mb=4096 -Dmapreduce.map.java.opts=-Xmx3686m -snapshot click-count-snp -copy-to hdfs://172.16.201.42:8020/hbase -mappers 10 -bandwidth 20
2019-07-09 16:24:02,886 INFO [main] snapshot.ExportSnapshot: Copy Snapshot Manifest
2019-07-09 16:24:03,193 WARN [main] mapreduce.TableMapReduceUtil: The hbase-prefix-tree module jar containing PrefixTreeCodec is not present. Continuing without it.
2019-07-09 16:24:04,217 INFO [main] snapshot.ExportSnapshot: Loading Snapshot 'click-count-snp' hfile list
2019-07-09 16:24:04,475 INFO [main] mapreduce.JobSubmitter: number of splits:1
2019-07-09 16:24:04,603 INFO [main] mapreduce.JobSubmitter: Submitting tokens for job: job_1562659148784_0006
2019-07-09 16:24:05,024 INFO [main] impl.YarnClientImpl: Submitted application application_1562659148784_0006
2019-07-09 16:24:05,054 INFO [main] mapreduce.Job: The url to track the job: http://nn1:8088/proxy/application_1562659148784_0006/
2019-07-09 16:24:05,054 INFO [main] mapreduce.Job: Running job: job_1562659148784_0006
2019-07-09 16:24:11,179 INFO [main] mapreduce.Job: Job job_1562659148784_0006 running in uber mode : false
2019-07-09 16:24:11,180 INFO [main] mapreduce.Job: map 0% reduce 0%
2019-07-09 16:24:16,233 INFO [main] mapreduce.Job: map 100% reduce 0%
2019-07-09 16:24:16,241 INFO [main] mapreduce.Job: Job job_1562659148784_0006 completed successfully
2019-07-09 16:24:16,338 INFO [main] mapreduce.Job: Counters: 37
File System Counters
FILE: Number of bytes read=0
FILE: Number of bytes written=158069
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
HDFS: Number of bytes read=6998
HDFS: Number of bytes written=6797
HDFS: Number of read operations=5
HDFS: Number of large read operations=0
HDFS: Number of write operations=2
Job Counters
Launched map tasks=1
Other local map tasks=1
Total time spent by all maps in occupied slots (ms)=11704
Total time spent by all reduces in occupied slots (ms)=0
Total time spent by all map tasks (ms)=2926
Total vcore-seconds taken by all map tasks=2926
Total megabyte-seconds taken by all map tasks=11984896
Map-Reduce Framework
Map input records=1
Map output records=0
Input split bytes=201
Spilled Records=0
Failed Shuffles=0
Merged Map outputs=0
GC time elapsed (ms)=71
CPU time spent (ms)=740
Physical memory (bytes) snapshot=325951488
Virtual memory (bytes) snapshot=5925187584
Total committed heap usage (bytes)=300941312
org.apache.hadoop.hbase.snapshot.ExportSnapshot$Counter
BYTES_COPIED=6797
BYTES_EXPECTED=6797
BYTES_SKIPPED=0
COPY_FAILED=0
FILES_COPIED=1
FILES_SKIPPED=0
MISSING_FILES=0
File Input Format Counters
Bytes Read=0
File Output Format Counters
Bytes Written=0
2019-07-09 16:24:16,341 INFO [main] snapshot.ExportSnapshot: Finalize the Snapshot Export
2019-07-09 16:24:16,348 INFO [main] snapshot.ExportSnapshot: Verify snapshot integrity
2019-07-09 16:24:16,378 INFO [main] snapshot.ExportSnapshot: Export Completed: click-count-snp