我有两个节点 Nomad 集群和一个 Consul 实例,以便作业可以注册要连接的服务。
但是,这些服务会不断同步和取消注册。这是我从领事日志中得到的:
2021-01-26T14:49:59.174Z [INFO] agent: Synced check: check=_nomad-check-dc23801467b8a65a4fd82311c2606724a180065c
2021-01-26T14:50:00.072Z [INFO] agent: Synced check: check=_nomad-check-1783c554d9ee0a25d52532f4178c392e931e4bb1
2021-01-26T14:50:04.511Z [INFO] agent: Synced service: service=_nomad-task-e8d2b77b-3bf5-96c1-8323-63b6151e2cf3-lb0-lb0-admin-admin
2021-01-26T14:50:09.962Z [INFO] agent: Deregistered service: service=_nomad-task-e8d2b77b-3bf5-96c1-8323-63b6151e2cf3-lb0-lb0-admin-admin
2021-01-26T14:50:34.554Z [INFO] agent: Synced service: service=_nomad-task-e8d2b77b-3bf5-96c1-8323-63b6151e2cf3-lb0-lb0-admin-admin
2021-01-26T14:50:39.984Z [INFO] agent: Deregistered service: service=_nomad-task-e8d2b77b-3bf5-96c1-8323-63b6151e2cf3-lb0-lb0-admin-admin
2021-01-26T14:51:04.589Z [INFO] agent: Synced service: service=_nomad-task-e8d2b77b-3bf5-96c1-8323-63b6151e2cf3-lb0-lb0-admin-admin
2021-01-26T14:51:10.009Z [INFO] agent: Deregistered service: service=_nomad-task-e8d2b77b-3bf5-96c1-8323-63b6151e2cf3-lb0-lb0-admin-admin
两个节点都以相同的配置启动。但是,当我查看TRACE级别的日志时,我有以下内容:
节点A:
2021-01-28T15:58:55.519+0100 [DEBUG] consul.sync: sync complete: registered_services=3 deregistered_services=1 registered_checks=0 deregistered_checks=0
节点B:
2021-01-28T15:58:59.037+0100 [DEBUG] consul.sync: sync complete: registered_services=1 deregistered_services=3 registered_checks=0 deregistered_checks=0
事实上,NodeA运行了 3 个作业,而NodeB运行了 1 个作业。似乎两个节点都在恢复另一个节点所做的更改。
Name Address Port Status Leader Protocol Build Datacenter Region
NodeA 198.51.100.1 4648 alive false 2 1.0.2 us1 us
NodeB 198.51.100.2 4648 alive true 2 1.0.2 us1 us
我是否错过了配置中的某些内容?如何防止这种情况?
这种行为实际上显示在文档中。我只是忽略了它: