Installing Clever cluster - raw instructions

From PlcWiki

Revision as of 15:46, 5 February 2013 by Jan (Talk | contribs)
Jump to: navigation, search
chkconfig iptables off
sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config
sed -i 's/^NM_CONTROLLED=.*$/NM_CONTROLLED="no"/' /etc/sysconfig/network-scripts/ifcfg-eth0
copykey 172.100.100.2 root

############## NETWORK #####################

/etc/modprobe.d/bond0.conf :
alias bond0 bonding

/etc/sysconfig/network-scripts/ifcfg-bond0 :
DEVICE="bond0"
BOOTPROTO="none"
NM_CONTROLLED="no"
ONBOOT="yes"
USERCTL=no
BONDING_OPTS="miimon=100 mode=0"
#MTU=9000
BROADCAST="172.100.100.255"
IPADDR="172.100.100.1"
NETMASK="255.255.255.0"

/etc/sysconfig/network-scripts/ifcfg-eth1 :
UUID="5dc100ad-e64f-4f60-b7c5-92f038d55a9c"
HWADDR="6C:AE:8B:24:0F:93"
DEVICE="eth1"
BOOTPROTO="none"
NM_CONTROLLED="no"
ONBOOT="yes"
MASTER=bond0
SLAVE=yes
USERCTL=no

yum install bridge-utils

/etc/sysconfig/network-scripts/ifcfg-br0 :
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
ONBOOT=yes
BROADCAST="10.5.1.255"
DNS1="10.5.1.12"
GATEWAY="10.5.1.241"
IPADDR="10.5.1.97"
NETMASK="255.255.255.0"
NM_CONTROLLED=no
IPV6INIT=no
USERCTL=no

/etc/sysconfig/network-scripts/ifcfg-eth0 :
UUID="cbef3b16-05c7-4b10-8007-c576654d49a7"
HWADDR="6C:AE:8B:24:0F:92"
DEVICE="eth0"
TYPE="Ethernet"
BRIDGE=br0
ONBOOT="yes"
NM_CONTROLLED="no"

ifdown eth0; ifup eth0; ifup br0

############## LVM #####################
create primary partition LVM (8E)
reread partition table: partx -a /dev/sda; partx -a /dev/sda
create physical volume: pvcreate /dev/sda3
add to volume group: vgextend vg_pollux /dev/sda3 (the name of volume group: vgdisplay)

############## DRBD #####################

rpm -Uvh http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm
yum install kmod-drbd84
yum install drbd84-utils

# Bacha na fstab !

/etc/drbd.d/clever.res :
resource clever {
  device    /dev/drbd1;
  disk      /dev/mapper/vg_saszwiplckc1-lv_drbd;
  meta-disk internal;
  startup {
    # become-primary-on plczwicl01.crossen.sas-automotive.com;
  }
  on plczwicl01.crossen.sas-automotive.com {
    address   172.100.100.1:7789;
  }
  on plczwicl02.crossen.sas-automotive.com {
    address   172.100.100.2:7789;
  }
  net {
    protocol A;
#    on-congestion pull-ahead;
#    congestion-fill 10M;
#    congestion-extents 2000;
    after-sb-0pri discard-zero-changes;
    after-sb-1pri discard-secondary;
    after-sb-2pri disconnect;
    verify-alg crc32c;
    csums-alg crc32c;
    data-integrity-alg crc32c;
  }
}

drbdadm create-md clever
drbdadm primary --force all
drbd-overview
mkfs.ext4 /dev/drbd1

/etc/fstab :
/dev/drbd1              /opt                    ext4    defaults,_netdev        0 0

mount /opt

############## KVM #####################

yum install kvm
yum install virt-manager libvirt libvirt-python python-virtinst
yum install avahi

/etc/init.d/messagebus restart
/etc/init.d/avahi-daemon restart

modprobe kvm
modprobe kvm-intel
/etc/init.d/libvirtd start
yum install xauth
yum install xorg-x11-fonts-misc dejavu-sans-fonts

mkdir -p /opt/libvirt/var
mv /var/lib/libvirt /opt/libvirt/
mv /opt/libvirt/libvirt /opt/libvirt/var
ln -s /opt/libvirt/var /var/lib/libvirt

mkdir -p /opt/libvirt/etc
mv /etc/libvirt /opt/libvirt/
mv /opt/libvirt/libvirt /opt/libvirt/etc
ln -s /opt/libvirt/etc /etc/libvirt

virt-manager

chkconfig libvirtd off
chkconfig drbd on


############## Cluster #####################

yum install mailx ntp
chkconfig ntp on
yum install pacemaker

/etc/corosync/corosync.conf :
# Please read the corosync.conf.5 manual page
compatibility: whitetank

totem {
        version: 2
        secauth: off
        threads: 0
        interface {
                ringnumber: 0
                bindnetaddr: 172.100.100.0
                mcastaddr: 226.94.1.1
                mcastport: 4000
                ttl: 1
        }
}

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

amf {
        mode: disabled
}

aisexec {
        user: root
        group: root
}

service {
# Load the Pacemaker Cluster Resource Manager
        name: pacemaker
        ver: 1
}

chown -R hacluster.haclient /var/log/cluster

chkconfig pacemaker on
chkconfig corosync on

scp /etc/init.d/clevervm

service iptables stop
chkconfig iptables off
crm configure save /tmp/cluster.crm
mcedit /tmp/cluster.crm # Bacha na drbd resource !

service corosync start
service pacemaker start


crm configure load replace /tmp/cluster.crm

/etc/aliases :
root:		plc.emergency@clever.cz,Joerg.Martin@sas-automotive.com

newaliases

/etc/postfix/main.cf :
relayhost = [sasexrel.sas-automotive.com]

http://plcwiki.clever.cz/index.php/Cluster_MBA7


Resize virtual drive:

On host:

qemu-img resize plczwikrnl.img +10G

On guest:

reboot
fdisk (new partition /dev/vda3)
partx -a /dev/vda
partx -a /dev/vda
pvcreate /dev/vda3
vgextend vg_plczwinkrnl /dev/vda3
lvextend /dev/vg_plczwinkrnl/lv_root -l +100%FREE
resize2fs -p /dev/mapper/vg_plczwinkrnl-lv_root
Personal tools