云服务器上的 Corosync

云服务器上的 Corosync

我在云上有两个 Oracle Linux 7 服务器,我想使用 Corosync。服务器位于同一个云网络(不是 LAN)上,但它们只有一个网卡。以下是配置文件。

服务器 A:

totem {
        version: 2

        secauth: off
        transport: udpu

        crypto_cipher: none
        crypto_hash: none

        interface {
                member {
                        memberaddr: x.y.z.i
                }
                member {
                        memberaddr: x.y.z.j
                }
                ringnumber: 0
                bindnetaddr: x.y.z.i
                mcastport: 5405
                ttl: 1
        }
}

logging {
        fileline: off
        to_stderr: no
        to_logfile: yes
        logfile: /var/log/cluster/corosync.log
        to_syslog: yes
        debug: off
        timestamp: on
        logger_subsys {
                subsys: QUORUM
                debug: off
        }
}

quorum {
        #provider: corosync_votequorum
}

服务器B:

totem {
        version: 2

        secauth: off
        transport: udpu

        crypto_cipher: none
        crypto_hash: none

        interface {
                member {
                        memberaddr: x.y.z.i
                }
                member {
                        memberaddr: x.y.z.j
                }
                ringnumber: 0
                bindnetaddr: x.y.z.j
                mcastport: 5405
                ttl: 1
        }
}

logging {
        fileline: off
        to_stderr: no
        to_logfile: yes
        logfile: /var/log/cluster/corosync.log
        to_syslog: yes
        debug: off
        timestamp: on
        logger_subsys {
                subsys: QUORUM
                debug: off
        }
}

quorum {
        #provider: corosync_votequorum
}

当我在两台服务器上启动 Corosync 服务时,我发现它们并没有互相连接,但是在服务器 A 的日志中每两秒钟就会出现一次重复的日志条目:

Jun 08 04:22:48 [17856] serverA corosync notice  [TOTEM ] A new membership (x.y.z.i:20544) was formed. Members
Jun 08 04:22:48 [17856] serverA corosync notice  [MAIN  ] Completed service synchronization, ready to provide service.
Jun 08 04:22:49 [17856] serverA corosync notice  [TOTEM ] A new membership (x.y.z.i:20548) was formed. Members
Jun 08 04:22:49 [17856] serverA corosync notice  [MAIN  ] Completed service synchronization, ready to provide service.
Jun 08 04:22:50 [17856] serverA corosync notice  [TOTEM ] A new membership (x.y.z.i:20552) was formed. Members
Jun 08 04:22:50 [17856] serverA corosync notice  [MAIN  ] Completed service synchronization, ready to provide service.
Jun 08 04:22:52 [17856] serverA corosync notice  [TOTEM ] A new membership (x.y.z.i:20556) was formed. Members
Jun 08 04:22:52 [17856] serverA corosync notice  [MAIN  ] Completed service synchronization, ready to provide service.
Jun 08 04:22:53 [17856] serverA corosync notice  [TOTEM ] A new membership (x.y.z.i:20560) was formed. Members
Jun 08 04:22:53 [17856] serverA corosync notice  [MAIN  ] Completed service synchronization, ready to provide service.
Jun 08 04:22:55 [17856] serverA corosync notice  [TOTEM ] A new membership (x.y.z.i:20564) was formed. Members
Jun 08 04:22:55 [17856] serverA corosync notice  [MAIN  ] Completed service synchronization, ready to provide service.

以下是“corosync-cmapctl |grep member”的输出:

服务器 A:

runtime.totem.pg.mrp.srp.members.1489420110.config_version (u64) = 0
runtime.totem.pg.mrp.srp.members.1489420110.ip (str) = r(0) ip(x.y.z.i)
runtime.totem.pg.mrp.srp.members.1489420110.join_count (u32) = 1
runtime.totem.pg.mrp.srp.members.1489420110.status (str) = joined
totem.interface.0.member.0 (str) = x.y.z.j
totem.interface.0.member.1 (str) = x.y.z.i

服务器B:

runtime.totem.pg.mrp.srp.members.1489420107.config_version (u64) = 0
runtime.totem.pg.mrp.srp.members.1489420107.ip (str) = r(0) ip(x.y.z.j)
runtime.totem.pg.mrp.srp.members.1489420107.join_count (u32) = 1
runtime.totem.pg.mrp.srp.members.1489420107.status (str) = joined
totem.interface.0.member.0 (str) = x.y.z.j
totem.interface.0.member.1 (str) = x.y.z.i

我究竟做错了什么?

答案1

您必须使用私有 IP,而不是公共 IP

答案2

corosync 使用多播网络通信,但这种通信被一些云提供商阻止,AWS 就是其中之一。

http://aws.amazon.com/vpc/faqs/

问:Amazon VPC 是否支持多播或广播?

相关内容