gpt4 book ai didi

kubernetes - 如何使用 Helm 将额外配置传递给 RabbitMQ?

转载 作者:行者123 更新时间:2023-12-02 11:37:00 24 4
gpt4 key购买 nike

我正在使用此图表:https://github.com/helm/charts/tree/master/stable/rabbitmq在 Kubernetes 上部署 3 个 RabbitMQ 节点的集群。我的目的是将所有队列镜像到集群中的 2 个节点内。

这是我用来运行 Helm 的命令:helm install --name rabbitmq-local -f rabbitmq-values.yaml stable/rabbitmq
这是rabbitmq-values.yaml的内容:

persistence:
enabled: true

resources:
requests:
memory: 256Mi
cpu: 100m

replicas: 3

rabbitmq:
extraConfiguration: |-
{
"policies": [
{
"name": "queue-mirroring-exactly-two",
"pattern": "^ha\.",
"vhost": "/",
"definition": {
"ha-mode": "exactly",
"ha-params": 2
}
}
]
}

然而,节点由于一些解析错误而无法启动,并且它们停留在崩溃循环中。这是 kubectl logs rabbitmq-local-0 的输出:
BOOT FAILED
===========

Config file generation failed:
=CRASH REPORT==== 23-Jul-2019::15:32:52.880991 ===
crasher:
initial call: lager_handler_watcher:init/1
pid: <0.95.0>
registered_name: []
exception exit: noproc
in function gen:do_for_proc/2 (gen.erl, line 228)
in call from gen_event:rpc/2 (gen_event.erl, line 239)
in call from lager_handler_watcher:install_handler2/3 (src/lager_handler_watcher.erl, line 117)
in call from lager_handler_watcher:init/1 (src/lager_handler_watcher.erl, line 51)
in call from gen_server:init_it/2 (gen_server.erl, line 374)
in call from gen_server:init_it/6 (gen_server.erl, line 342)
ancestors: [lager_handler_watcher_sup,lager_sup,<0.87.0>]
message_queue_len: 0
messages: []
links: [<0.90.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 610
stack_size: 27
reductions: 228
neighbours:

15:32:53.679 [error] Syntax error in /opt/bitnami/rabbitmq/etc/rabbitmq/rabbitmq.conf after line 14 column 1, parsing incomplete
=SUPERVISOR REPORT==== 23-Jul-2019::15:32:53.681369 ===
supervisor: {local,gr_counter_sup}
errorContext: child_terminated
reason: killed
offender: [{pid,<0.97.0>},
{id,gr_lager_default_tracer_counters},
{mfargs,{gr_counter,start_link,
[gr_lager_default_tracer_counters]}},
{restart_type,transient},
{shutdown,brutal_kill},
{child_type,worker}]
=SUPERVISOR REPORT==== 23-Jul-2019::15:32:53.681514 ===
supervisor: {local,gr_param_sup}
errorContext: child_terminated
reason: killed
offender: [{pid,<0.96.0>},
{id,gr_lager_default_tracer_params},
{mfargs,{gr_param,start_link,[gr_lager_default_tracer_params]}},
{restart_type,transient},
{shutdown,brutal_kill},
{child_type,worker}]

如果我删除 rabbitmq.extraConfiguration部分,节点正常启动,所以我在策略中输入的方式一定有问题。知道我做错了什么吗?

谢谢你。

最佳答案

根据https://github.com/helm/charts/tree/master/stable/rabbitmq#load-definitions , 可以链接 JSON配置为 extraConfiguration .所以我们最终得到了这个有效的设置:

rabbitmq-values.yaml:

rabbitmq:
loadDefinition:
enabled: true
secretName: rabbitmq-load-definition
extraConfiguration:
management.load_definitions = /app/load_definition.json

rabbitmq-secret.yaml:
apiVersion: v1
kind: Secret
metadata:
name: rabbitmq-load-definition
type: Opaque
stringData:
load_definition.json: |-
{
"vhosts": [
{
"name": "/"
}
],
"policies": [
{
"name": "queue-mirroring-exactly-two",
"pattern": "^ha\.",
"vhost": "/",
"definition": {
"ha-mode": "exactly",
"ha-params": 2
}
}
]
}

必须在播放 Helm 图表之前将 key 加载到 Kubernetes 中,内容如下: kubectl apply -f ./rabbitmq-secret.yaml .

关于kubernetes - 如何使用 Helm 将额外配置传递给 RabbitMQ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57167989/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com