我正在嘗試建立一個新的 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 後端?