Return-Path: X-Original-To: apmail-hadoop-general-archive@minotaur.apache.org Delivered-To: apmail-hadoop-general-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B89A6E93 for ; Wed, 27 Jul 2011 07:03:39 +0000 (UTC) Received: (qmail 83076 invoked by uid 500); 27 Jul 2011 07:03:37 -0000 Delivered-To: apmail-hadoop-general-archive@hadoop.apache.org Received: (qmail 82739 invoked by uid 500); 27 Jul 2011 07:03:32 -0000 Mailing-List: contact general-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@hadoop.apache.org Delivered-To: mailing list general@hadoop.apache.org Received: (qmail 82687 invoked by uid 99); 27 Jul 2011 07:03:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2011 07:03:28 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of hadoop.li@gmail.com designates 74.125.83.48 as permitted sender) Received: from [74.125.83.48] (HELO mail-gw0-f48.google.com) (74.125.83.48) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2011 07:03:21 +0000 Received: by gwj22 with SMTP id 22so1231349gwj.35 for ; Wed, 27 Jul 2011 00:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=lgSwSobyvsGcuTFVcy/C0aktj4HM/g7FRtwwkl+KAC8=; b=hekSn60mB+XJsAruFMX7mwHJaMI4FEckq77qmW5N78tuKv7gsKOvwXMqcjGqpiYi/c HgVmgD3KksyFZMX3/ZE3mikrDne7A+OR6NjVr4OPmBY43hXsAzetKZzyLftcsrUNB51g 1p1BKxYywYPu8i+PSJSsjccDrd+u6TlEZWwLk= MIME-Version: 1.0 Received: by 10.42.161.202 with SMTP id u10mr248480icx.40.1311750180460; Wed, 27 Jul 2011 00:03:00 -0700 (PDT) Received: by 10.42.226.134 with HTTP; Wed, 27 Jul 2011 00:03:00 -0700 (PDT) Date: Wed, 27 Jul 2011 15:03:00 +0800 Message-ID: Subject: About the DistributedCache From: Weiwei Li To: general@hadoop.apache.org Content-Type: multipart/alternative; boundary=90e6ba6e879e8a580b04a907a3ae X-Virus-Checked: Checked by ClamAV on apache.org --90e6ba6e879e8a580b04a907a3ae Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable Hi, I have met some problem about the DistributedCache. There is a document called 'model.txt', I want every mapper can read it because there are some public data in it. So, I use the DistributedCache. 1.In the main() DistributedCache.createSymlink(conf); String path =3D "/user/Li/model/model.txt"; Path filePath =3D new Path(path); String uriWithLink =3D filePath.toUri().toString() + "#" + "model.txt"; System.out.println(uriWithLink); DistributedCache.addCacheFile(new URI(uriWithLink), conf); 2.In the Mapper() protected void setup(Context context) throws IOException,InterruptedException { System.out.println("Now, use the distributed cache and syslink"); try { FileReader reader =3D new FileReader("model.txt"); BufferedReader br =3D new BufferedReader(reader); String s1 =3D null; while= ((s1 =3D br.readLine()) !=3D null) { System.out.println(s1); } br.close(); reader.close(); } catch (Exception e) { e.printStackTrace(); } } 3.When run it, in the Task logs. java.io.FileNotFoundException: model.txt (=BE=DC=BE=F8=B7=C3=CE=CA=A1=A3) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:120) at java.io.FileInputStream.(FileInputStream.java:79) at java.io.FileReader.(FileReader.java:41) at NB.NBClusterTrain.UseDistributedCacheBySymbolicLink(NBClusterTrain.java:24) at NB.NBClusterTrain$NBClusterTrainMapper.setup(NBClusterTrain.java:45) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:142) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:621) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:305) at org.apache.hadoop.mapred.Child.main(Child.java:170) 4.When I use /bin/hadoop fs -cat /user/Li/model/model.txt, This can be read= . What do you think can I do? Thank you! --90e6ba6e879e8a580b04a907a3ae--