目标:在我的 rabbitmq-ha helm 图表中使用 https://www.rabbitmq.com/community-plugins.html 中的rabbitmq 社区插件。
服务器未附带的任何插件都需要安装。插件以 .ez 存档(带有元数据的 zip 文件)的形式分发。必须将文件复制到 $RABBITMQ_PLUGINS_DIR 指定的插件目录之一。
问题:rabbitmq社区插件的.ev文件如何注入到图表中使用?
背景:
对于我的示例,我尝试将最新版本的社区插件rabbitmq_delayed_message_exchange安装到最新稳定版本的rabbitmq-ha中。
通过将其添加到我的 values.yaml 来识别插件的名称:
amqp-rabbitmq:
extraPlugins: |
rabbitmq_delayed_message_exchange,
当我
helm install example . --debug
它生成
# Source: example/charts/amqp-rabbitmq/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: example-amqp-rabbitmq
namespace: default
labels:
app: amqp-rabbitmq
chart: amqp-rabbitmq-1.38.2
release: example
heritage: Helm
data:
enabled_plugins: |
[
rabbitmq_delayed_message_exchange,
rabbitmq_consistent_hash_exchange,
rabbitmq_management,
rabbitmq_peer_discovery_k8s
].
rabbitmq.conf: |
## RabbitMQ configuration
## Ref: https://github.com/rabbitmq/rabbitmq-server/blob/master/docs/rabbitmq.conf.example
## Authentification
## Clustering
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_k8s
cluster_formation.k8s.host = kubernetes.default.svc.cluster.local
cluster_formation.k8s.address_type = hostname
cluster_formation.node_cleanup.interval = 10
# Set to false if automatic cleanup of absent nodes is desired.
# This can be dangerous, see http://www.rabbitmq.com/cluster-formation.html#node-health-checks-and-cleanup.
cluster_formation.node_cleanup.only_log_warning = true
cluster_partition_handling = autoheal
## The default "guest" user is only permitted to access the server
## via a loopback interface (e.g. localhost)
loopback_users.guest = false
management.load_definitions = /etc/definitions/definitions.json
## Memory-based Flow Control threshold
vm_memory_high_watermark.absolute = 256MB
## Auth HTTP Backend Plugin
## LDAP Plugin
## MQTT Plugin
## Web MQTT Plugin
## STOMP Plugin
## Web STOMP Plugin
## Prometheus Plugin
## AMQPS support
并创建 3 个 k8s_amqp-rabbitmq_example-amqp-rabbitmq-n_default_... 容器。
每个容器中的日志显示
2020-01-11 01:21:16.826 [info] <0.8.0> Server startup complete; 6 plugins started.
* rabbitmq_management
* rabbitmq_web_dispatch
* rabbitmq_consistent_hash_exchange
* rabbitmq_peer_discovery_k8s
* rabbitmq_management_agent
* rabbitmq_peer_discovery_common
2020-01-11 01:23:06.954 [info] <0.529.0> node 'rabbit@example-amqp-rabbitmq-1.example-amqp-rabbitmq-discovery.default.svc.cluster.local' up
2020-01-11 01:23:12.776 [info] <0.529.0> rabbit on node 'rabbit@example-amqp-rabbitmq-1.example-amqp-rabbitmq-discovery.default.svc.cluster.local' up
我可以成功登录rabbitmq,创建交换器、队列等。
但是,找不到所需的 rabbitmq_delayed_message_exchange 插件。
当我的应用程序尝试使用 helm 安装的rabbitmq-ha 来创建延迟交换时,它得到:
'Error: Connection closed: 503 (COMMAND-INVALID) with message "COMMAND_INVALID - unknown exchange type 'x-delayed-message'"
它适用于rabbitmq的非kubernetes实例,我可以在其中轻松安装插件。
我花了几天时间在网上搜索关于如何利用社区插件的rabbitmq-ha图表的清晰示例、提示和线索,但没有取得进展。
有什么想法吗? 我错过了什么?
不再需要构建自定义图表,我用这个values.yaml 做到了
## Plugins to enable
##
plugins: 'rabbitmq_management rabbitmq_peer_discovery_k8s'
## Community plugins to download during container initialization.
## Combine it with extraPlugins to also enable them.
##
communityPlugins: |
https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/3.8.9/rabbitmq_delayed_message_exchange-3.8.9-0199d11c.ez
## Extra plugins to enable
## Use this instead of `plugins` to add new pluginsmv ra
##
extraPlugins: |
rabbitmq_auth_backend_ldap
rabbitmq_delayed_message_exchange
这里是安装和启用两个 RabbitMQ 社区插件的示例:
$ helm search repo rabbitmq
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/rabbitmq 6.25.4 3.8.3 Open source message broker software that implem...
$ helm pull --untar bitnami/rabbitmq
statefulset.yaml
...
# Install community plugins
pushd /opt/bitnami/rabbitmq/plugins/
curl -LO https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/v3.8.0/rabbitmq_delayed_message_exchange-3.8.0.ez
curl -LO https://github.com/rabbitmq/rabbitmq-message-timestamp/releases/download/v3.8.0/rabbitmq_message_timestamp-3.8.0.ez
popd
# End of installing community plugins
exec rabbitmq-server
...
$ cd rabbitmq
$ helm install rmq . --set rabbitmq.extraPlugins="rabbitmq_delayed_message_exchange rabbitmq_message_timestamp"
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
rmq-rabbitmq-0 1/1 Running 0 3m32s
$ kubectl exec -it rmq-rabbitmq-0 bash
I have no name!@rmq-rabbitmq-0:/$ rabbitmq-plugins list
Listing plugins with pattern ".*" ...
Configured: E = explicitly enabled; e = implicitly enabled
| Status: * = running on rabbit@rmq-rabbitmq-0.rmq-rabbitmq-headless.default.svc.cluster.local
|/
[ ] rabbitmq_amqp1_0 3.8.3
[ ] rabbitmq_auth_backend_cache 3.8.3
[ ] rabbitmq_auth_backend_http 3.8.3
[ ] rabbitmq_auth_backend_ldap 3.8.3
[ ] rabbitmq_auth_backend_oauth2 3.8.3
[ ] rabbitmq_auth_mechanism_ssl 3.8.3
[ ] rabbitmq_consistent_hash_exchange 3.8.3
[E*] rabbitmq_delayed_message_exchange 3.8.0
[ ] rabbitmq_event_exchange 3.8.3
[ ] rabbitmq_federation 3.8.3
[ ] rabbitmq_federation_management 3.8.3
[ ] rabbitmq_jms_topic_exchange 3.8.3
[E*] rabbitmq_management 3.8.3
[e*] rabbitmq_management_agent 3.8.3
[E*] rabbitmq_message_timestamp 3.8.0
[ ] rabbitmq_mqtt 3.8.3
...
注意:我的Helm版本是
v3.1.1
$ helm version
version.BuildInfo{Version:"v3.1.1", GitCommit:"afe70585407b420d0097d07b21c47dc511525ac8", GitTreeState:"clean", GoVersion:"go1.13.8"}
将其添加到您的 value.yaml 中
## @param plugins List of default plugins to enable (should only be altered to remove defaults; for additional plugins use `extraPlugins`)
##
plugins: "rabbitmq_management rabbitmq_peer_discovery_k8s"
## @param queue_master_locator Changes the queue_master_locator setting in the rabbitmq config file
##
queue_master_locator: min-masters
## @param communityPlugins List of Community plugins (URLs) to be downloaded during container initialization
## Combine it with extraPlugins to also enable them.
##
communityPlugins: "https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/v4.0.2/rabbitmq_delayed_message_exchange-4.0.2.ez"
## @param extraPlugins Extra plugins to enable (single string containing a space-separated list)
## Use this instead of `plugins` to add new plugins
##
extraPlugins: "rabbitmq_auth_backend_ldap rabbitmq_delayed_message_exchange"