0

远程机器 (example.host.com) 上安装了 Hadoop。Pig 也安装在该机器上。

如何从其他机器访问该机器上的 hdfs?

我不想从远程复制文件。我只想对那些以 avro 格式存储且具有架构的文件运行查询。

我在本地机器上安装了 Pig,并将以下几行添加到 pig.properties 文件中

fs.default.name=hdfs://example.host.com:8020
mapred.job.tracker=example.host.com:8021

但是当我开始 pig 它给出了以下错误

2013-02-15 12:35:26,534 [main] INFO  org.apache.pig.Main - Apache Pig version 0.10.1-SNAPSHOT (rexported) compiled Feb 14 2013, 17:55:12
2013-02-15 12:35:26,535 [main] INFO  org.apache.pig.Main - Logging error messages to: /log/path/pig_1360911926530.log
2013-02-15 12:35:26,818 [main] INFO  org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: hdfs://example.host.com:8020
2013-02-15 12:35:26.907 java[2346:1c03] Unable to load realm info from SCDynamicStore
2013-02-15 12:35:27,574 [main] ERROR org.apache.pig.Main - ERROR 2999: Unexpected internal error. Failed to create DataStorage
Details at logfile: /log/path/pig_1360911926530.log

而在日志文件“/log/path/pig_1360911926530.log”的内容中是

Error before Pig is launched
----------------------------
ERROR 2999: Unexpected internal error. Failed to create DataStorage

java.lang.RuntimeException: Failed to create DataStorage
        at org.apache.pig.backend.hadoop.datastorage.HDataStorage.init(HDataStorage.java:75)
        at org.apache.pig.backend.hadoop.datastorage.HDataStorage.<init>(HDataStorage.java:58)
        at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.init(HExecutionEngine.java:205)
        at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.init(HExecutionEngine.java:118)
        at org.apache.pig.impl.PigContext.connect(PigContext.java:208)
        at org.apache.pig.PigServer.<init>(PigServer.java:246)
        at org.apache.pig.PigServer.<init>(PigServer.java:231)
        at org.apache.pig.tools.grunt.Grunt.<init>(Grunt.java:47)
        at org.apache.pig.Main.run(Main.java:487)
        at org.apache.pig.Main.main(Main.java:111)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
Caused by: org.apache.hadoop.ipc.RPC$VersionMismatch: Protocol org.apache.hadoop.hdfs.protocol.ClientProtocol version mismatch. (client = 61, server = 63)
        at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:401)
        at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:379)
        at org.apache.hadoop.hdfs.DFSClient.createRPCNamenode(DFSClient.java:119)
        at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:238)
        at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:203)
        at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:89)
        at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1386)
        at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:66)
        at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1404)
        at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:254)
        at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:123)
        at org.apache.pig.backend.hadoop.datastorage.HDataStorage.init(HDataStorage.java:72)
        ... 14 more
================================================================================
4

2 回答 2

1

如您所见,您获得的异常是版本不匹配。你确定 XXX 有 $HADOOP_HOME init 的类路径吗?看起来它确实指向了错误的罐子。

于 2013-02-19T23:33:27.577 回答
0

在本地机器上提取Hadoop tar文件,然后将配置文件指向集群中的NameNode,然后使用hadoop fs -get命令将文件从远程机器获取到本地机器。

于 2013-02-14T16:21:26.497 回答