【发布时间】:2021-03-29 17:32:02
【问题描述】:
我正在尝试访问 EMR 上的 hbase 以从在 EMR 集群节点外部运行的 Java 应用程序进行读写。即;来自在 ECS 集群/EC2 实例上运行的 docker 应用程序。 hbase 根文件夹类似于s3://<bucketname/。我需要获取 hadoop 和 hbase 配置对象以使用 core-site.xml、hbase-site.xml 文件访问 hbase 数据以进行读写。如果 hbase 数据存储在 hdfs 中,我可以访问它。
但是当它是 S3 上的 hbase 并尝试实现相同时,我遇到了异常。
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.amazon.ws.emr.hadoop.fs.EmrFileSystem not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2195)
at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2638
core-site.xml 文件包含以下属性。
<property>
<name>fs.s3.impl</name>
<value>com.amazon.ws.emr.hadoop.fs.EmrFileSystem</value>
</property>
<property>
<name>fs.s3n.impl</name>
<value>com.amazon.ws.emr.hadoop.fs.EmrFileSystem</value>
</property>
下面是包含“com.amazon.ws.emr.hadoop.fs.EmrFileSystem”类的jar:
/usr/share/aws/emr/emrfs/lib/emrfs-hadoop-assembly-2.44.0.jar
此 jar 仅存在于 emr 节点上,不能作为 maven 依赖项包含在来自 maven 公共 repo 的 java 项目中。对于 Map/Reduce 作业和 Spark 作业,在类路径中添加 jar 位置将达到目的。对于在 emr 集群节点外运行的 java 应用程序,将 jar 添加到类路径将不起作用,因为 jar 在 ecs 实例中不可用。手动将 jar 添加到类路径会导致以下错误。
2021-03-26 10:02:39.420 INFO 1 --- [ main] c.a.ws.emr.hadoop.fs.util.PlatformInfo : Unable to read clusterId from http://localhost:8321/configuration , trying extra instance data file: /var/lib/instance-controller/extraInstanceData.json
2021-03-26 10:02:39.421 INFO 1 --- [ main] c.a.ws.emr.hadoop.fs.util.PlatformInfo : Unable to read clusterId from /var/lib/instance-controller/extraInstanceData.json, trying EMR job-flow data file: /var/lib/info/job-flow.json
2021-03-26 10:02:39.421 INFO 1 --- [ main] c.a.ws.emr.hadoop.fs.util.PlatformInfo : Unable to read clusterId from /var/lib/info/job-flow.json, out of places to look
2021-03-26 10:02:45.578 WARN 1 --- [ main] c.a.w.e.h.fs.util.ConfigurationUtils : Cannot create temp dir with proper permission: /mnt/s3
我们使用的是 emr 版本 5.29。有什么办法可以解决这个问题吗?
【问题讨论】:
标签: java hbase amazon-emr