PowerFlex:网关高可用性设置导致 REST 客户端上出现 401 错误

Summary: REST API 客户端收到“401:当网关/Apache 服务均运行时出现“未经授权”错误。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Symptoms

REST API 客户端收到“401:当网关/Apache 服务均运行时出现“未经授权”错误。

REST API 客户端的一个示例是 OpenStack cinder。此问题可能会导致 OpenStack 中的某些 ScaleIO 卷作(映射、取消映射等)失败。

每 10 个成功的 REST API 请求,将有 1 个失败。例如,主 Apache 服务的 mod_jk.log显示:

tail -f /var/log/apache2/mod_jk.log | grep ") status"
[6496:139877463439104] [debug] ajp_unmarshal_response::jk_ajp_common.c (739): (machine2) status = 200
[6497:139877295294208] [debug] ajp_unmarshal_response::jk_ajp_common.c (739): (machine2) status = 200
[6497:139877270116096] [debug] ajp_unmarshal_response::jk_ajp_common.c (739): (machine2) status = 200
[6496:139877429868288] [debug] ajp_unmarshal_response::jk_ajp_common.c (739): (machine1) status = 401 <---
[6497:139877219759872] [debug] ajp_unmarshal_response::jk_ajp_common.c (739): (machine2) status = 200
[6496:139877303686912] [debug] ajp_unmarshal_response::jk_ajp_common.c (739): (machine2) status = 200
[6497:139877228152576] [debug] ajp_unmarshal_response::jk_ajp_common.c (739): (machine2) status = 200



 /var/log/nova/nova-compute.log 显示: 

2017-04-05 11:20:36.090 38186 ERROR nova.compute.manager [instance: 20e1036d-daf0-49b9-a228-07a1c48b882d] File "/usr/lib/python2.7/site-packages/os_brick/initiator/connector.py", line 1980, in connect_volume 2017-04-05 11:20:36.090 38186 ERROR nova.compute.manager [instance: 20e1036d-daf0-49b9-a228-07a1c48b882d] self.volume_id = self._get_volume_id() 2017-04-05 11:20:36.090 38186 ERROR nova.compute.manager [instance: 20e1036d-daf0-49b9-a228-07a1c48b882d] File "/usr/lib/python2.7/site-packages/os_brick/initiator/connector.py", line 1879, in _get_volume_id 2017-04-05 11:20:36.090 38186 ERROR nova.compute.manager [instance: 20e1036d-daf0-49b9-a228-07a1c48b882d] raise exception.BrickException(message=msg) 2017-04-05 11:20:36.090 38186 ERROR nova.compute.manager [instance: 20e1036d-daf0-49b9-a228-07a1c48b882d] BrickException: Error getting volume id from name oGXMByctQWesXL8PPKiyBQ==: Unauthorized 2017-04-05 11:20:36.090 38186 ERROR nova.compute.manager [instance: 20e1036d-daf0-49b9-a228-07a1c48b882d]

 

Cause

这是文档中的错误。本文档中的 workers.properties 配置包含两个网关 (Tomcat) 实例之间的负载均衡设置,并且它们的 lbfactor 设置为 10 和 1。这意味着 Apache 服务以 10:1 的比例将传入请求定向到两个网关。由于 REST API 客户端通过一个网关获取令牌,并且令牌不在网关之间共享,因此使用该令牌发送到第二个网关的请求失败,显示 401。

注意:如果客户端使用 lbfactor 1 从网关获取令牌,则失败率约为 91%。

Resolution

解决方法
使用以下 workers.properties 文件,而不是文档中的文件。这会在活动-备用模式下设置两个网关:

** /etc/apache2/workers.properties ***

worker.list=balance1
worker.machine1.type=ajp13
worker.machine1.host=<ip of GW 1>
worker.machine1.port=8009
worker.machine1.lbfactor=1
worker.machine1.activation=disabled

worker.machine2.type=ajp13
worker.machine2.host=<ip of GW 2>
worker.machine2.port=8009
worker.machine2.lbfactor=1
worker.machine2.redirect=machine1

worker.balance1.type=lb
worker.balance1.balance_workers=machine1,machine2



此配置将 machine2 设置为主交换机,将 worker1 设置为备用交换机。此配置与本文档的主要区别在于:

  • worker.machine1.activation=disabled

这会使工作线程 machine1 处于待机状态,默认情况下不会向 machine1 发送任何请求。
  • worker.machine2.redirect=machine1
默认情况下,machine2 处于激活状态,并接收请求。如果 machine2 失败,请求将重定向到 machine1。
  • worker.machine#.lbfactor=1

由于这是活动-备用设置,因此不同的 lbfactors 如果两个工作器进程不需要,则进行设置。
 
 

使用此配置:

  • 当两个网关都启动时,所有请求都定向到 worker2,不应有 401。
  • 当 worker2 发生故障时,请求将定向到 worker1。REST 客户端收到 401,可以再次登录到 REST API 服务并继续。
  • 当 worker2 返回并且 mod_jk 模块检测到它时,它会再次将请求定向到 worker2,REST 客户端收到另一个 401,但可以再次登录到 RESET API 服务并继续。

提醒:两个 Apache 服务必须在其 workers.properties 文件中定义。Apache 服务也设置为 active-standby 集群, 按 keepalived mod_jk 模块负责将 REST API 请求定向到基于上述配置的网关服务。

这是文档错误。在更正文档之前,可以使用此知识库文章。

Additional Information

keepalived 配置也可以改进,因为它可能无法正确监视 apache/httpd 服务。

keepalived.conf 使用“killall -0 apache2”作为“脚本”。如果存在任何名称中包含“apache2”的进程,则返回 0(成功),例如”tail -f /var/log/apache2/mod_jk.log."

要正确监控 apache2 服务,请使用“systemctl --no-pager status apache2”(Ubuntu)或“systemctl status httpd”(CentOS/RedHat)。

如果 apache2/httpd 服务正在运行,则用作“脚本”的命令必须返回 0,如果已停止,则返回非零。

Affected Products

PowerFlex Software
Article Properties
Article Number: 000052840
Article Type: Solution
Last Modified: 29 Oct 2025
Version:  4
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.