0

我在kubernetes中使用rabbitmq 运算符部署了一个rabbitmq实例。我正在尝试启用rabbitmq 插件: rabbitmq_delayed_message_exchange

我尝试将我的RabbitmqCluster定义为:

apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: definition
spec:
  replicas: 1
  rabbitmq:
    additionalPlugins:
      - rabbitmq_management
      - rabbitmq_delayed_message_exchange
  service:
    type: LoadBalancer

然后我跑了kubectl apply -f definition.yaml

但我的pod 日志显示了这一点:

...
2020-10-05T15:42:15.081783023Z 2020-10-05 15:42:15.081 [info] <0.535.0> Server startup complete; 6 plugins started.
2020-10-05T15:42:15.081802701Z  * rabbitmq_prometheus
2020-10-05T15:42:15.08180602Z  * rabbitmq_peer_discovery_k8s
2020-10-05T15:42:15.081808816Z  * rabbitmq_peer_discovery_common
2020-10-05T15:42:15.081811359Z  * rabbitmq_management
2020-10-05T15:42:15.08181387Z  * rabbitmq_web_dispatch
2020-10-05T15:42:15.081825082Z  * rabbitmq_management_agent
2020-10-05T15:42:15.081951576Z  completed with 6 plugins.
...

日志中没有对此插件任何引用

我进入我的 rabbitmq pod 并运行:rabbitmq-plugins list

Listing plugins with pattern ".*" ...
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status: * = running on rabbit@definition-rabbitmq-server-0.definition-rabbitmq-headless.default
 |/
[  ] rabbitmq_amqp1_0                  3.8.8
[  ] rabbitmq_auth_backend_cache       3.8.8
[  ] rabbitmq_auth_backend_http        3.8.8
[  ] rabbitmq_auth_backend_ldap        3.8.8
[  ] rabbitmq_auth_backend_oauth2      3.8.8
[  ] rabbitmq_auth_mechanism_ssl       3.8.8
[  ] rabbitmq_consistent_hash_exchange 3.8.8
[  ] rabbitmq_event_exchange           3.8.8
[  ] rabbitmq_federation               3.8.8
[  ] rabbitmq_federation_management    3.8.8
[  ] rabbitmq_jms_topic_exchange       3.8.8
[E*] rabbitmq_management               3.8.8
[e*] rabbitmq_management_agent         3.8.8
[  ] rabbitmq_mqtt                     3.8.8
[  ] rabbitmq_peer_discovery_aws       3.8.8
[e*] rabbitmq_peer_discovery_common    3.8.8
[  ] rabbitmq_peer_discovery_consul    3.8.8
[  ] rabbitmq_peer_discovery_etcd      3.8.8
[E*] rabbitmq_peer_discovery_k8s       3.8.8
[E*] rabbitmq_prometheus               3.8.8
[  ] rabbitmq_random_exchange          3.8.8
[  ] rabbitmq_recent_history_exchange  3.8.8
[  ] rabbitmq_sharding                 3.8.8
[  ] rabbitmq_shovel                   3.8.8
[  ] rabbitmq_shovel_management        3.8.8
[  ] rabbitmq_stomp                    3.8.8
[  ] rabbitmq_top                      3.8.8
[  ] rabbitmq_tracing                  3.8.8
[  ] rabbitmq_trust_store              3.8.8
[e*] rabbitmq_web_dispatch             3.8.8
[  ] rabbitmq_web_mqtt                 3.8.8
[  ] rabbitmq_web_mqtt_examples        3.8.8
[  ] rabbitmq_web_stomp                3.8.8
[  ] rabbitmq_web_stomp_examples       3.8.8

并检查了pod plugins/ 目录

