transport This directive controls the transport mechanism used. If the inter- face to which corosync is binding is an RDMA interface such as RoCEE or Infiniband, the "iba" parameter may be specified. To avoid the use of multicast entirely, a unicast transport parameter "udpu" can be specified. This requires specifying the list of members that could potentially make up the membership before deployment. The default is udp. The transport type can also be set to udpu or iba. Within the totem directive, there are several configuration options which are used to control the operation of the protocol. It is gen- erally not recommended to change any of these values without proper guidance and sufficient testing. Some networks may require larger values if suffering from frequent reconfigurations. Some applica- tions may require faster failure detection times which can be achieved by reducing the token timeout.
AI 代码解读
我们在使用RHCS做集群时, 心跳包默认是通过多播发送的, 多播地址是通过集群ID来计算的.
如果你的环境不支持多播(udp), 那么可以选择广播(udpb)或单播(udpu), 或者你有infiniband设备的话, 可以选择(rdma)
配置可参考 :
/usr/share/cluster/cluster.rng
AI 代码解读
非常详细.
例如, 默认是多播的. 我们在启动CMAN服务后, 可以看到多播地址以及监听端口.
同时我们可以使用TCPDUMP观察到心跳包是通过多播来发送的.
如果要改成单播, 需要改cman, 添加一个参数transport, 使用udpu的值. 注意不要忘记改配置的版本号.
重启cman服务后, 可以看到没有多播的监听地址了, 现在使用了单播监听UDP, 端口也变了.
观测不到多播包.
可以看到心跳包走单播了
[参考]
# netstat -anp|grep corosync udp 0 0 10.10.10.154:5404 0.0.0.0:* 11937/corosync udp 0 0 10.10.10.154:5405 0.0.0.0:* 11937/corosync udp 0 0 239.192.70.113:5405 0.0.0.0:* 11937/corosync
AI 代码解读
同时我们可以使用TCPDUMP观察到心跳包是通过多播来发送的.
# tcpdump -i eth0 'ip[16] >=224' tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 15:01:24.609140 IP 10.10.10.154.hpoms-dps-lstn > 239.192.70.113.netsupport: UDP, length 119 15:01:26.512234 IP 10.10.10.154.hpoms-dps-lstn > 239.192.70.113.netsupport: UDP, length 119 15:01:28.415854 IP 10.10.10.154.hpoms-dps-lstn > 239.192.70.113.netsupport: UDP, length 119
AI 代码解读
如果要改成单播, 需要改cman, 添加一个参数transport, 使用udpu的值. 注意不要忘记改配置的版本号.
# vi /etc/cluster/cluster.conf <cluster config_version="23" name="digoal_pg001"> <cman expected_votes="1" two_node="1" transport="udpu"/>
AI 代码解读
重启cman服务后, 可以看到没有多播的监听地址了, 现在使用了单播监听UDP, 端口也变了.
# netstat -anp|grep corosync udp 0 0 10.10.10.154:5405 0.0.0.0:* 16222/corosync udp 0 0 10.10.10.154:46015 0.0.0.0:* 16222/corosync udp 0 0 10.10.10.154:9318 0.0.0.0:* 16222/corosync
AI 代码解读
观测不到多播包.
# tcpdump -i eth0 'ip[16] >=224'
AI 代码解读
可以看到心跳包走单播了
# tcpdump -i eth0 |grep 10.10.10.221 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 15:22:38.731769 IP 10.10.10.154.netsupport > 10.10.10.221.netsupport: UDP, length 107 15:22:38.732357 IP 10.10.10.221.netsupport > 10.10.10.154.netsupport: UDP, length 107 15:22:38.941722 IP 10.10.10.154.secure-ts > 10.10.10.221.netsupport: UDP, length 119 15:22:40.636224 IP 10.10.10.154.netsupport > 10.10.10.221.netsupport: UDP, length 107 15:22:40.636911 IP 10.10.10.221.netsupport > 10.10.10.154.netsupport: UDP, length 107 15:22:40.846299 IP 10.10.10.154.secure-ts > 10.10.10.221.netsupport: UDP, length 119 15:22:42.540841 IP 10.10.10.154.netsupport > 10.10.10.221.netsupport: UDP, length 107 15:22:42.541616 IP 10.10.10.221.netsupport > 10.10.10.154.netsupport: UDP, length 107 15:22:42.750954 IP 10.10.10.154.secure-ts > 10.10.10.221.netsupport: UDP, length 119
AI 代码解读
[参考]
1. /usr/share/cluster/cluster.rng
2. man corosync.conf
<optional> <attribute name="transport" rha:description="Specifies transport mechanism to use. Available values are udp (multicast default), udpb (broadcast), udpu (unicast) and rdma (Infiniband). corosync.conf(5)" rha:sample=""> <choice> <value>udp</value> <value>udpb</value> <value>udpu</value> <value>rdma</value> </choice> </attribute> </optional>
AI 代码解读
2. man corosync.conf