只需确保更改心跳配置中的多播地址和/或端口,这样两个节点就不会尝试发送心跳。
heartbeat {
mode multicast # Send heartbeats using Multicast
address 239.1.99.2 # multicast address
port 9918 # multicast port
interval 150 # Number of milliseconds between heartbeats
timeout 10 # Number of heartbeat intervals to wait
# before timing out a node
}
或者,您也可以切换到模式网格,并且网格中只有节点本身。请参阅地址端口列表:
heartbeat {
mode mesh # Send heartbeats using Mesh (Unicast) protocol
port 3002 # port on which this node is listening to
# heartbeat
mesh-seed-address-port 192.168.1.100 3002 # IP address for seed node in the cluster
# This IP happens to be the local node
interval 150 # Number of milliseconds between heartbeats
timeout 10 # Number of heartbeat intervals to wait before
# timing out a node
}