1. 程式人生 > >Hadoop Map/Reduce記憶體限制

Hadoop Map/Reduce記憶體限制

如何設定hadoop  Map/Reduce任務的記憶體限制?

Parameter

Type

Meaning

mapred.cluster.map.memory.mb set by admin, cluster-wide Cluster definition of memory per map slot. The maximum amount of memory, in MB, each map task on a tasktracker can consume. mapred.cluster.reduce.memory.mb set by admin, cluster-wide Cluster definition of memory per reduce slot. The maximum amount of memory, in MB, each reduce task on a tasktracker can consume. mapred.job.map.memory.mb set by user, per-job Job requirement for map tasks. The maximum amount of memory each map task of a job can consume, in MB. mapred.job.reduce.memory.mb set by user, per-job job requirement for reduce tasks. The maximum amount of memory each reduce task of a job can consume, in MB. mapred.cluster.max.map.memory.mb set by admin, cluster-wide Max limit on jobs. The maximum value that can be specified by a user via mapred.job.map.memory.mb, in MB. A job that asks for more than this number will be failed at submission itself. mapred.cluster.max.reduce.memory.mb set by admin, cluster-wide Max limit on jobs. The maximum value that can be specified by a user via mapred.job.reduce.memory.mb, in MB. A job that asks for more than this number will be failed at submission itself.

不設定時預設都是-1,無限制

設定時請注意其大小關係。比如你設定了mapred.cluster.map.memory.mb為1024 ,然後你提交任務時沒有設定mapred.job.map.memory.mb(預設為-1,無限制),此時便會報如下錯誤:

2012-06-13 16:18:10,951 ERROR exec.Task (SessionState.java:printError(380)) - Job Submission failed with exception 'org.apache.hadoop.ipc.RemoteException(java.io.IOException: job_201206131602_0003(-1 memForMapTasks -1 memForReduceTasks): Invalid job requirements.
        at org.apache.hadoop.mapred.JobTracker.checkMemoryRequirements(JobTracker.java:5160)
        at org.apache.hadoop.mapred.JobTracker.submitJob(JobTracker.java:3949)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:523)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1383)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1379)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:396)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1059)
        at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1377)
)'
org.apache.hadoop.ipc.RemoteException: java.io.IOException: job_201206131602_0003(-1 memForMapTasks -1 memForReduceTasks): Invalid job requirements.
        at org.apache.hadoop.mapred.JobTracker.checkMemoryRequirements(JobTracker.java:5160)
        at org.apache.hadoop.mapred.JobTracker.submitJob(JobTracker.java:3949)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:523)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1383)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1379)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:396)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1059)
        at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1377)

        at org.apache.hadoop.ipc.Client.call(Client.java:1030)
        at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:224)
        at org.apache.hadoop.mapred.$Proxy7.submitJob(Unknown Source)
        at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:862)
        at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:791)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:396)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1059)
        at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:791)
        at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:765)
        at org.apache.hadoop.hive.ql.exec.ExecDriver.execute(ExecDriver.java:452)
        at org.apache.hadoop.hive.ql.exec.MapRedTask.execute(MapRedTask.java:136)
        at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:133)
        at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:57)
        at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1332)
        at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1123)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:931)
        at org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.execute(HiveServer.java:191)
        at org.apache.hadoop.hive.service.ThriftHive$Processor$execute.getResult(ThriftHive.java:629)
        at org.apache.hadoop.hive.service.ThriftHive$Processor$execute.getResult(ThriftHive.java:617)
        at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:176)