Return-Path: X-Original-To: apmail-hadoop-common-user-archive@www.apache.org Delivered-To: apmail-hadoop-common-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E67F378C6 for ; Thu, 22 Sep 2011 22:17:58 +0000 (UTC) Received: (qmail 57348 invoked by uid 500); 22 Sep 2011 22:17:56 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 57290 invoked by uid 500); 22 Sep 2011 22:17:55 -0000 Mailing-List: contact common-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-user@hadoop.apache.org Delivered-To: mailing list common-user@hadoop.apache.org Received: (qmail 57282 invoked by uid 99); 22 Sep 2011 22:17:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Sep 2011 22:17:55 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL,TO_NO_BRKTS_PCNT X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.213.176] (HELO mail-yx0-f176.google.com) (209.85.213.176) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Sep 2011 22:17:49 +0000 Received: by yxn22 with SMTP id 22so3358178yxn.35 for ; Thu, 22 Sep 2011 15:17:27 -0700 (PDT) Received: by 10.150.240.3 with SMTP id n3mr2735102ybh.126.1316729847749; Thu, 22 Sep 2011 15:17:27 -0700 (PDT) Received: from [192.168.1.105] (c-71-202-190-17.hsd1.ca.comcast.net. [71.202.190.17]) by mx.google.com with ESMTPS id l12sm9835579ang.6.2011.09.22.15.17.26 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Sep 2011 15:17:27 -0700 (PDT) Subject: Re: formatting hdfs without user interaction Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=us-ascii From: Arpit Gupta In-Reply-To: Date: Thu, 22 Sep 2011 15:17:24 -0700 Cc: Content-Transfer-Encoding: quoted-printable Message-Id: <13303987-5F3A-4E63-BE5A-92026EE287E3@hortonworks.com> References: To: common-user@hadoop.apache.org X-Mailer: Apple Mail (2.1244.3) X-Virus-Checked: Checked by ClamAV on apache.org The reason you are getting multiple prompts is that you have multiple = dir's defined in the dfs.name.dir. A simple expect script would take care of this. #!/usr/bin/expect -f spawn /bin/hadoop namenode -format expect "Re-format filesystem in"=20 send Y\n=20 expect "Re-format filesystem in"=20 send Y\n=20 interact You might have to put the above in a loop based on how many dirs are = defined in the dfs.name.dir -- Arpit arpit@hortonworks.com On Sep 22, 2011, at 2:59 PM, wrote: > Hi Raj and Arpit, >=20 > I think the fact that there are 2 confirmations is causing it not to = work: >=20 > echo "Y" | hadoop namenode -format > 11/09/22 14:57:10 INFO namenode.NameNode: STARTUP_MSG: > /************************************************************ > STARTUP_MSG: Starting NameNode > STARTUP_MSG: host =3D hdm1/172.28.9.250 > STARTUP_MSG: args =3D [-format] > STARTUP_MSG: version =3D 0.20.204.0 > STARTUP_MSG: build =3D git://hrt8n35.cc1.ygridcore.net/ on branch > branch-0.20-security-204 -r 65e258bf0813ac2b15bb4c954660eaf9e8fba141; > compiled by 'hortonow' on Thu Aug 25 23:25:52 UTC 2011 > ************************************************************/ > Re-format filesystem in /data/local/hdfs/name ? (Y or N) Re-format > filesystem in /data/remote/hdfs/name ? (Y or N) Format aborted in > /data/remote/hdfs/name > 11/09/22 14:57:10 INFO namenode.NameNode: SHUTDOWN_MSG: > /************************************************************ > SHUTDOWN_MSG: Shutting down NameNode at hdm1/172.28.9.250 > ************************************************************/ > Heap > par new generation total 2831168K, used 150996K [0x00002aaaae210000, > 0x00002aab6e210000, 0x00002aab6e210000) > eden space 2516608K, 6% used [0x00002aaaae210000, = 0x00002aaab75852d0, > 0x00002aab47bb0000) > from space 314560K, 0% used [0x00002aab47bb0000, = 0x00002aab47bb0000, > 0x00002aab5aee0000) > to space 314560K, 0% used [0x00002aab5aee0000, = 0x00002aab5aee0000, > 0x00002aab6e210000) > concurrent mark-sweep generation total 30408704K, used 0K > [0x00002aab6e210000, 0x00002ab2ae210000, 0x00002ab2ae210000) > concurrent-mark-sweep perm gen total 21248K, used 7333K > [0x00002ab2ae210000, 0x00002ab2af6d0000, 0x00002ab2b3610000) >=20 >=20 > Cheers, > Ivan >=20 > On 9/22/11 2:52 PM, "Raj V" wrote: >=20 >> Ian >> "echo 'Y' | hadoop namenode -format" >>=20 >> should work., >>=20 >> Raj >>=20 >>=20 >>> ________________________________ >>> From: "Ivan.Novick@emc.com" >>> To: common-user@hadoop.apache.org >>> Sent: Thursday, September 22, 2011 2:43 PM >>> Subject: formatting hdfs without user interaction >>>=20 >>> Hello, >>>=20 >>> I am trying to automate formatting an HDFS volume. Is there any way = to >>> do this without the interaction (and using expect)? >>>=20 >>> Cheers, >>> Ivan >>>=20 >>>=20 >=20