Corosync

雲伺服器上的 Corosync

  • June 9, 2015

我在雲上有兩台 Oracle Linux 7 伺服器,我想使用 Corosync。伺服器在同一個云網路(不是區域網路)上,但它們只有一個網卡。這是conf文件。

伺服器 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

我究竟做錯了什麼?

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

corosync 使用被某些雲提供商阻止的多播網路通信,AWS 就是其中之一。

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

問:Amazon VPC 是否支持多播或廣播?

引用自:https://serverfault.com/questions/697325