README
accept-0.3.5.ez
amqp10_client-3.8.8.ez
amqp10_common-3.8.8.ez
amqp_client-3.8.8.ez
aten-0.5.5.ez
base64url-0.0.1.ez
cowboy-2.6.1.ez
cowlib-2.7.0.ez
credentials_obfuscation-2.2.0.ez
cuttlefish-2.4.1.ez
eetcd-0.3.3.ez
gen_batch_server-0.8.4.ez
getopt-1.0.1.ez
goldrush-0.1.9.ez
gun-1.3.3.ez
jose-1.10.1.ez
jsx-2.11.0.ez
lager-3.8.0.ez
observer_cli-1.5.4.ez
prometheus-4.6.0.ez
ra-1.1.6.ez
rabbit-3.8.8.ez
rabbit_common-3.8.8.ez
rabbitmq_amqp1_0-3.8.8.ez
rabbitmq_auth_backend_cache-3.8.8.ez
rabbitmq_auth_backend_http-3.8.8.ez
rabbitmq_auth_backend_ldap-3.8.8.ez
rabbitmq_auth_backend_oauth2-3.8.8.ez
rabbitmq_auth_mechanism_ssl-3.8.8.ez
rabbitmq_aws-3.8.8.ez
rabbitmq_consistent_hash_exchange-3.8.8.ez
rabbitmq_event_exchange-3.8.8.ez
rabbitmq_federation-3.8.8.ez
rabbitmq_federation_management-3.8.8.ez
rabbitmq_jms_topic_exchange-3.8.8.ez
rabbitmq_management-3.8.8.ez
rabbitmq_management_agent-3.8.8.ez
rabbitmq_mqtt-3.8.8.ez
rabbitmq_peer_discovery_aws-3.8.8.ez
rabbitmq_peer_discovery_common-3.8.8.ez
rabbitmq_peer_discovery_consul-3.8.8.ez
rabbitmq_peer_discovery_etcd-3.8.8.ez
rabbitmq_peer_discovery_k8s-3.8.8.ez
rabbitmq_prelaunch-3.8.8.ez
rabbitmq_prometheus-3.8.8.ez
rabbitmq_random_exchange-3.8.8.ez
rabbitmq_recent_history_exchange-3.8.8.ez
rabbitmq_sharding-3.8.8.ez
rabbitmq_shovel-3.8.8.ez
rabbitmq_shovel_management-3.8.8.ez
rabbitmq_stomp-3.8.8.ez
rabbitmq_top-3.8.8.ez
rabbitmq_tracing-3.8.8.ez
rabbitmq_trust_store-3.8.8.ez
rabbitmq_web_dispatch-3.8.8.ez
rabbitmq_web_mqtt-3.8.8.ez
rabbitmq_web_mqtt_examples-3.8.8.ez
rabbitmq_web_stomp-3.8.8.ez
rabbitmq_web_stomp_examples-3.8.8.ez
ranch-1.7.1.ez
recon-2.5.1.ez
stdout_formatter-0.2.4.ez
syslog-3.4.5.ez
sysmon_handler-1.3.0.ez

所以这意味着插件没有集成

我还发现了这个:

如何在 kubernetes 上安装 rabbitmq 插件?

但是没有提到rabbitmq操作符,它是在2018年6月被问到的。同样在 rabbitmq 操作员配置中,没有任何关于使用生命周期挂钩挂载 ez 文件的参考。

我想到的1 个想法是创建我自己的rabbitmq 图像,引用rabbitmq 官方图像并添加插件。

FROM rabbitmq:3.8.8-management

RUN apt-get update

RUN apt-get install -y curl

RUN curl -L https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/v3.8.0/rabbitmq_delayed_message_exchange-3.8.0.ez > $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.8.0.ez

RUN chown rabbitmq:rabbitmq $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.8.0.ez

RUN rabbitmq-plugins enable --offline rabbitmq_delayed_message_exchange

RUN rabbitmq-plugins enable --offline rabbitmq_consistent_hash_exchange

第二个想法是通过使用文件定义配置映射并使用 volumeMounts 将文件挂载到 pod 文件目录中,但我找不到任何将 volumeMounts 与 rabbitmq 运算符一起使用的参考。

是否有首选方式任何其他方式来启用它

4

1 回答 1

2

可以使用安装了插件的自定义 Docker Rabbitmq 映像启用插件

FROM rabbitmq:3.8.8-management

RUN apt-get update

RUN apt-get install -y curl

RUN curl -L https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/v3.8.0/rabbitmq_delayed_message_exchange-3.8.0.ez > $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.8.0.ez

RUN chown rabbitmq:rabbitmq $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.8.0.ez

RUN rabbitmq-plugins enable --offline rabbitmq_delayed_message_exchange

RUN rabbitmq-plugins enable --offline rabbitmq_consistent_hash_exchange

注意:对于不可变的结果或如果您不能依赖外部更改,请将插件下载到您的机器并使用 COPY 而不是使用 RUN curl...确保您的机器中有 rabbitmq_delayed_message_exchange .ez 文件。

  • 将您的图像推送到容器注册表。

然后将您的RabbitmqCluster定义为:

apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: definition
spec:
  image: <container-registry>/<username>/rabbitmq-delayed-message-exchange:3.8.8-management
  replicas: 1
  rabbitmq:
    additionalPlugins:
      - rabbitmq_management
      - rabbitmq_delayed_message_exchange
  service:
    type: LoadBalancer

注意:将图像更改为您推送的图像。

于 2020-10-05T20:59:45.717 回答