我尝试使用RabbitMQ Cluster Operator在Minikube上设置RabbitMQ:
当我尝试连接持久卷时,出现以下错误:
$ kubectl logs -f rabbitmq-rabbitmq-server-0
Configuring logger redirection
20:04:40.081 [warning] Failed to write PID file "/var/lib/rabbitmq/mnesia/rabbit@rabbitmq-rabbitmq-server-0.rabbitmq-rabbitmq-headless.default.pid": permission denied
20:04:40.264 [error] Failed to create Ra data directory at '/var/lib/rabbitmq/mnesia/rabbit@rabbitmq-rabbitmq-server-0.rabbitmq-rabbitmq-headless.default/quorum/rabbit@rabbitmq-rabbitmq-server-0.rabbitmq-rabbitmq-headless.default', file system operation error: enoent
20:04:40.265 [error] Supervisor ra_sup had child ra_system_sup started with ra_system_sup:start_link() at undefined exit with reason {error,"Ra could not create its data directory. See the log for details."} in context start_error
20:04:40.266 [error] CRASH REPORT Process <0.247.0> with 0 neighbours exited with reason: {error,"Ra could not create its data directory. See the log for details."} in ra_system_sup:init/1 line 43
20:04:40.267 [error] CRASH REPORT Process <0.241.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,ra_system_sup,{error,"Ra could not create its data directory. See the log for details."}}},{ra_app,start,[normal,[]]}} in application_master:init/4 line 138
{"Kernel pid terminated",application_controller,"{application_start_failure,ra,{{shutdown,{failed_to_start_child,ra_system_sup,{error,\"Ra could not create its data directory. See the log for details.\"}}},{ra_app,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,ra,{{shutdown,{failed_to_start_child,ra_system_sup,{error,"Ra could not create its data directory. See the log for details."}
Crash dump is being written to: erl_crash.dump...
问题是RabbitMQ由于缺乏权限而无法在数据目录/var/lib/rabbitmq/mnesia
中设置其数据文件。
我最初的猜测是,我需要将数据目录指定为volumeMount,但根据documentation,这似乎是不可配置的。
RabbitMQ关于持久性的troubleshooting文档会导致404。
我试着在网上找到其他有同样问题的资源,但是没有一个使用RabbitMQ Cluster Operator。如果我不能找到解决方案,我打算沿着这条路走,但是我真的很想以某种方式解决这个问题。
有人有什么想法吗?
我的设置如下:
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
name: rabbitmq
spec:
replicas: 1
service:
type: NodePort
persistence:
storageClassName: local-storage
storage: 20Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: rabbitmq-pvc
spec:
storageClassName: local-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: rabbitmq-pv
spec:
storageClassName: local-storage
accessModes:
- ReadWriteOnce
capacity:
storage: 20Gi
hostPath:
path: /mnt/app/rabbitmq
type: DirectoryOrCreate
要在minikube上重现此问题,请执行以下操作:
1.安装rabbitmq操作符:
kubectl apply -f "https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml"
1.应用上面的清单文件
kubectl apply -f rabbitmq.yml
1.运行kubectl get po
将显示名为rabbitmq-rabbitmq-server-0
的窗格。
1.运行kubectl logs -f rabbitmq-rabbitmq-server-0
查看日志时会显示上述错误。
4条答案
按热度按时间vjhs03f71#
正如我在评论中所建议的,您可以通过运行以下命令来解决该问题:
回答您的问题:
有没有方法可以将它添加到我的清单文件中,而不必手动添加?
您可以覆盖rabbitmq statefulset清单字段,将initContainer命令脚本中的最后一行从
chgrp 999 /var/lib/rabbitmq/mnesia/
更改为:chown 999:999 /var/lib/rabbitmq/mnesia/
.完整的RabbitmqCluster yaml清单如下所示:
sd2nnvve2#
我在Vagrant内部的kubernetes中部署RabbitMQ时遇到了同样的问题(虽然不是minikube)。我用的是this安装程序。我试着运行
sudo chmod g+w /mnt/app/rabbitmq/
,但是没有运气...最终放弃了,最后用this box在vagrant里面运行minikube,一切都运行得很好!不需要做任何特殊的事情...不是手动创建持久卷...在我的节点中
slsn1g293#
我在一个实时版本中遇到了这个问题,minikube不允许运行SSH命令,所以我所做的是运行chmod到我的主机路径配置程序,并重新创建我的rabbitmq-cluster
thigvfpy4#
我找到了这个问题的答案。当集群中的节点很少时会发生这个问题。解决方法是添加
securityContext: {}
https://github.com/rabbitmq/rabbitmq-website/blob/3ee8e72a7c4fe52e323ba1039eecbf3a67c554f7/site/kubernetes/operator/using-on-openshift.md#arbitrary-user-ids