Hive 未检测到当前名称节点

Hive doesn't detect current namenode

我尝试使用 Hive 和 Zeppelin 请求 Hive 数据库,但出现此错误:

SemanticException Unable to fetch table table_name. org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby

我得到 2 个名称节点:A 和 B 当 A 处于活动状态且 B 处于待机状态时,我可以毫无问题地请求我的 table。

hdfs haadmin -getServiceState A
active
hdfs haadmin -getServiceState B
standby

如果我切换两种状态:

hdfs haadmin -failover A B

A 处于备用状态,B 处于活动状态

hdfs haadmin -getServiceState A
standby
hdfs haadmin -getServiceState B
active

现在我的请求不起作用并出现错误:

SemanticException Unable to fetch table table_name. org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby

我的 Hive 已针对 HA 配置良好:

hive --config /etc/hive/conf/conf.server --service metatool -listFSRoot
Listing FS Roots..
hdfs://HA-NAME/apps/hive/warehouse
hdfs://HA-NAME/apps/hive/warehouse/table1.db
hdfs://HA-NAME/apps/hive/warehouse/table2.db
...

但是在 Hive 中使用命令:show create table1,我得到: LOCATION ' hdfs://A/data/.... '

问题接缝来自namenode B,或者Hive总是使用namenode A作为活动namenode,即使它处于备用状态。

我使用 HA 名称连接我的 kafka 连接到 HDFS 也没有问题。

通过将我的 table 从 A 名称迁移到 HA 名称解决了问题。

在我得到之前:

show create table1 
LOCATION ' hdfs://A/data/.... '

我删除了 table、hdfs 文件并使用 HA 名称作为位置重新创建了它。

show create table1 
LOCATION ' hdfs://HA-NAME/data/.... '

有效