DRBD, heartbeat on Debian Etch: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(20 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
[[Category: Linux]] |
[[Category: Linux]] |
||
'''This article is much out-of-date; don't follow it! ''' |
|||
= DRBD & Heartbeat on Debian Etch = |
= DRBD & Heartbeat on Debian Etch = |
||
== Install DRBD == |
== Install DRBD == |
||
*** DRBD is now part of the kernel, so the build part is deprecated |
|||
* // START deprecated |
|||
Unfortunately, drbd is not actively available as a package under Debian Etch, so it has to be build from source. |
Unfortunately, drbd is not actively available as a package under Debian Etch, so it has to be build from source. |
||
Line 14: | Line 19: | ||
m-a a-i drbd0.7 |
m-a a-i drbd0.7 |
||
</pre> |
</pre> |
||
* // END deprecated |
|||
== Setup some basic drbd replication [internal meta - partition] == |
=== Setup some basic drbd replication [internal meta - partition] === |
||
<pre> |
<pre> |
||
resource drbd { |
resource drbd { |
||
Line 42: | Line 48: | ||
Of course adjust to your need. |
Of course adjust to your need. |
||
== Install heartbeat == |
|||
<pre> |
|||
apt-get install heartbeat |
|||
</pre> |
|||
=== Setup heartbeat (basic) === |
|||
Edit both host files ( /etc/ha.d/authkeys ) |
|||
<pre> |
|||
auth 2 |
|||
1 crc |
|||
2 sha1 ThisIsASampleKeyAnythingAlphaNumericIsGoodHere |
|||
3 md5 ThisIsASampleKeyAnythingAlphaNumericIsGoodHere |
|||
</pre> |
|||
Edit HA for master node ( /etc/ha.d/ha.cf ) |
|||
<pre> |
|||
keepalive 1 |
|||
deadtime 10 |
|||
warntime 5 |
|||
initdead 60 |
|||
udpport 694 |
|||
ucast eth0 192.168.0.140 ### Change to 192.168.0.110 for slave |
|||
auto_failback off |
|||
node server1 |
|||
node server2 |
|||
</pre> |
|||
Edit resources ( /etc/ha.d/haresources ) |
|||
<pre> |
|||
server1 drbddisk::drbd \ |
|||
Filesystem::/dev/drbd0::/data::ext3 \ |
|||
mysql \ |
|||
apache2 \ |
|||
IPaddr::192.168.0.180/24 |
|||
</pre> |
|||
== Update systemfiles == |
|||
Add needed servers to hosts file |
|||
<pre> |
|||
[ ... ] |
|||
192.168.0.110 server1 |
|||
192.168.0.140 server2 |
|||
192.168.0.180 server |
|||
[ ... ] |
|||
</pre> |
|||
chmod /etc/ha.d/authkeys files |
|||
<pre> |
|||
chmod 0600 /etc/ha.d/authkeys |
|||
</pre> |
|||
Prepare new drbd partition for data |
|||
<pre> |
|||
mkfs.ext3 /dev/drbd0 |
|||
</pre> |
|||
Setup exim |
|||
<pre> |
|||
dpkg-reconfigure exim4-config |
|||
</pre> |
|||
Mount and prepare drbd disk |
|||
<pre> |
|||
mkdir /data |
|||
mount /dev/drbd0 /data |
|||
## Create appropriate dirs for data to reside on or hardlink |
|||
mkdir -p /data/var/log/apache2 |
|||
mkdir /data/var/log/mysql |
|||
chown www-data: /data/var/log/apache2 |
|||
chown mysql: /data/var/log/mysql |
|||
mkdir -p /data/var/lib/ |
|||
mv /var/lib/mysql /data/var/lib |
|||
chown mysql: /data/var/lib/mysql |
|||
mkdir /data/var/www/ |
|||
chown www-data: /data/var/www |
|||
</pre> |
|||
== Install services == |
|||
<pre> |
|||
## Apache + php5 + mysql |
|||
apt-get install apache2 php5 php5-mysql mysql-server |
|||
## pureftpd |
|||
apt-get install pure-ftpd |
|||
</pre> |
|||
== Heartbeat controlled ressources == |
|||
Stop services and let heartbeat handle it: |
|||
<pre> |
|||
/etc/init.d/apache2 stop |
|||
/etc/init.d/mysql stop |
|||
## Copy to |
|||
cp -p /etc/init.d/mysql /etc/ha.d/resource.d/ |
|||
cp -p /etc/init.d/apache2 /etc/ha.d/resource.d/ |
|||
## Remove old init-scripts for mysql/apache |
|||
update-rc.d -f apache2 remove |
|||
update-rc.d -f mysql remove |
|||
## Config to use the new storage (/data) |
|||
</pre> |
Latest revision as of 18:45, 13 January 2013
This article is much out-of-date; don't follow it!
DRBD & Heartbeat on Debian Etch
Install DRBD
- DRBD is now part of the kernel, so the build part is deprecated
- // START deprecated
Unfortunately, drbd is not actively available as a package under Debian Etch, so it has to be build from source.
Luckily this can be done automatically with debian.
apt-get install module-assistant build-essential drbd0.7-module-source ## Then build the module m-a a-i drbd0.7
- // END deprecated
Setup some basic drbd replication [internal meta - partition]
resource drbd { protocol C; incon-degr-cmd "killall heartbeat"; disk { on-io-error panic; } syncer { rate 10M; # Note: 'M' is MegaBytes, not MegaBits } on server1 { device /dev/drbd0; disk /dev/hdc3; address 192.168.0.110:7789; meta-disk internal; } on server2 { device /dev/drbd0; disk /dev/hda3; address 192.168.0.140:7789; meta-disk internal; } }
Of course adjust to your need.
Install heartbeat
apt-get install heartbeat
Setup heartbeat (basic)
Edit both host files ( /etc/ha.d/authkeys )
auth 2 1 crc 2 sha1 ThisIsASampleKeyAnythingAlphaNumericIsGoodHere 3 md5 ThisIsASampleKeyAnythingAlphaNumericIsGoodHere
Edit HA for master node ( /etc/ha.d/ha.cf )
keepalive 1 deadtime 10 warntime 5 initdead 60 udpport 694 ucast eth0 192.168.0.140 ### Change to 192.168.0.110 for slave auto_failback off node server1 node server2
Edit resources ( /etc/ha.d/haresources )
server1 drbddisk::drbd \ Filesystem::/dev/drbd0::/data::ext3 \ mysql \ apache2 \ IPaddr::192.168.0.180/24
Update systemfiles
Add needed servers to hosts file
[ ... ] 192.168.0.110 server1 192.168.0.140 server2 192.168.0.180 server [ ... ]
chmod /etc/ha.d/authkeys files
chmod 0600 /etc/ha.d/authkeys
Prepare new drbd partition for data
mkfs.ext3 /dev/drbd0
Setup exim
dpkg-reconfigure exim4-config
Mount and prepare drbd disk
mkdir /data mount /dev/drbd0 /data ## Create appropriate dirs for data to reside on or hardlink mkdir -p /data/var/log/apache2 mkdir /data/var/log/mysql chown www-data: /data/var/log/apache2 chown mysql: /data/var/log/mysql mkdir -p /data/var/lib/ mv /var/lib/mysql /data/var/lib chown mysql: /data/var/lib/mysql mkdir /data/var/www/ chown www-data: /data/var/www
Install services
## Apache + php5 + mysql apt-get install apache2 php5 php5-mysql mysql-server ## pureftpd apt-get install pure-ftpd
Heartbeat controlled ressources
Stop services and let heartbeat handle it:
/etc/init.d/apache2 stop /etc/init.d/mysql stop ## Copy to cp -p /etc/init.d/mysql /etc/ha.d/resource.d/ cp -p /etc/init.d/apache2 /etc/ha.d/resource.d/ ## Remove old init-scripts for mysql/apache update-rc.d -f apache2 remove update-rc.d -f mysql remove ## Config to use the new storage (/data)