在S3上创建配置单元外部表引发“org.apache.hadoop.fs.s3a.S3AFileSystem not found”异常

在S3上创建配置单元外部表引发“org.apache.hadoop.fs.s3a.S3AFileSystem not found”异常,hadoop,amazon-s3,hive,Hadoop,Amazon S3,Hive,我在本地机器上使用beeline在DDL下运行,并抛出异常 DDL是 CREATE TABLE `report_landing_pages`( `google_account_id` string COMMENT 'from deserializer', `ga_view_id` string COMMENT 'from deserializer', `path` string COMMENT 'from deserializer', `users` string COM

我在本地机器上使用beeline在DDL下运行,并抛出异常

DDL是

CREATE TABLE `report_landing_pages`( 
  `google_account_id` string COMMENT 'from deserializer', 
  `ga_view_id` string COMMENT 'from deserializer', 
  `path` string COMMENT 'from deserializer', 
  `users` string COMMENT 'from deserializer', 
  `page_views` string COMMENT 'from deserializer', 
  `event_value` string COMMENT 'from deserializer', 
  `report_date` string COMMENT 'from deserializer') 
PARTITIONED BY (`dt` date) 
ROW FORMAT SERDE 
  'org.apache.hadoop.hive.serde2.OpenCSVSerde' 
STORED AS TEXTFILE
LOCATION 's3a://bucket_name/table'
例外是

org.apache.hive.service.cli.HiveSQLException:处理语句时出错:失败:执行错误,从org.apache.hadoop.hive.ql.exec.ddlstask返回代码1。MetaExceptionmessage:java.lang.RuntimeException:java.lang.ClassNotFoundException:Class org.apache.hadoop.fs.s3a.S3AFileSystem在org.apache.hive.service.cli.operation.toSQLExceptionOperation.java:380在org.apache.hive.service.cli.operation.SQLOperation.runQuerySQLOperation.java:257 atorg.apache.hive.service.cli.operation.SQLOperation.access$800SQLOperation.java:91在org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork$1.runSQLOperation.java:348在java.security.AccessController.doPrivilegedNative方法在javax.security.auth.Subject.doassobject.java:422在org.apache.hadoop.security.UserGroupInformation.doassergroupinformation.java:1698位于org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork.runSQLOperation.java:362位于java.util.concurrent.Executors$RunnableAdapter.callExecutors.java:511位于java.util.concurrent.FutureTask.runFutureTask.java:266位于java.util.concurrent.ThreadPoolExecutor.runWorkerThreadPoolExecutor.java:1142位于java.util.concurrent.ThreadPoolExecutor$Worker.runThreadPoolExecutor.java:617位于java.lang.Thread.runThread.java:745由以下原因引起:org.apache.hadoop.hive.ql.metadata.HiveException:Meta异常消息:java.lang.RuntimeException:java.lang.ClassNotFoundException:Classorg.apache.hadoop.fs.s3a.S3AFileSystem在org.apache.hadoop.hive.ql.metadata.hive.createTableHive.java:862在org.apache.hadoop.hive.metadata.hive.createTableHive.java:867在org.apache.hadoop.hive.ql.exec.ddlstask.createTableddlstask.java:4356在org.apache.hadoop.hive.ql.exec.ddlstask.executedLtask.java:354在java:199在org.apache.hadoop.hive.ql.exec.Task.java:199在org.apache.hadoop.hive.ql.exec.TaskRunner.runSequentialTaskRunner.java:100在org.apache.hadoop.hive.ql.Driver.launchTaskDriver.java:2183在org.apache.hadoop.hive.ql.Driver.executeDriver.java:1839在org.apache.hadoop.hive.ql.Driver.runInternalDriver.java:1526在org.apache.hadoop.hive.ql.Driver.runDriver.java:1237在org.apache.hadoop.hive.ql.Driver.runDriver.java:1232在org.apache.hive.service.cli.operation.SQLOperation.runQuerySQLOperation.java:255。。。11更多原因:MetaExceptionmessage:java.lang.RuntimeException:java.lang.ClassNotFoundException:Class org.apache.hadoop.fs.s3a.S3AFileSystem未在中找到org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$create_table_with_environment_context_result$create_table_with_environment_context_results standardscheme.readThriftHiveMetastore.java:42070 atorg.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$create_table_with_environment_context_result$create_table_with_environment_context_results standardscheme.readThriftHiveMetastore.java:42038位于org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$create_table_with_environment_context_结果.readThriftHiveMetastore.java:41964 atorg.apache.thrift.TServiceClient.receiveBaseTServiceClient.java:86位于org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.recv_create_table_with_environment\u contextThriftHiveMetastore.java:1199位于org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.create_table_with_environment\u contexthifthivemetastore.java:118;位于org.apache.hadoop.hive.metastore.HiveMetaStoreClient.create_table_with_environment_contextHiveMetaStoreClient.java:2399 at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.create_table_with_environment_contextSessionHiveMetaStoreClient.java:93 atorg.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTableHiveMetaStoreClient.java:752在org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTableHiveMetaStoreClient.java:740在sun.reflect.NativeMethodAccessorImpl.invoke0Native方法在sun.reflect.NativeMethodAccessorImpl.invokeNativeMethodAccessorImpl.invokeMathodAccessorImpl.java:62在sun.reflect.DelegatingMethodAccessorImpl.invokeDelegatingMethodAccessorImpl.java:43位于java.lang.reflect.Method.invokeMethod.java:498位于org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invokeRetryingMetaStoreClient.java:173位于com.sun.proxy.$Proxy34.createTableUnknown Source位于sun.reflect.NativeMethodAccessorImpl.invoke0Nativesun.reflect.NativeMethodAccessorImpl.invokeNativeMethodAccessorImpl.java:62在sun.reflect.DelegatingMethodAccessorImpl.invokeDelegatingMethodAccessorImpl.java:43在java.lang.reflect.Method.invokeMethod.java:498在org.apache.hadoop.hive.metastore.HiveMetaStoreClient$SynchronizedHandler.invokeHiveMetaStoreClient.java:2330在com.sun.proxy.$Proxy34.createTableUnknown Source位于org.apache.hadoop.hive.ql.metadata.hive.createTableHive.java:852。。。还有22个

我的本地HDFS可以很好地与HDFS dfs配合使用 -mkdir s3a://bucket/table

wierd的事情是,如果我先在S3上创建表,然后在metastore中手动将表的位置更新到S3,select语句如下 按google\u帐户\u id从报告\u登录\u页面组中选择计数* 很好

如何修复DDL中的异常


顺便说一句,我使用MacOS X EI标题下的Hive 2.3.2和Hadoop 2.7.5运行。

我尝试在我的环境中创建相同的表,结果成功了

检查您的:fs.s3a.access.key


配置文件中的属性。

是否将所有必需的JAR s3等放置到类路径中? org.apache.hadoop.fs.s3a.S3AFileSystem-这是一个hadoop类,可以在hadoop aws jar中找到。报告其中一个类丢失的异常意味着该jar不在类路径中

问题解决了


放置S3 JAR之后,除了hiveserver2之外,还应该重新启动metastore服务。

是的,这是正确的。放置jar后,需要重新启动配置单元元存储服务

要重新启动配置单元元存储,需要遵循以下步骤:

1. ps -ef | grep 'hive'
使用上述命令标识配置单元正在使用的进程ID PID。默认情况下,配置单元使用9083端口号,因此对于正在运行的配置单元元存储服务,您还可以使用lsof-i:9083命令检查PID

2. kill <process number>
此命令将再次启动metastore服务

或 如果您使用的是配置单元服务器2,请使用以下命令:

$ sudo /etc/init.d/hive-metastore start
$ sudo /etc/init.d/hive-metastore stop

对另外,select语句不会成功执行,我将hadop-aws-2.7.5.jar和aws-sdk-1.7.4.jar放在hadoop/share/common/libs下。罐子还应该放在什么地方?还尝试了添加jar,配置单元辅助配置单元JARS\U路径也无法工作。您是否尝试使用配置单元外壳接口以这种方式将jar永久添加到配置单元类路径-添加jar。一个接一个地走过这条路是的。通过直线。列表中的罐子显示正确。您使用的AWS SDK verison和Hadoop是基于什么构建的?您是否使用了多个版本的JAR?B您能够使用jar-xvf“取消”jar吗?jar是否确实包含包和类org.apache.hadoop.fs.s3a.s3afilec。根据Oracle文档,ClassNotFoundException在类加载调用d失败后抛出。通过加载类似依赖项的不同版本,检查依赖项是否被意外覆盖
3. hive --service metastore
$ sudo /etc/init.d/hive-metastore start
$ sudo /etc/init.d/hive-metastore stop