我正在尝试建立一个新的 RabbitMq 服务器(版本 3.7.23,Erlang 版本 22.2.3),并且我已设法使 LDAP 身份验证正常工作。不幸的是,身份验证似乎相当慢,所以我的监控工具在检查活动端点时偶尔会报告错误,并且 UI 偶尔会在浏览应用程序时显示红色的“无法连接到服务器”错误,该错误最终会消失。
在研究我的问题时,似乎rabbit_auth_backend_cache
插件应该可以帮助解决这个问题。我实现了缓存,但它似乎不起作用。rabbit 日志仍然显示 Rabbitmq 尝试为每个请求连接到 LDAP,我没有看到任何可以解释缓存发生了什么的错误。
这是我的配置:
[
{kernel, [
]},
{rabbitmq_management, [
{listener, [
{port, 15672}
]}
]},
{rabbit, [
{auth_backends, [rabbit_auth_backend_cache,rabbit_auth_backend_ldap]},
{cluster_partition_handling,autoheal},
{tcp_listeners, [5672]},
{tcp_listen_options, [binary,
{packet, raw},
{reuseaddr, true},
{backlog, 128},
{nodelay, true},
{exit_on_close, false},
{keepalive, false},
{linger, {true,0}}]},
{log_levels, [{ connection, info }]},
{disk_free_limit, {mem_relative, 1.5}},
{vm_memory_high_watermark, 0.66},
{default_user, <<"guest">>},
{default_pass, <<"guest">>},
{heartbeat, 60}
]}
,{rabbitmq_auth_backend_ldap, [
...omitted because it contains sensitive data...
] }}
]}
,{rabbitmq_auth_backend_cache, [{cached_backend, rabbit_auth_backend_ldap}, {cache_ttl, 5000}]}
,{rabbit_auth_backend_ldap, []}
].
以下是我在启动过程中在日志中看到的内容:
2020-08-21 15:37:52.239 [info] <0.8.0> Server startup complete; 10 plugins started.
* rabbitmq_auth_backend_ldap
* rabbitmq_shovel_management
* rabbitmq_shovel
* rabbitmq_federation_management
* rabbitmq_top
* rabbitmq_management
* rabbitmq_web_dispatch
* rabbitmq_management_agent
* rabbitmq_federation
* rabbitmq_auth_backend_cache
关机时
2020-08-21 15:37:44.095 [info] <0.43.0> Application cowboy exited with reason: stopped
2020-08-21 15:37:44.095 [info] <0.11984.0> Stopping application 'cowlib'
2020-08-21 15:37:44.095 [info] <0.43.0> Application cowlib exited with reason: stopped
2020-08-21 15:37:44.095 [info] <0.11984.0> Stopping application 'rabbitmq_auth_backend_ldap'
2020-08-21 15:37:44.096 [info] <0.43.0> Application rabbitmq_auth_backend_ldap exited with reason: stopped
2020-08-21 15:37:44.096 [info] <0.11984.0> Stopping application 'rabbitmq_management_agent'
2020-08-21 15:37:44.098 [info] <0.43.0> Application rabbitmq_management_agent exited with reason: stopped
2020-08-21 15:37:44.098 [info] <0.11984.0> Stopping application 'rabbitmq_auth_backend_cache'
2020-08-21 15:37:44.099 [info] <0.43.0> Application rabbitmq_auth_backend_cache exited with reason: stopped
2020-08-21 15:37:44.099 [info] <0.11984.0> Stopping application 'rabbit'
谢谢,
亚历克斯
答案1
@Alexander Brehm 您是如何得出缓存无法正常工作的结论的?如果您偶尔遇到连接问题,这可能是由多种其他因素造成的?
您的 ldap 服务器是 VIP 服务器还是单服务器?您是否尝试过增加 cache_ttl。您的应用程序是 http,您是否尝试过为 ldap 使用 http 后端?