nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

MYSQL master-master replication monitor shell script

This is a discussion on MYSQL master-master replication monitor shell script within the Databases servers forums, part of the Mastering Servers category; Hello , i have set up mysql master-master replication and it is working fine . i want to confirm on ...


Go Back   nixCraft Linux Forum > Mastering Servers > Databases servers

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 10-06-2007, 08:33 PM
Member
User
 
Join Date: Jan 2007
Posts: 47
Rep Power: 0
zafar466
Default MYSQL master-master replication monitor shell script

Hello ,

i have set up mysql master-master replication and it is working fine . i want to confirm on daily basis that this setup is working as expected . is there a way to monitor it

regards,
Zafar
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-08-2007, 12:55 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 917
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Write a shell script to Check if mysqld is alive. Here is command line version
Code:
mysqladmin -u root -h dbserver1.mycorp.com -p 'MyPASSWORD' ping
And a script:
Code:
#!/bin/bash
mysqladmin -u root -h dbserver1.mycorp.com -p 'MyPASSWORD' ping
if [ $? -ne 0 ]; then
  echo "Send email, mysql not running"
else
 echo "Do nothing everything is working"
fi
done
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #3 (permalink)  
Old 07-12-2008, 12:26 PM
Junior Member
User
 
Join Date: Jul 2008
Location: Washington, US
My distro: CentOS, Ubuntu
Posts: 6
Rep Power: 0
memnoch_proxy is on a distinguished road
Default

My advice on multi-master replication: two is sometimes not enough. I have four servers, two of them multi-mastering and each has a slave behind it, allowing me to lose a master but still have capacity to withstand load.

Script tools I had to develop are along these lines:
. snapshot replication script ( I've used this a LOT, I've had to rebuild masters and slaves commonly)

. a firewall toggle script: you need to pull your database in and out of the pool but NOT disturb replication, the IP tables setup permits other databases to replicate but bars web head access when toggled

. a copy of maatkit and scripts to run it across your tables effectively; think of maatkit more like a db script library than a solution itself, it can powerfully destroy your data very fast; you want to be able to tackle the challenge of corrupted tables on one master without destroying valid data that didn't replicate to the other...I've seen this happen.

. a process to update the copy of mysql on your system; the default packages that come with centos, for instance, are over two years old and there's been lotsa bugs fixed in that time...that do things like crash tables

. load monitoring: monitor num of threads, amount of replication lag

. application error log monitoring, where are your queries failing?

. ability to row-by-row compare your tables to find what data failed to replicate; maatkit can help with this but some php and a for loop might be more judicious in some instances. Consider checking a 8GB table in 10,000 row chunks to keep your table from locking up when using maatkit...then use your own script to find the row in the 10,000 row range.

. don't forget mytop

Good luck!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Script to monitor a particular directory and send out e-mail.... nageshms Shell scripting 1 02-11-2008 02:01 PM
mysql replication information myfoot Shell scripting 0 12-04-2007 02:24 AM
get data mysql from shell alpa Shell scripting 1 05-14-2007 06:02 PM
Shell script to monitor remote local http or port 80 amigo28 Shell scripting 1 02-12-2007 09:58 PM
Backup mysql from shell prompt or script raj Linux software 0 07-29-2006 11:17 PM


All times are GMT +5.5. The time now is 01:20 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36