环境:
flink1.12.1 
hive2.1.0
CDH6.2.0

【问题描述】
 在没开启Kerberos认证时,可以正常读写hive表
 
 开启Kerberos认证后,
 启动时可以正常读取到hive metastore的元数据信息,读写不了表。


【sql-client.sh embedded】
Flink SQL> show tables;
dimension_table
dimension_table1
test


Flink SQL> select * from test;
[ERROR] Could not execute SQL statement. Reason:
org.apache.flink.connectors.hive.FlinkHiveException: Failed to collect all 
partitions from hive metaStore


【完整日志 
/opt/cloudera/parcels/FLINK-1.12.1-BIN-SCALA_2.11/lib/flink/log/flink-root-sql-client-cdh6.com.log】

2021-03-07 10:29:18.776 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Trying to connect to 
localhost/127.0.0.1:6123
2021-03-07 10:29:18.777 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address 'cdh6.com/192.168.31.10': Connection refused (Connection refused)
2021-03-07 10:29:18.778 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/127.0.0.1': Connection refused (Connection refused)
2021-03-07 10:29:18.778 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/fe80:0:0:0:20c:29ff:fea1:6d6b%ens33': Network is unreachable (connect 
failed)
2021-03-07 10:29:18.778 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/192.168.31.10': Connection refused (Connection refused)
2021-03-07 10:29:18.779 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/0:0:0:0:0:0:0:1%lo': Network is unreachable (connect failed)
2021-03-07 10:29:18.779 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/127.0.0.1': Connection refused (Connection refused)
2021-03-07 10:29:18.779 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/fe80:0:0:0:20c:29ff:fea1:6d6b%ens33': Network is unreachable (connect 
failed)
2021-03-07 10:29:18.779 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/192.168.31.10': Connection refused (Connection refused)
2021-03-07 10:29:18.780 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/0:0:0:0:0:0:0:1%lo': Network is unreachable (connect failed)
2021-03-07 10:29:18.780 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/127.0.0.1': Connection refused (Connection refused)
2021-03-07 10:29:18.780 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Could not connect. Waiting 
for 1600 msecs before next attempt
2021-03-07 10:29:20.381 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Trying to connect to 
localhost/127.0.0.1:6123
2021-03-07 10:29:20.381 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address 'cdh6.com/192.168.31.10': Connection refused (Connection refused)
2021-03-07 10:29:20.382 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/127.0.0.1': Connection refused (Connection refused)
2021-03-07 10:29:20.383 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/fe80:0:0:0:20c:29ff:fea1:6d6b%ens33': Network is unreachable (connect 
failed)
2021-03-07 10:29:20.383 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/192.168.31.10': Connection refused (Connection refused)
2021-03-07 10:29:20.383 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/0:0:0:0:0:0:0:1%lo': Network is unreachable (connect failed)
2021-03-07 10:29:20.383 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/127.0.0.1': Connection refused (Connection refused)
2021-03-07 10:29:20.384 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/fe80:0:0:0:20c:29ff:fea1:6d6b%ens33': Network is unreachable (connect 
failed)
2021-03-07 10:29:20.384 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/192.168.31.10': Connection refused (Connection refused)
2021-03-07 10:29:20.384 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/0:0:0:0:0:0:0:1%lo': Network is unreachable (connect failed)
2021-03-07 10:29:20.385 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/127.0.0.1': Connection refused (Connection refused)
2021-03-07 10:29:20.385 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Could not connect. Waiting 
for 1829 msecs before next attempt
2021-03-07 10:29:22.214 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Trying to connect to 
localhost/127.0.0.1:6123
2021-03-07 10:29:22.215 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address 'cdh6.com/192.168.31.10': Connection refused (Connection refused)
2021-03-07 10:29:22.216 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/127.0.0.1': Connection refused (Connection refused)
2021-03-07 10:29:22.216 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/fe80:0:0:0:20c:29ff:fea1:6d6b%ens33': Network is unreachable (connect 
failed)
2021-03-07 10:29:22.217 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/192.168.31.10': Connection refused (Connection refused)
2021-03-07 10:29:22.217 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/0:0:0:0:0:0:0:1%lo': Network is unreachable (connect failed)
2021-03-07 10:29:22.217 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/127.0.0.1': Connection refused (Connection refused)
2021-03-07 10:29:22.218 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/fe80:0:0:0:20c:29ff:fea1:6d6b%ens33': Network is unreachable (connect 
failed)
2021-03-07 10:29:22.218 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/192.168.31.10': Connection refused (Connection refused)
2021-03-07 10:29:22.218 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/0:0:0:0:0:0:0:1%lo': Network is unreachable (connect failed)
2021-03-07 10:29:22.218 [main] INFO  
org.apache.flink.runtime.net.ConnectionUtils  - Failed to connect from 
address '/127.0.0.1': Connection refused (Connection refused)
2021-03-07 10:29:22.219 [main] WARN  
org.apache.flink.runtime.net.ConnectionUtils  - Could not connect to 
localhost/127.0.0.1:6123. Selecting a local address using heuristics.
2021-03-07 10:29:22.290 [main] WARN  
org.apache.hadoop.hive.conf.HiveConf  - HiveConf of name 
hive.vectorized.use.checked.expressions does not exist
2021-03-07 10:29:22.290 [main] WARN  
org.apache.hadoop.hive.conf.HiveConf  - HiveConf of name 
hive.vectorized.use.checked.expressions does not exist
2021-03-07 10:29:22.290 [main] WARN  
org.apache.hadoop.hive.conf.HiveConf  - HiveConf of name 
hive.strict.checks.no.partition.filter does not exist
2021-03-07 10:29:22.290 [main] WARN  
org.apache.hadoop.hive.conf.HiveConf  - HiveConf of name 
hive.strict.checks.no.partition.filter does not exist
2021-03-07 10:29:22.290 [main] WARN  
org.apache.hadoop.hive.conf.HiveConf  - HiveConf of name 
hive.strict.checks.orderby.no.limit does not exist
2021-03-07 10:29:22.290 [main] WARN  
org.apache.hadoop.hive.conf.HiveConf  - HiveConf of name 
hive.strict.checks.orderby.no.limit does not exist
2021-03-07 10:29:22.291 [main] WARN  
org.apache.hadoop.hive.conf.HiveConf  - HiveConf of name 
hive.vectorized.input.format.excludes does not exist
2021-03-07 10:29:22.291 [main] WARN  
org.apache.hadoop.hive.conf.HiveConf  - HiveConf of name 
hive.vectorized.input.format.excludes does not exist
2021-03-07 10:29:22.291 [main] WARN  
org.apache.hadoop.hive.conf.HiveConf  - HiveConf of name 
hive.strict.checks.bucketing does not exist
2021-03-07 10:29:22.291 [main] WARN  
org.apache.hadoop.hive.conf.HiveConf  - HiveConf of name 
hive.strict.checks.bucketing does not exist
2021-03-07 10:29:22.291 [main] INFO  hive.metastore  - Trying to 
connect to metastore with URI thrift://cdh6.com:9083
2021-03-07 10:29:22.292 [main] INFO  hive.metastore  - Opened a 
connection to metastore, current connections: 2
2021-03-07 10:29:22.301 [main] WARN  hive.metastore  - set_ugi() not 
successful, Likely cause: new client talking to old server. Continuing without 
it.
org.apache.thrift.transport.TTransportException: null
        at 
