crowbar/crowbar-ha

View on GitHub
chef/cookbooks/corosync/templates/default/corosync.conf.v2.erb

Summary

Maintainability
Test Coverage
# DO NOT EDIT!

# This file is automatically configured via Chef on <%= node["fqdn"] %>

# Please read the corosync.conf.5 manual page
totem {
    version: 2

    cluster_name: <%= @cluster_name %>

    # crypto_cipher and crypto_hash: Used for mutual node authentication.
    # If you choose to enable this, then do remember to create a shared
    # secret with "corosync-keygen".
    # enabling crypto_cipher, requires also enabling of crypto_hash.
    crypto_cipher: aes256
    crypto_hash: sha1

    # How long before declaring a token lost (ms)
    token:          5000

    # How many token retransmits before forming a new configuration
    token_retransmits_before_loss_const: 10

    # How long to wait for join messages in the membership protocol (ms)
    join:           60

    # How long to wait for consensus to be achieved before starting
    # a new round of membership configuration (ms)
    consensus:      6000

    # Turn off the virtual synchrony filter
    vsftype:        none

    # Number of messages that may be sent by one processor on
    # receipt of the token
    max_messages:   20

    # Limit generated nodeids to 31-bits (positive signed integers)
    # you would set it to 'yes', the new option 'new' means wiping 
    # off the highest bit in network order to avoid possible nodeid
    # conflicting.
    clear_node_high_bit: yes

    # interface: define at least one interface to communicate
    # over. If you define more than one interface stanza, you must
    # also set rrp_mode.
<% if @rings.length > 1 -%>
    rrp_mode: passive
<% end -%>
<% @rings.each.with_index do |ring, ring_index| -%>
    interface {
        # Rings must be consecutively numbered, starting at 0.
        ringnumber: <%= ring_index %>
        # This is normally the *network* address of the
        # interface to bind to. This ensures that you can use
        # identical instances of this configuration file
        # across all your cluster nodes, without having to
        # modify this option.
        bindnetaddr: <%= ring[:bind_addr]  %>
        # However, if you have multiple physical network
        # interfaces configured for the same subnet, then the
        # network address alone is not sufficient to identify
        # the interface Corosync should bind to. In that case,
        # configure the *host* address of the interface
        # instead:
        # bindnetaddr: 192.168.1.1
        # When selecting a multicast address, consider RFC
        # 2365 (which, among other things, specifies that
        # 239.255.x.x addresses are left to the discretion of
        # the network administrator). Do not reuse multicast
        # addresses across multiple Corosync clusters sharing
        # the same network.
<% if @transport == 'udp' -%>
        mcastaddr: <%= ring[:mcast_addr] %>
<% end -%>
        # Corosync uses the port you specify here for UDP
        # messaging, and also the immediately preceding
        # port. Thus if you set this to 5405, Corosync sends
        # messages over UDP ports 5405 and 5404.
        mcastport: <%= ring[:mcast_port] %>
        # Time-to-live for cluster communication packets. The
        # number of hops (routers) that this ring will allow
        # itself to pass. Note that multicast routing must be
        # specifically enabled on most network routers.
        ttl: 1
    }
<% end -%>

    transport: <%= @transport %>
}

logging {
    # Log the source file and line where messages are being
    # generated. When in doubt, leave off. Potentially useful for
    # debugging.
    fileline: off
    # Log to standard error. When in doubt, set to no. Useful when
    # running in the foreground (when invoking "corosync -f")
    to_stderr: no
    # Log to a log file. When set to "no", the "logfile" option
    # must not be set.
    #to_logfile: no
    #logfile: /var/log/cluster/corosync.log
    # Log to the system log daemon. When in doubt, set to yes.
    to_syslog: yes
    # Log debug messages (very verbose). When in doubt, leave off.
    debug: off
    # Log messages with time stamps. When in doubt, set to on
    # (unless you are only logging to syslog, where double
    # timestamps can be annoying).
    timestamp: on
    logger_subsys {
        subsys: QUORUM
        debug: off
    }
}

nodelist {
  <% @members_v2.each do |ring_addrs| -%>
    node {
    <% ring_addrs.each.with_index do |ring_addr, ring_index| -%>
        ring<%= ring_index %>_addr: <%= ring_addr %>
    <% end -%>
    }
  <% end -%>
}

quorum {
    # Enable and configure quorum subsystem (default: off)
    # see also corosync.conf.5 and votequorum.5
    provider: corosync_votequorum
  <% if @members_v2.length <= 2 -%>
    expected_votes: <%= @members_v2.length %>
    <% if @members_v2.length == 2 -%>
    two_node: 1
    <% end -%>
  <% end -%>
}