nixCraft Linux Forum

nixCraft

Linux / UNIX 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

Linux answers from nixCraft.


Databases servers Discussions of databases of all types - especially MySQL.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-10-2007, 08:33 PM
Member
User
 
Join Date: Jan 2007
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
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
  #2 (permalink)  
Old 08-10-2007, 12:55 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 244 Times in 183 Posts
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 Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #3 (permalink)  
Old 12-07-2008, 12:26 PM
Junior Member
User
 
Join Date: Jul 2008
Location: Washington, US
OS: CentOS, Ubuntu
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
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
  #4 (permalink)  
Old 10-02-2009, 11:25 AM
Junior Member
User
 
Join Date: Feb 2009
OS: Debian
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kulasekhar is on a distinguished road
Default

Hi
Zafar.

I am new to mysql and i need u r help to implementing replication.

Regards,
kulasekhar

Last edited by kulasekhar; 10-02-2009 at 11:27 AM.
Reply With Quote
  #5 (permalink)  
Old 08-05-2009, 11:35 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 244 Times in 183 Posts
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 MySQL Set Up Master To Master Replication

what do you want to know on the setup of Master-Master?

Quote:
Originally Posted by wademac View Post
what do you want to know on the setup of Master-Master?
MySQL :: MySQL 5.0 Reference Manual :: 16 Replication

Last edited by nixcraft; 09-05-2009 at 03:15 AM.
Reply With Quote
Reply

Tags
mysql , mysql load balancing


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 Off


Similar Threads

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


All times are GMT +5.5. The time now is 04:55 PM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

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 37 38