kubernetes中rabbitmq的高级配置的困难

06odsfpq  于 2022-11-08  发布在  RabbitMQ
关注(0)|答案(1)|浏览(201)

我正在使用kubernetes操作符https://www.rabbitmq.com/kubernetes/operator/operator-overview.html来部署rabbitmq,但是我在高级配置方面遇到了一些问题。我确实参考了https://github.com/rabbitmq/rabbitmq-server/blob/master/deps/rabbit/docs/advanced.config.example,但是我不确定我遗漏了什么
我有这样一张收据:

---
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
 name: mybunny
spec:
 replicas: 3
 image: rabbitmq:3.10
 rabbitmq:
   advancedConfig: |
     [
      {rabbit,
       [
        {vm_memory_high_watermark, 0.75},
        {disk_free_limit, {mem_relative, 1.0}}
       ]}
     [
      {kernel, []},
     ].

我认为它生成了我想要的高级.config文件:

$ kubectl exec mybunny-server-2 -it -- cat /etc/rabbitmq/advanced.config
Defaulted container "rabbitmq" out of: rabbitmq, setup-container (init)
[
{rabbit,
 [
  {vm_memory_high_watermark, 0.75},
  {disk_free_limit, {mem_relative, 1.0}}
 ]},
{kernel, []},
].

然而,应用程序总是无法加载,我不知道语法错误在哪里

kubectl logs mybunny-server-2                                          
2022-07-19 20:23:25.723748+00:00 [warning] <0.130.0> cluster_formation.randomized_startup_delay_range.min and clus
ter_formation.randomized_startup_delay_range.max are deprecated
2022-07-19 20:23:25.732008+00:00 [error] <0.130.0> Failed to load advanced configuration file "/etc/rabbitmq/advan
ced.config": unknown POSIX error

BOOT FAILED
===========
Error during startup: {error,failed_to_read_advanced_configuration_file}

2022-07-19 20:23:25.732677+00:00 [error] <0.130.0>  
2022-07-19 20:23:25.732677+00:00 [error] <0.130.0> BOOT FAILED
2022-07-19 20:23:25.732677+00:00 [error] <0.130.0> ===========
2022-07-19 20:23:25.732677+00:00 [error] <0.130.0> Error during startup: {error,failed_to_read_advanced_configurat
ion_file}
2022-07-19 20:23:25.732677+00:00 [error] <0.130.0>  
2022-07-19 20:23:26.734535+00:00 [error] <0.130.0>     supervisor: {local,rabbit_prelaunch_sup}
2022-07-19 20:23:26.734535+00:00 [error] <0.130.0>     errorContext: start_error
2022-07-19 20:23:26.734535+00:00 [error] <0.130.0>     reason: failed_to_read_advanced_configuration_file

=======================
如果我保持高级配置非常简单,应用程序加载良好

cat mybunny.yaml  
---
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
 name: mybunny
spec:
 replicas: 3
 image: rabbitmq:3.10
 rabbitmq:
   advancedConfig: |
     [
      {rabbit,
       [
        {vm_memory_high_watermark, 0.75},
        {disk_free_limit, {mem_relative, 1.0}}
       ]}
     ].

$ kubectl exec mybunny-server-2 -it -- cat /etc/rabbitmq/advanced.config
Defaulted container "rabbitmq" out of: rabbitmq, setup-container (init)
[
{rabbit,
 [
  {vm_memory_high_watermark, 0.75},
  {disk_free_limit, {mem_relative, 1.0}}
 ]}
].

上面的加载很好,请注意我没有在高级配置中输入“内核”特性

jaql4c8m

jaql4c8m1#

您的YAML文件advancedConfig中有几处打字错误:

[
      {rabbit,
       [
        {vm_memory_high_watermark, 0.75},
        {disk_free_limit, {mem_relative, 1.0}}
       ]} # a comma (,) is missing here 
     [  # It shouldn't be here.  
      {kernel, []}, # No need to put comma after the last {} part. 
     ].

修正YAML:
第一个

相关问题