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 988C4110C6 for ; Mon, 8 Sep 2014 21:40:39 +0000 (UTC) Received: (qmail 10708 invoked by uid 500); 8 Sep 2014 21:40:30 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 10602 invoked by uid 500); 8 Sep 2014 21:40:30 -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 10592 invoked by uid 99); 8 Sep 2014 21:40:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Sep 2014 21:40:29 +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 bhooshan.mogal@gmail.com designates 209.85.223.171 as permitted sender) Received: from [209.85.223.171] (HELO mail-ie0-f171.google.com) (209.85.223.171) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Sep 2014 21:40:24 +0000 Received: by mail-ie0-f171.google.com with SMTP id rp18so18675596iec.2 for ; Mon, 08 Sep 2014 14:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ycn4tAYEoqA6G4XsIgKRvYPY+kS1DlCSJqE7mYBBc58=; b=HkQiZvcP93Q+44jCwaojQ2dP/eigVjxhOwIM93ahh+JctG8gD0wU8QAg+13mMkwwlB 6OoS65Ckm91qjz2Ww7E4+ej82qyFy28CVbH+C+ZKkeAdC6yjb38bUlHaPmhsevCtlSa4 mUQb8vuINxf60hNGrIbSEVIH8OddPwxDUFP9xoP03LVESFwJZmL91dJodxxT4ZNl8L8q rJJ0u8f5Ob0qqqGUxNZO3jFUDArHKdRQCP67DF04bx2uePQllhD+NbE8KR/yANAvYwYv EqxmFLlYpnAKASFavJ2ZjNlOL8aRrXF+yzTv5UDQ9mQdQ2HlM5cjYBHenrchnSpaTReH zVkw== MIME-Version: 1.0 X-Received: by 10.50.25.65 with SMTP id a1mr26672953igg.3.1410212403699; Mon, 08 Sep 2014 14:40:03 -0700 (PDT) Received: by 10.50.62.11 with HTTP; Mon, 8 Sep 2014 14:40:03 -0700 (PDT) In-Reply-To: References: Date: Mon, 8 Sep 2014 14:40:03 -0700 Message-ID: Subject: Re: conf.get("dfs.data.dir") return null when hdfs-site.xml doesn't set it explicitly From: Bhooshan Mogal To: "user@hadoop.apache.org" Content-Type: multipart/alternative; boundary=047d7bd757d06166e4050294a979 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bd757d06166e4050294a979 Content-Type: text/plain; charset=UTF-8 Hi Demai, When you read a property from the conf object, it will only have a value if the conf object contains that property. In your case, you created the conf object as new Configuration() -- adds core-default and core-site.xml. Then you added site.xmls (hdfs-site.xml and core-site.xml) from specific locations. If none of these files have defined dfs.data.dir, then you will get NULL. This is expected behavior. What do you mean by retrieving the info from a live cluster? Even for processes like datanode, namenode etc, the source of truth for these properties is hdfs-site.xml. It is loaded from a specific location when you start these services. Question: Where are you running the above code? Is it on a node which has other hadoop daemons as well? My guess is that the path you are referring to (/etc/hadoop/conf. cloudera.hdfs/core-site.xml) is not the right path where these config properties are defined. Since this is a CDH cluster, you would probably be best served by asking on the CDH mailing list as to where the right path to these files is. HTH, Bhooshan On Mon, Sep 8, 2014 at 11:47 AM, Demai Ni wrote: > hi, experts, > > I am trying to get the local filesystem directory of data node. My cluster > is using CDH5.x (hadoop 2.3) and the default configuration. So the datanode > is under file:///dfs/dn. I didn't specify the value in hdfs-site.xml. > > My code is something like: > > conf = new Configuration() > > // test both with and without the following two lines > conf.addResource (new > Path("/etc/hadoop/conf.cloudera.hdfs/hdfs-site.xml")); > conf.addResource (new > Path("/etc/hadoop/conf.cloudera.hdfs/core-site.xml")); > > // I also tried get("dfs.datanode.data.dir"), which also return NULL > String dnDir = conf.get("dfs.data.dir"); // return NULL > > It looks like the get only look at the configuration file instead of > retrieving the info from the live cluster? > > Many thanks for your help in advance. > > Demai > -- Bhooshan --047d7bd757d06166e4050294a979 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Demai,

When you read a property from= the conf object, it will only have a value if the conf object contains tha= t property.

In your case, you created the conf obj= ect as new Configuration() -- adds core-default and core-site.xml.

Then you added site.xmls (hdfs-site.xml and core-site.xml)= from specific locations. If none of these files have defined dfs.data.dir,= then you will get NULL. This is expected behavior.=C2=A0

What do you mean by retrieving the info from a live cluster? Even f= or processes like datanode, namenode etc, the source of truth for these pro= perties is hdfs-site.xml. It is loaded from a specific location when you st= art these services.

Question: Where are you runnin= g the above code? Is it on a node which has other hadoop daemons as well?

My guess is that the path you are referring to (/et= c/hadoop/conf.cloudera.hdfs/core-site.xml) is not the right p= ath where these config properties are defined. Since this is a CDH cluster,= you would probably be best served by asking on the CDH mailing list as to = where the right path to these files is.


=
HTH,
Bhooshan


=
On Mon, Sep 8, 2014 at 11:47 AM, Demai Ni <nidmg= g@gmail.com> wrote:
hi, experts,

I am= trying to get the local filesystem directory of data node. My cluster is u= sing CDH5.x (hadoop 2.3) and the default configuration. So the datanode is = under file:///dfs/dn. I didn't specify the value in hdfs-site.xml.
=
My code is something like:

conf =3D new Configuration()

// test both with and without the fo= llowing two lines
conf.addResource (new Path("/etc/hadoop/conf.cloudera.hdfs/hd= fs-site.xml"));
conf.addResource (new Path("/etc/hadoop/conf.= cloudera.hdfs/core-site.xml"));

// I also tried get("dfs.datano= de.data.dir"), which also return NULL
String dnDir =3D conf.get("dfs.data.= dir");=C2=A0 // return NULL

It looks like the get = only look at the configuration file instead of retrieving the info from the= live cluster?

Many thanks for your help in advance.

Demai



--
Bhooshan
--047d7bd757d06166e4050294a979--