pass a command line argument to jvm(java) mapper task

为君一笑 提交于 2019-12-08 06:24:36

问题


I want to debug some parts of my mapper for which I need to pass some command line arguments to the jvm(java) process which starts the mapper. What are the different ways to do this?

I figured out one way to change MapTaskRunner.java, but I want to avoid compiling the whole hadoop package. There should be some simple way using a configuration file to pass extra command line arguments to the jvm mapper process.


回答1:


I guess you are looking for the following configuration in mapred-config.xml:

<property>
    <name>mapred.child.java.opts</name>
    <value>-Xmx4096m -XX:+UseConcMarkSweepGC</value>
</property>

In value part you may set your arguments using -D.

Alternatively you may set the HADOOP_OPTS in your terminal:

export HADOOP_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5000"

For more info on local debugging hadoop jobs, see here.



来源:https://stackoverflow.com/questions/15286333/pass-a-command-line-argument-to-jvmjava-mapper-task

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!