|
Debian Lenny Heartbeat + DRBD + Apache |
|
|
|
|
Scritto da Alessandro Pensato
|
|
Sabato 13 Agosto 2011 08:09 |
NODO 1
apt-get install drbd8-utils drbd8-modules-2.6.26-2-686
fdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
mv /etc/drbd.conf /etc/drbd.conf.old
nano /etc/drbd.conf
global { usage-count no; }
common { syncer { rate 100M; } }
resource r0 {
protocol C;
startup {
wfc-timeout 15;
degr-wfc-timeout 60;
}
net {
cram-hmac-alg sha1;
shared-secret "secret";
}
on debian1 {
device /dev/drbd0;
disk /dev/sdb1;
address 192.168.52.200:7788;
meta-disk internal;
}
on debian2 {
device /dev/drbd0;
disk /dev/sdb1;
address 192.168.52.201:7788;
meta-disk internal;
}
}
/etc/init.d/drbd start
drbdadm create-md r0
Writing meta data...
initialising activity log
NOT initialized bitmap
New drbd meta data block sucessfully created.
/etc/init.d/drbd start
drbdadm -- --overwrite-data-of-peer primary all
mkfs.ext3 /dev/drbd0
mkdir /data
mount /dev/drbd0 /data
echo adadasdasd > /data/test.txt
umount /data
drbdadm secondary r0
nano /etc/heartbeat/haresources
debian1 192.168.0.202 drbddisk::r0 Filesystem::/dev/drbd0::/data::ext3 apache2
reboot
NODO 2
apt-get install drbd8-utils drbd8-modules-2.6.26-2-686
fdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
mv /etc/drbd.conf /etc/drbd.conf.old
nano /etc/drbd.conf
global { usage-count no; }
common { syncer { rate 100M; } }
resource r0 {
protocol C;
startup {
wfc-timeout 15;
degr-wfc-timeout 60;
}
net {
cram-hmac-alg sha1;
shared-secret "secret";
}
on debian1 {
device /dev/drbd0;
disk /dev/sdb1;
address 192.168.52.200:7788;
meta-disk internal;
}
on debian2 {
device /dev/drbd0;
disk /dev/sdb1;
address 192.168.52.201:7788;
meta-disk internal;
}
}
/etc/init.d/drbd start
drbdadm create-md r0
Writing meta data...
initialising activity log
NOT initialized bitmap
New drbd meta data block sucessfully created.
/etc/init.d/drbd start
watch -n1 cat /proc/drbd
version: 8.0.14 (api:86/proto:86)
GIT-hash: bb447522fc9a87d0069b7e14f0234911ebdab0f7 build by phil@fat-tyre, 2008-
11-12 16:40:33
0: cs:SyncTarget st:Secondary/Primary ds:Inconsistent/UpToDate C r---
ns:0 nr:569504 dw:569504 dr:0 al:0 bm:34 lo:1 pe:2016 ua:0 ap:0
[==========>.........] sync'ed: 55.0% (474620/1044124)K
finish: 0:00:19 speed: 24,644 (21,904) K/sec
resync: used:5/61 hits:37571 misses:39 starving:0 dirty:0 changed:39
act_log: used:0/257 hits:0 misses:0 starving:0 dirty:0 changed:0
drbdadm primary r0
mkdir /data
mount /dev/drbd0 /data
echo nodo2 > /data/nodo2.txt
nano /etc/heartbeat/haresources
debian1 192.168.0.202 drbddisk::r0 Filesystem::/dev/drbd0::/data::ext3 apache2
reboot
|