Welcome

If you are not a member please register

You need to REGISTER » if you would like to post in our forums.

SysAdmin Forum
(#1)
Old
root's Avatar
root root is offline
Administrator
 
Posts: 386
Join Date: Feb 2009
Post HA Cluster - 01-08-2010, 10:19 PM

Install Hearbeat-2
PHP Code:
aptitude update aptitude install heartbeat-
or from backports (it's better):
PHP Code:
aptitude -t lenny-backports install heartbeat-2 heartbeat-2-gui 
Create backup of HA configs, before start with configuring
PHP Code:
cp -/etc/ha./opt
Edit hosts
PHP Code:
vim /etc/hosts 
PHP Code:
127.0.0.1       localhost

192.168.1.101   node1
192.168.1.102   node2 
Create authentication keys
PHP Code:
vim /etc/ha.d/authkeys 
Several types are available: crc, sha1 and md5

crc is a method without authentication, insecure you should use it only in very secury vlans/networks or if you use a cross-over cable.

Example 1:
PHP Code:
auth 1
1 crc 
Example 2:
PHP Code:
auth 1
1 sha1 ThisIsAVeryLongAndBoringPasswordAndMaybeSecure 
Example 3:
PHP Code:
auth 1
1 md5 ThisIsAVeryLongAndBoringPasswordAndMaybeSecure 
finally set right permissions:
PHP Code:
chmod 600 /etc/ha.d/authkeys 
copy config to node2
PHP Code:
scp /etc/ha.d/authkeys node2:/etc/ha.d/authkeys 
ha.cf
PHP Code:
vim /etc/ha.d/ha.cf 
PHP Code:
# Configuration for Heart-Beat 2
# <info@idrobot.net>

# Use heartbeat version 2
crm on

# Use device eth0 to broadcast the heartbea
bcast eth0

# Node hostnames - output of uname -n
node fw1
node fw2

# Logfile
logfile /var/log/ha-log

# Ping Gateway
ping 192.168.2.1
ping 192.168.2.13

# Which port Heartbeat will use for its UDP intra-cluster communication
udpport 694

# keepalive: how long between heartbeats?
keepalive 1

# deadtime: how long-to-declare-host-dead?
deadtime 5

# warntime: how long before issuing "late heartbeat" warning?
warntime 3

# Very first dead time (initdead)
initdead 10 
Ensure they see each other:
PHP Code:
crmadmin -
Output:
PHP Code:
root@node1:~$ crmadmin -N
normal node
node2 (bd76d0d7-fd2e-4a08-8dfe-7a704f5db5e0)
normal nodenode1 (7cfa2f8d-406a-40fe-98d5-6663807990df

Copy config no node2
PHP Code:
scp /etc/ha.d/ha.cf node2:/etc/ha.d/ha.cf 


Show running CIB:
PHP Code:
cibadmin -Ql 
-Q Query
-l Local

Location of CIB config-file:
PHP Code:
less /var/lib/heartbeat/crm/cib.xml 
Clean ressource
PHP Code:
crm_resource --r bind9-child:-H fw2 
-C Clean
-r Ressource
-H Host

Graphical-GUI for Heartbeat
PHP Code:
aptitude update aptitude install heartbeat-2-gui 
To be able to log on you need to set a password for hacluster user:
PHP Code:
node1:~# passwd hacluster
node2:~# passwd hacluster 
Or you can add another user (user=id) to hacluster group:
PHP Code:
usermod -G haclient id 

Reply With Quote
(#2)
Old
root's Avatar
root root is offline
Administrator
 
Posts: 386
Join Date: Feb 2009
Default Drbd - 01-17-2010, 09:09 PM





I describe here the easiest and best way to install and configure DRBD with HeartBeat.


edit your sources and add backports:

PHP Code:
vim /etc/apt/sources.list 
PHP Code:
deb http://ftp.de.debian.org/debian/ lenny main
deb-src http://ftp.de.debian.org/debian/ lenny main

deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main

deb http://volatile.debian.org/debian-volatile lenny/volatile main
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main

deb http://ftp.de.debian.org/debian/ lenny main non-free contrib

deb http://www.backports.org/debian lenny-backports main contrib non-free 
PHP Code:
aptitude -t etch-backports install drbd8-source drbd8-utils 
compile and install DRBD

PHP Code:
m-a a-i drbd8 
remove DRBD from autostart
PHP Code:
update-rc.-f drbd remove 
Create drbd.conf
PHP Code:
vim /etc/drbd.conf 
example config:
PHP Code:
# examples are in /usr/share/doc/drbd8/*

global {
    
usage-count no;
}

common {
  
syncer rate 100M; }
}

resource drbd0 {
  
protocol C;

  
handlers {
    
pri-on-incon-degr "echo o > /proc/sysrq-trigger ; halt -f";
    
pri-lost-after-sb "echo o > /proc/sysrq-trigger ; halt -f";
    
local-io-error "echo o > /proc/sysrq-trigger ; halt -f";
    
outdate-peer "/usr/sbin/drbd-peer-outdater";
  }

  
startup {
    
degr-wfc-timeout 120;    # 2 minutes.
  
}

  
disk {
    
on-io-error   detach;
  }

  
net {

    
after-sb-0pri disconnect;
    
after-sb-1pri disconnect;
    
after-sb-2pri disconnect;

    
rr-conflict disconnect;
  }


  
syncer {
    
rate 100M;

    
al-extents 257;
  }

  
on node1 {
    
device     /dev/drbd0;
    
disk       /dev/sda3;
    
address    192.168.1.101:7788;
    
flexible-meta-disk  internal;

  }

  
on node2 {
    
device     /dev/drbd0;
    
disk       /dev/sda3;
    
address    192.168.1.102:7788;
    
flexible-meta-disk  internal;

  }

Attention each disk-device need a separate port!

Copy your config to node2
PHP Code:
scp /etc/drbd.conf node2:/etc/drbd.conf 
We need to start the driver and tell Linux to load it the next time it boots:
PHP Code:
modprobe drbd
echo 'drbd' >> /etc/modules
lsmod 
grep drbd 
Start DRBD
PHP Code:
/etc/init.d/drbd start 
Show DRBD status:
PHP Code:
cat /proc/drbd 
Create DRBD disk device:
drbdadm create-md drbd0

execute this on both nodes:
PHP Code:
chgrp haclient /sbin/drbdsetup /sbin/drbdmeta
chmod o
-/sbin/drbdsetup /sbin/drbdmeta
chmod u
+/sbin/drbdsetup /sbin/drbdmeta 
PHP Code:
drbdadm -- --overwrite-data-of-peer primary drbd0 
Create fs on drbd device:
PHP Code:
mkfs.ext3 /dev/drbd0 
Set node to primary mode:
PHP Code:
drbdadm primary all 
for the secondary node:
PHP Code:
drbdadm secondary all 
show status drbd0
PHP Code:
drbdadm dstate drbd0 
UUID:
PHP Code:
cat /var/lib/heartbeat/hostcache 
Overwrite UUID
PHP Code:
crm_uuid -w 200989f1-4cad-4710-93a9-e2697a96b53a 
Reply With Quote
(#3)
Old
root's Avatar
root root is offline
Administrator
 
Posts: 386
Join Date: Feb 2009
Smile DRBD Troubleshooting - 01-19-2010, 09:44 PM

This was my problem and I fix it only with few commands here they are:

primary/unknown and secondary/unknown

1. umount everything

2. On primary node
PHP Code:
drbdadm connect all 
3. On secondary node
PHP Code:
drbdadm -- --discard-my-data connect all 
Reply With Quote
(#4)
Old
root's Avatar
root root is offline
Administrator
 
Posts: 386
Join Date: Feb 2009
Lightbulb DRBD force resync - 01-21-2010, 08:53 PM

Will invalidate the data on the node where you execute this command:
PHP Code:
drbdadm invalidate all 
Will invalidate the data on the other node where you run this command:
PHP Code:
drbdadm invalidate_remote all 
If you have several resources you may do then one at a time :
PHP Code:
drbdadm invalidate resource-name 
result:
PHP Code:
version8.0.14 (api:86/proto:86)
GIT-hashbb447522fc9a87d0069b7e14f0234911ebdab0f7 build by phil@fat-tyre2008-11-12 16:40:33
 0
cs:SyncSource st:Secondary/Primary ds:UpToDate/Inconsistent C r---
    
ns:963688 nr:72 dw:72 dr:969712 al:0 bm:60 lo:504 pe:1468 ua:2009 ap:0
        
[========>...........] synced46.8% (1090088/2047900)K
        finish
0:02:23 speed7,344 (5,948K/sec
        resync
used:2/61 hits:482322 misses:60 starving:0 dirty:0 changed:60
        act_log
used:0/257 hits:0 misses:0 starving:0 dirty:0 changed:
Reply With Quote
(#5)
Old
root's Avatar
root root is offline
Administrator
 
Posts: 386
Join Date: Feb 2009
Default Re: HA Cluster - 02-01-2010, 03:56 PM

PHP Code:
version8.0.14 (api:86/proto:86)
GIT-hashbb447522fc9a87d0069b7e14f0234911ebdab0f7 build by phil@fat-tyre2008-11-12 16:40:33
 0
cs:SyncSource st:Primary/Secondary ds:UpToDate/Inconsistent C r---
    
ns:111824232 nr:0 dw:6386564 dr:105446302 al:1600 bm:6435 lo:1 pe:46 ua:256 ap:0
        
[>....................] synced:  3.0% (97025/99995)M
        finish
1:05:42 speed25,056 (27,644K/sec
        resync
used:2/61 hits:190182 misses:187 starving:0 dirty:0 changed:187
        act_log
used:0/257 hits:1595041 misses:2327 starving:0 dirty:727 changed:1600 


More Infos: [Link blocked: Please register to see it!]
Reply With Quote
(#6)
Old
root's Avatar
root root is offline
Administrator
 
Posts: 386
Join Date: Feb 2009
Default Re: Online/Standby - 06-30-2010, 02:22 PM

Put fw1 into standby:
PHP Code:
crm_standby -U fw1 -v true 
Put fw1 back to online:
PHP Code:
crm_standby -U fw1 -v false 
Reply With Quote
(#7)
Old
root's Avatar
root root is offline
Administrator
 
Posts: 386
Join Date: Feb 2009
Default Re: HA Cluster - 07-02-2010, 08:42 AM

PHP Code:
Clean ressources
PHP Code:
crm_resource --r srv-mount -H fw1 
PHP Code:
crm_resource --r outer-ip -H fw2 
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump