Corosync cluster resource manager

Aus xinux.net
Zur Navigation springen Zur Suche springen

Ziel

Eine Ha Firewall & VPN-Gateway

Voraussetzungen

  • 3 frisch aufgesetzte Systeme
  • Gleiches Betriebsystem
  • Jeweils 2 Netzwerkschnittstellen
    • Eine im LAN
    • Eine direktverbindung zwischen beiden Nodes
    • Eine ins Internet

Nodes

Node: worf

eth0 = LAN = 192.168.255.250/24 eth1 = PPPoE = 87.128.42.65 eth2 = HA-Port = 10.11.154.1/24

Node: kurn

eth0 = LAN = 192.168.255.251/24 eth1 = PPPoE = 87.128.42.65 eth2 = HA-Port = 10.11.154.1/24

Konfiguration der Nodes

Netzwerk

  • die interfaces konfigurieren
  • auf beiden seiten ähnlich lediglich die ip für lan und Ha muss angepasst werden
vi /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static 
 address 192.168.255.251
 netmask 255.255.255.0 
 up ip route add 192.168.240.0/24 via 192.168.255.1
iface dsl-provider inet ppp
pre-up /bin/ip link set eth1 up # line maintained by pppoeconf
pre-up /sbin/ifconfig eth1 up
provider dsl-provider

auto eth2
iface eth2 inet static
 address 192.168.155.251
 netmask 255.255.255.0

auto eth1
iface eth1 inet manual

Namensauflösung

die datei ist auf beiden seiten gleich vi /etc/hosts 127.0.0.1 localhost 192.168.155.250 worf.xinux.org worf 192.168.155.251 kurn.xinux.org kurn

Software installiern

  • auf beiden seiten die benötigten packete installieren
apt-get update
apt-get upgrade
apt-get install -y corosync pacemaker strongswan pppoe

corosync kofigurieren

  • jetzt müssen wir die notes zu einem Cluster verbinden

corosync.conf

  • die corosync.conf anpassen
vi /etc/corosync/corosync.conf
totem {
    version: 2
    cluster_name: debian
    secauth: off
    transport:udpu
    interface {
        ringnumber: 0
        bindnetaddr: 192.168.155.0
        broadcast: yes
        mcastport: 5405
    }
}

nodelist {
    node {
        ring0_addr: 192.168.155.250
        name: worf
        nodeid: 1
    }

    node {
        ring0_addr: 192.168.155.251
        name: kurn
        nodeid: 2
    }
}


quorum {
    provider: corosync_votequorum
    two_node: 1
    wait_for_all: 1
    last_man_standing: 1
    auto_tie_breaker: 0
}

cluster konfiguriern

  • hier werden resourcen & verhalten des clusters definiert
crm configure editproperty
node 1: worf
node 2: kurn
        cib-bootstrap-options: \
        have-watchdog=false \
        dc-version=1.1.14-70404b0 \
        cluster-infrastructure=corosync \
        cluster-name=debian \
        stonith-enabled=false 
        no-quorum-policy=ignore

arbeiten mit resourcen

resourcen algemein

  • alles was von corosync verwaltet werden soll legen wir mir resourcen fest
  • eine Ressource muss zwingend start,stop und status/monitor beherrschen wobei 0 als erfolg gilt und 1-9 verschieden fehler ausgeben
  • vordefinierte resourcen liegen unter
/usr/lib/ocf/resource.d/heartbeat
  • eigene resourcen werden abgelegt unter
/etc/init.d

Komandos

resourcen erstellen