心跳不工作。端口未开放

心跳不工作。端口未开放

我一直在尝试放置两个带心跳的虚拟机。 osboxes 和 osboxes2。

当我运行时,nmap localhost这是输出:

Nmap scan report for localhost (127.0.0.1)
Host is up (0.00017s latency).
Not shown: 991 closed ports
PORT      STATE SERVICE
22/tcp    open  ssh
25/tcp    open  smtp
53/tcp    open  domain
80/tcp    open  http
443/tcp   open  https
631/tcp   open  ipp
3306/tcp  open  mysql
9050/tcp  open  tor-socks
10000/tcp open  snet-sensor-mgmt

这是此类接口的 tcpdump eth0

18:38:22.267817 IP 192.168.141.135.48748 > 192.168.141.255.694: UDP, length 315
18:38:22.268640 IP 192.168.141.135.38234 > osboxes2.694: UDP, length 315
18:38:22.269421 IP osboxes2 > 192.168.141.135: ICMP osboxes2 udp port 694 unreachable, length 351

如你看到的udp port 694 unreachable。当我尝试osboxes从以下地址进行 ping 操作时osboxes2

PING 192.168.141.137 (192.168.141.137) 56(84) bytes of data.
64 bytes from 192.168.141.137: icmp_seq=1 ttl=64 time=0.284 ms
64 bytes from 192.168.141.137: icmp_seq=2 ttl=64 time=0.291 ms
64 bytes from 192.168.141.137: icmp_seq=3 ttl=64 time=0.681 ms

ha.cf文件来自osboxes

#Arquivo de log de debug:
logfile /var/log/ha-log

#Arquivo de log
debugfile /var/log/ha-debug

#Para onde vai os logs
logfacility local0

#Frequencia em segundo de batimentos cardicados
keepalive 2

#Tempo indica a morte do node
deadtime 25

#Tempo que o heartbeat deve esperar por beats (nao o beat dos beatboxes)
warntime 10

#Tempo maximo para declarar o outro servidor morto
initdead 50

#Porto de sincronia
udpport 694

#Endereco de broadcast da rede
bcast eth0

#Nao entendi. Se for preciso vai la procurar depois.
ucast eth0 192.168.141.137

#Determinar se o servidor volta para o master caso ele responda
auto_failback on

#Nome dos nodes do cluster
node osboxes2
node osboxes

haresourcersosboxes

osboxes 192.168.141.135 apache

值得注意的是osboxes(主节点) 是192.168.141.135osboxes2192.168.141.137

我猜问题出在 ,port 694 not opened因为它是unreachable

答案1

尝试bcast从配置中删除该行(或者只是将其注释掉)。

通过定义ucastbcast您实际上是在告诉 heartbeat 使用两种不同的通信类型(单播和广播),这可能会造成混乱。

linux-ha.org wiki 有一些关于心跳配置的所有可能指令的文档:http://linux-ha.org/wiki/Ha.cf

大多数信息也可以在手册页中找到:# man ha.cf

相关内容