Return-Path: X-Original-To: apmail-hadoop-yarn-dev-archive@minotaur.apache.org Delivered-To: apmail-hadoop-yarn-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 46F2A11A4E for ; Wed, 25 Jun 2014 10:17:28 +0000 (UTC) Received: (qmail 36190 invoked by uid 500); 25 Jun 2014 10:17:27 -0000 Delivered-To: apmail-hadoop-yarn-dev-archive@hadoop.apache.org Received: (qmail 36123 invoked by uid 500); 25 Jun 2014 10:17:27 -0000 Mailing-List: contact yarn-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: yarn-dev@hadoop.apache.org Delivered-To: mailing list yarn-dev@hadoop.apache.org Received: (qmail 36112 invoked by uid 99); 25 Jun 2014 10:17:27 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2014 10:17:27 +0000 Received: from localhost (HELO mail-ve0-f176.google.com) (127.0.0.1) (smtp-auth username vinayakumarb, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2014 10:17:26 +0000 Received: by mail-ve0-f176.google.com with SMTP id db12so1722731veb.35 for ; Wed, 25 Jun 2014 03:17:25 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.52.92.82 with SMTP id ck18mr5122622vdb.6.1403691445790; Wed, 25 Jun 2014 03:17:25 -0700 (PDT) Received: by 10.58.246.6 with HTTP; Wed, 25 Jun 2014 03:17:25 -0700 (PDT) In-Reply-To: <296B66BA-06C7-41E1-B9BE-012DD5E7E03A@gmail.com> References: <621E2E20-6541-4666-A576-F010A34AE7F1@gmail.com> <1B85C287-B890-4A36-84F0-447D51FE73F6@gmail.com> <296B66BA-06C7-41E1-B9BE-012DD5E7E03A@gmail.com> Date: Wed, 25 Jun 2014 15:47:25 +0530 Message-ID: Subject: Re: How do I use java api to read data from secured hadoop cluster? From: Vinayakumar B To: yarn-dev@hadoop.apache.org Content-Type: multipart/alternative; boundary=bcaec501674d00308f04fca6624b --bcaec501674d00308f04fca6624b Content-Type: text/plain; charset=UTF-8 If kinit done in the machine and user, where your client program is running, then no other changes required to your program. BTW in your client configurations also need to have the authentication method configured. Regards, Vinay On Wed, Jun 25, 2014 at 5:20 AM, Liu, David wrote: > By the way, I have kinit hadoop on the cluster, and "hadoop fs -ls /" > works on the cluster. The code below is run on the cluster too. > On Jun 25, 2014, at 6:22 AM, "Liu, David" wrote: > > > I mean to read data from secured hdfs. > > > > > > On Jun 25, 2014, at 6:14 AM, "Liu, David" wrote: > > > >> Hi experts, > >> > >> Can anyone provide some example or api name to read data from secured > hadoop cluster? > >> I have code like this which can read data from unsecured cluster, but > when it comes to secured one, authentication error will show. > >>> Configuration conf = new Configuration(); > >>> FileSystem fs = FileSystem.get(URI.create(uri), conf); > >>> FSDataInputStream in = fs.open(new Path(uri)); > >>> IOUtils.copy(in, System.out, 4096); > >>> > >>> Could anyone help me? Really Appreicate it. > >>> > >>> Thanks > >> > > > > -- Regards, Vinay --bcaec501674d00308f04fca6624b--