org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
        at 
org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
        at 
org.apache.thrift.protocol.TBinaryProtocol.readStringBody(TBinaryProtocol.java:380)
        at 
org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:230)
        at 
org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:77)
        at 
org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.recv_set_ugi(ThriftHiveMetastore.java:4122)
        at 
org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.set_ugi(ThriftHiveMetastore.java:4108)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.open(HiveMetaStoreClient.java:495)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init&gt;(HiveMetaStoreClient.java:286)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init&gt;(HiveMetaStoreClient.java:211)
&nbsp; &nbsp; &nbsp; &nbsp; at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
&nbsp; &nbsp; &nbsp; &nbsp; at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
&nbsp; &nbsp; &nbsp; &nbsp; at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
&nbsp; &nbsp; &nbsp; &nbsp; at 
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1652)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init&gt;(RetryingMetaStoreClient.java:83)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:133)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:118)
&nbsp; &nbsp; &nbsp; &nbsp; at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
&nbsp; &nbsp; &nbsp; &nbsp; at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
&nbsp; &nbsp; &nbsp; &nbsp; at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
&nbsp; &nbsp; &nbsp; &nbsp; at java.lang.reflect.Method.invoke(Method.java:498)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.catalog.hive.client.HiveShimV200.getHiveMetastoreClient(HiveShimV200.java:54)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.catalog.hive.client.HiveMetastoreClientWrapper.createMetastoreClient(HiveMetastoreClientWrapper.java:274)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.catalog.hive.client.HiveMetastoreClientWrapper.<init&gt;(HiveMetastoreClientWrapper.java:80)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.catalog.hive.client.HiveMetastoreClientFactory.create(HiveMetastoreClientFactory.java:32)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.connectors.hive.util.HivePartitionUtils.getAllPartitions(HivePartitionUtils.java:114)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.connectors.hive.HiveTableSource.getDataStream(HiveTableSource.java:137)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.connectors.hive.HiveTableSource$1.produceDataStream(HiveTableSource.java:122)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.plan.nodes.common.CommonPhysicalTableSourceScan.createSourceTransformation(CommonPhysicalTableSourceScan.scala:88)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecTableSourceScan.translateToPlanInternal(StreamExecTableSourceScan.scala:91)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecTableSourceScan.translateToPlanInternal(StreamExecTableSourceScan.scala:44)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.plan.nodes.exec.ExecNode$class.translateToPlan(ExecNode.scala:59)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecTableSourceScan.translateToPlan(StreamExecTableSourceScan.scala:44)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecLegacySink.translateToTransformation(StreamExecLegacySink.scala:158)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecLegacySink.translateToPlanInternal(StreamExecLegacySink.scala:82)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecLegacySink.translateToPlanInternal(StreamExecLegacySink.scala:48)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.plan.nodes.exec.ExecNode$class.translateToPlan(ExecNode.scala:59)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecLegacySink.translateToPlan(StreamExecLegacySink.scala:48)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.delegation.StreamPlanner$$anonfun$translateToPlan$1.apply(StreamPlanner.scala:66)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.delegation.StreamPlanner$$anonfun$translateToPlan$1.apply(StreamPlanner.scala:65)
&nbsp; &nbsp; &nbsp; &nbsp; at 
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
&nbsp; &nbsp; &nbsp; &nbsp; at 
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
&nbsp; &nbsp; &nbsp; &nbsp; at 
scala.collection.Iterator$class.foreach(Iterator.scala:891)
&nbsp; &nbsp; &nbsp; &nbsp; at 
scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
&nbsp; &nbsp; &nbsp; &nbsp; at 
scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
&nbsp; &nbsp; &nbsp; &nbsp; at 
scala.collection.AbstractIterable.foreach(Iterable.scala:54)
&nbsp; &nbsp; &nbsp; &nbsp; at 
scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
&nbsp; &nbsp; &nbsp; &nbsp; at 
scala.collection.AbstractTraversable.map(Traversable.scala:104)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.delegation.StreamPlanner.translateToPlan(StreamPlanner.scala:65)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.planner.delegation.PlannerBase.translate(PlannerBase.scala:167)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.api.internal.TableEnvironmentImpl.translate(TableEnvironmentImpl.java:1329)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.api.internal.TableEnvironmentImpl.translateAndClearBuffer(TableEnvironmentImpl.java:1321)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.api.bridge.java.internal.StreamTableEnvironmentImpl.getPipeline(StreamTableEnvironmentImpl.java:328)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.gateway.local.ExecutionContext.lambda$createPipeline$1(ExecutionContext.java:287)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.gateway.local.ExecutionContext.wrapClassLoader(ExecutionContext.java:256)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.gateway.local.ExecutionContext.createPipeline(ExecutionContext.java:282)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.gateway.local.LocalExecutor.executeQueryInternal(LocalExecutor.java:542)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.gateway.local.LocalExecutor.executeQuery(LocalExecutor.java:374)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.cli.CliClient.callSelect(CliClient.java:648)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.cli.CliClient.callCommand(CliClient.java:323)
&nbsp; &nbsp; &nbsp; &nbsp; at java.util.Optional.ifPresent(Optional.java:159)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.cli.CliClient.open(CliClient.java:214)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.SqlClient.openCli(SqlClient.java:144)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.SqlClient.start(SqlClient.java:115)
&nbsp; &nbsp; &nbsp; &nbsp; at 
org.apache.flink.table.client.SqlClient.main(SqlClient.java:201)
2021-03-07 10:29:22.302 [main] INFO&nbsp; hive.metastore&nbsp; - Connected to 
metastore.



861277...@qq.com

回复