Revision [3741]

Last edited on 2010-07-01 20:30:18 by KenFong
Additions:
ping_group hb-ping-test 10.0.0.1 10.0.0.254
Deletions:
ping mygateway.xxx.org


Revision [2819]

Edited on 2009-07-17 09:58:46 by WikiAdmin
Additions:
Update: One may instruct heartbeat to failover / failback using the commands **/usr/lib64/heartbeat/hb_standby** and **/usr/lib64/heartbeat/hb_takeover** commands. But heartbeat does not actually check mysql's status.


Revision [2817]

Edited on 2009-07-17 09:47:34 by WikiAdmin
Additions:
# Use multiple interfaces here, one of the should be the
# interface dedicated for heartbeat. This gives you redundancy
# I do not prefer serial connection, but that could be a more
# accurate connection to prevent split brain situation.
bcast eth1
Deletions:
# What interfaces to heartbeat over?


Revision [2816]

Edited on 2009-07-17 09:41:04 by WikiAdmin
Additions:
Copy the mysql init script from /etc/init.d to /etc/ha.d/resources.d. Edit it such that it uses /var/lib/mysql/my.cnf to look for configurations. The reason is obvious, when mysql fails over to the standby host, you want it to always use the same defaults file. This can be done by adding the option **--defaults-file=/var/lib/mysql/my.cnf** to my_print_defaults:
Deletions:
Copy the mysql init script from /etc/init.d to /etc/ha.d/resources.d. Edit it such that it uses /var/lib/mysql/my.cnf to look for configurations. This can be done by adding the option **--defaults-file=/var/lib/mysql/my.cnf** to my_print_defaults:


Revision [2815]

Edited on 2009-07-17 09:40:04 by WikiAdmin
Additions:
Copy the mysql init script from /etc/init.d to /etc/ha.d/resources.d. Edit it such that it uses /var/lib/mysql/my.cnf to look for configurations. This can be done by adding the option **--defaults-file=/var/lib/mysql/my.cnf** to my_print_defaults:
get_mysql_option(){
result=`/usr/bin/my_print_defaults --defaults-file=/var/lib/mysql/my.cnf "$1" | sed -n "s/^--$2=//p" | tail -n 1`
if [ -z "$result" ]; then
# not found, use default
result="$3"
fi
}
Move /etc/my.cnf to /var/lib/mysql/ or whereever DRBD will be mounted on
Deletions:
Copy the mysql init script from /etc/init.d to /etc/ha.d/resources.d


Revision [2814]

Edited on 2009-07-17 09:31:16 by WikiAdmin
Additions:
Copy the mysql init script from /etc/init.d to /etc/ha.d/resources.d


Revision [2094]

Edited on 2008-11-27 22:29:00 by WikiAdmin
Additions:
Filesystem::/dev/drbd0::/var/lib/mysql::ext3[::MOUNT_OPTIONS] \
Deletions:
Filesystem::/dev/drbd0::/var/lib/mysql::ext3::mount_options \


Revision [1992]

Edited on 2008-10-09 01:34:11 by WikiAdmin
Additions:
debugfile /var/log/ha.debug
logfile /var/log/ha.log
Deletions:
debugfile /var/log/ha-debug
logfile /var/log/ha-log


Revision [1991]

Edited on 2008-10-08 22:28:04 by WikiAdmin
Additions:
Filesystem::/dev/drbd0::/var/lib/mysql::ext3::mount_options \
Deletions:
Filesystem::/dev/drbd0::/var/lib/mysql::ext3 \


Revision [1810]

Edited on 2008-07-15 01:13:58 by WikiAdmin
Additions:
Ref: http://www.linuxjournal.com/article/9074


Revision [1809]

Edited on 2008-07-15 00:33:08 by WikiAdmin
Additions:
Use the same authkeys on both nodes
%%(text;authkeys)
auth 1
1 md5 some_random_secret


Revision [1808]

Edited on 2008-07-15 00:30:43 by WikiAdmin
Additions:
For RHEL, I use the heartbeat rpm from centos.
==Create authkeys==
==Create ha.cf==
Filesystem::/dev/drbd0::/var/lib/mysql::ext3 \
IPaddr::10.0.0.50 \
mysql
Deletions:
Filesystem::/dev/drbd0::/var/lib/mysql::ext3 \
IPaddr::10.0.0.50 \
mysql


Revision [1104]

Edited on 2007-10-26 16:44:59 by WikiAdmin
Additions:
prod02.domain.com drbddisk::mydata \
Deletions:
prod02.jade-adf.org drbddisk::mydata \


Revision [955]

Edited on 2007-09-10 19:50:38 by WikiAdmin
Additions:
{{parent page="MySQL"}}
Deletions:
{{parent page="MySQL}}


Revision [954]

Edited on 2007-09-09 21:37:53 by WikiAdmin
Additions:
Check /proc/drbd to ensure the sync process has started. Wait for the sync to complete.


Revision [953]

Edited on 2007-09-09 21:35:32 by WikiAdmin
Additions:
# On secondary host, invalidate my data partition. Restart DRBD and synchronization will begin automatically.
drbdadm invalidate mydata
Deletions:
drbdadm primary mydata -o


Revision [952]

Edited on 2007-09-09 21:18:32 by WikiAdmin
Deletions:
**Read**
Mon: http://www.netexpertise.eu/en/Mysql/Failover.html


Revision [951]

Edited on 2007-09-09 21:17:44 by WikiAdmin
Additions:
3. Now to a DRBD synchronization from standby to primary
drbdadm primary mydata -o
service drbd restart
4. Now that the primary has an updated DRBD partition, and is ready to be failed-back. Change DRBD to Secondary/Secondaryby running **drbdadm secondary mydata** on both hosts.
5. Start heartbeat service on primary. Check /var/log/ha-log to make sure all local resources are brought up
6. Start heartbeat service on standby
Deletions:
3. Now to a DRBD synchronization


Revision [950]

Edited on 2007-09-09 21:14:21 by WikiAdmin
Additions:
==Failover and failback==
One should have a script on primary DB to monitor mysql's availability. You may use the following as an example:
%%(mysql_mon.sh;bash)
#!/bin/bash
DBRESULT=`echo "select count(1) from mysql.user;" | mysql -s --connect_timeout=1 -uroot -pxxxx`
if [ ${DBRESULT} -lt 1];
then
logger -t MYSQL_MON "MySQL unavailable. Stopping heartbeat service."
service heartbeat stop
fi
Once heartbeat is stopped on the primary, it will do its work and activate the standby database.
Fail-back is preferred as a manual procedure. It is important that the heartbeat service is not configured to startup automatically on both servers. In case of a server reboot or fail-back scenario, it best to start / restart services interactively. Steps for fail-back:
1. shutdown heartbeat on both servers
2. check /proc/drbd make sure standby server is currently the primary DRBD, and primary server is secondary DRBD. If you're connected the standby machine, the status should be Primary/Secondary.
3. Now to a DRBD synchronization


Revision [949]

The oldest known version of this page was created on 2007-09-08 11:59:49 by WikiAdmin
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki