我想在游牧集群中创建一个 rabbitmq 集群。现在我可以运行 rabbitmq docker 容器,但我无法创建基于 consul 发现的集群。containters 启动后,我在每个节点上都得到了这个消息:
[warning] <0.229.0> Could not auto-cluster with node [email protected]: {badrpc,nodedown}
[warning] <0.229.0> Could not auto-cluster with node rabbit@test-nomad1: {badrpc,nodedown}
[warning] <0.229.0> Could not auto-cluster with node rabbit@test-nomad2: {badrpc,nodedown}
[warning] <0.229.0> Could not auto-cluster with node rabbit@test-nomad3: {badrpc,nodedown}
我的问题在哪里?我在想也许需要先启动一个节点,然后我添加了一个带有 prestart 的容器,但这对我没有帮助。我的游牧工作:
job "test" {
datacenters = ["dc1"]
group "test-group" {
count = 4
update {
max_parallel = 1
}
migrate {
max_parallel = 1
health_check = "checks"
min_healthy_time = "30s"
healthy_deadline = "60s"
}
task "rabbit" {
driver = "docker"
config {
image = "<my_registry>/rabbitmq:consul"
force_pull = true
hostname = "${attr.unique.hostname}"
port_map {
amqp = 5672
ui = 15672
discovery = 4369
clustering = 25672
}
auth {
server_address = "<my_registry>"
username = "user"
password = "pass"
}
}
env {
RABBITMQ_ERLANG_COOKIE = "RabbitMQ"
RABBITMQ_DEFAULT_USER = "test"
RABBITMQ_DEFAULT_PASS = "test"
CONSUL_HOST = "10.14.1.109"
CONSUL_SVC_PORT = "${NOMAD_HOST_PORT_amqp}"
CONSUL_SVC_TAGS = "amqp"
}
resources {
network {
port "amqp" { static = 5672 }
port "ui" { static = 15672 }
port "discovery" { static = 4369 }
port "clustering" { static = 25672 }
}
}
service {
name = "rabbitmq"
port = "ui"
tags = ["management", "http"]
}
}
}
}
兔子配置:
loopback_users.guest = false
listeners.tcp.default = 5672
hipe_compile = false
management.listener.port = 15672
management.listener.ssl = false
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_consul
cluster_formation.consul.acl_token = <my_token>
cluster_formation.consul.host = 10.14.1.109
cluster_formation.consul.svc_addr_auto = true
cluster_formation.consul.svc_addr_use_nodename = false
在领事服务中,我看到了兔子 感谢您的帮助!