Return-Path: X-Original-To: apmail-hadoop-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B0B581085D for ; Fri, 16 Jan 2015 19:05:13 +0000 (UTC) Received: (qmail 8703 invoked by uid 500); 16 Jan 2015 19:05:10 -0000 Delivered-To: apmail-hadoop-user-archive@hadoop.apache.org Received: (qmail 8603 invoked by uid 500); 16 Jan 2015 19:05:10 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 8593 invoked by uid 99); 16 Jan 2015 19:05:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jan 2015 19:05:09 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of cnauroth@hortonworks.com designates 209.85.216.46 as permitted sender) Received: from [209.85.216.46] (HELO mail-qa0-f46.google.com) (209.85.216.46) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jan 2015 19:05:05 +0000 Received: by mail-qa0-f46.google.com with SMTP id j7so16670040qaq.5 for ; Fri, 16 Jan 2015 11:03:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=RWGIshrRvhoy/vLASXpP1SP3XE8isXa9/snU3xZYZSM=; b=U7nYTlI5yz10sISwFAlobdjaC/HwzmqwCGi6XD7ELtKwww/MltbmHK95LUDbzWifja eElme5pC8GnKbF8Ab0VtWxdKVpIHlvWtB5fyEl7z8SHL9uorSD+AfZI5Cv23HxGjUaHK siTUmS79YAOptCyQ7dlHNh/fxp9Bh/TNkiwcrKo/a7vHBMg3NrfH5CpayGOAJafpGEjD urvk+y8C1T2pJV7T5liLzt8UzQCbzrwdKdqGNGKxg8Bl6PpF86M1qPmeKiXZJNgHVVoT oVOmvEIZH0+cZ1li39hhi7f6imIn8XA8hkM/N84YdAIwaisiP9kZsHh6i0Tda9+Zetj6 fy7Q== X-Gm-Message-State: ALoCoQnp5HZ7L8EPQFf9IbR5CxKngaob8nLOiHf8CtPpHw6lwGltBXJYP7r0BojJ6ZcCf1339lc3+LryN6AP8Rrqk2Bcgxgv8WxARy2TiD6JcXAU0eES9CE= MIME-Version: 1.0 X-Received: by 10.140.101.105 with SMTP id t96mr26781393qge.9.1421435039370; Fri, 16 Jan 2015 11:03:59 -0800 (PST) Received: by 10.96.66.67 with HTTP; Fri, 16 Jan 2015 11:03:59 -0800 (PST) In-Reply-To: References: Date: Fri, 16 Jan 2015 11:03:59 -0800 Message-ID: Subject: Re: simple hadoop MR program to be executed using java From: Chris Nauroth To: user@hadoop.apache.org Cc: "users@hadoop.apache.org" Content-Type: multipart/alternative; boundary=001a11c1678297eef2050cc9a2e4 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c1678297eef2050cc9a2e4 Content-Type: text/plain; charset=UTF-8 Hello Rab, There is actually quite a lot of logic in the "hadoop jar" shell scripts to set up the classpath (including Hadoop configuration file locations) and set up extra arguments (like heap sizes and log file locations). It is possible to replicate it with a straight java call, but it might not be worth the effort, and end users of your jar would lose functionality implemented in the shell scripts, such as configuration file location overrides. If you still want to pursue this, then you might want to make a small change to the "hadoop jar" script and add a line right before the java call to echo the command it's running. That will give you a sense for the java command that ultimately gets run. You could also take a look at the process table for a running "hadoop jar" process and inspect its command line and environment variables. Another potentially helpful tool is the "hadoop classpath" command: http://hadoop.apache.org/docs/r2.6.0/hadoop-project-dist/hadoop-common/CommandsManual.html#classpath This uses the full logic of the shell scripts for classpath construction, but then just echoes it instead of using it to run a jar. Chris Nauroth Hortonworks http://hortonworks.com/ On Fri, Jan 16, 2015 at 10:15 AM, rab ra wrote: > Hello, > > I have a simple java program that sets up a MR job. I could successfully > execute this in Hadoop infrastructure (hadoop 2x) using 'hadoop jar > '. But I want to achieve the same thing using java command as below. > > java > > 1. How can I pass hadoop configuration to this className? > 2. What extra arguments do I need to supply? > 3. Any link/documentation would be highly appreciated. > > > regards > rab > > > -- CONFIDENTIALITY NOTICE NOTICE: This message is intended for the use of the individual or entity to which it is addressed and may contain information that is confidential, privileged and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any printing, copying, dissemination, distribution, disclosure or forwarding of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately and delete it from your system. Thank You. --001a11c1678297eef2050cc9a2e4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello Rab,

There is actually quite a lo= t of logic in the "hadoop jar" shell scripts to set up the classp= ath (including Hadoop configuration file locations) and set up extra argume= nts (like heap sizes and log file locations).=C2=A0 It is possible to repli= cate it with a straight java call, but it might not be worth the effort, an= d end users of your jar would lose functionality implemented in the shell s= cripts, such as configuration file location overrides.

=
If you still want to pursue this, then you might want to make a small = change to the "hadoop jar" script and add a line right before the= java call to echo the command it's running.=C2=A0 That will give you a= sense for the java command that ultimately gets run.=C2=A0 You could also = take a look at the process table for a running "hadoop jar" proce= ss and inspect its command line and environment variables.

Another potentially helpful tool =C2=A0is the "hadoop classpa= th" command:


This uses = the full logic of the shell scripts for classpath construction, but then ju= st echoes it instead of using it to run a jar.

Chris Nauroth
Hortonworks


On Fri, Jan 16, 2015 at 10:15 AM, rab ra <ra= bmdu@gmail.com> wrote:
Hello,

I have a simple java program that se= ts up a MR job. I could successfully execute this in Hadoop infrastructure = (hadoop 2x) using 'hadoop jar <myjar>'. But I want to achieve= the same thing using java command as below.

java = <className>

1. How can I pass hadoop configu= ration to this className?
2. What extra arguments do I need to su= pply?
3. Any link/documentation would be highly appreciated.


regards
rab




CONFIDENTIALITY NOTICE
NOTICE: This message is = intended for the use of the individual or entity to which it is addressed a= nd may contain information that is confidential, privileged and exempt from= disclosure under applicable law. If the reader of this message is not the = intended recipient, you are hereby notified that any printing, copying, dis= semination, distribution, disclosure or forwarding of this communication is= strictly prohibited. If you have received this communication in error, ple= ase contact the sender immediately and delete it from your system. Thank Yo= u. --001a11c1678297eef2050cc9a2e4--