如何使用pig访问远程机器上的hdfs?

nc1teljy  于 2021-06-04  发布在  Hadoop
关注(0)|答案(2)|浏览(418)

远程计算机(example.host.com)上安装了hadoop。清管器也安装在那台机器上。
如何从其他机器访问该机器上的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_.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
================================================================================
trnvg8h3

trnvg8h31#

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

xoefb8l8

xoefb8l82#

正如您所看到的,您得到的异常是版本不匹配。你确定有$hadoop\u home init的类路径吗?看起来它指向了错误的jar。

相关问题