目标:要在我的 rabbitmq-ha 掌舵图中使用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 插件。
当我的应用程序尝试使用已安装的舵机Rabbitmq-ha创建延迟交换时,它会得到:
'Error: Connection closed: 503 (COMMAND-INVALID) with message "COMMAND_INVALID - unknown exchange type 'x-delayed-message'"
它可与Rabbitmq的非kubernetes实例一起使用,在这里我可以轻松地安装插件。
我花了几天时间在网上搜索了一个清晰的示例,提示和线索,以了解如何利用社区插件的Rabbitmq-ha图表,但未取得进展。
有什么想法吗?我想念什么?
答案 0 :(得分:2)
以下是安装并启用两个RabbitMQ community plugins的示例:
$ 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
...
注意:我的头盔版本为v3.1.1
$ helm version
version.BuildInfo{Version:"v3.1.1", GitCommit:"afe70585407b420d0097d07b21c47dc511525ac8", GitTreeState:"clean", GoVersion:"go1.13.8"}
答案 1 :(得分:2)
不再需要构建自定义图表,我用这个 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
答案 2 :(得分:0)
我认为rabbitmq-ha
的默认头盔图使用官方的RabbitMQ图像,因此它仅包含core plugins。
我检查了chart config,它只设置了/etc/rabbitmq/enabled_plugins
conf文件,将不会自动下载插件文件。
有两种解决方案:
rabbitmq_delayed_message_exchange
文件。extraInitContainers