This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Courtesy | |
# http://ec2dream.blogspot.com/search/label/EBS | |
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'right_aws' | |
require 'net/http' | |
url = 'http://169.254.169.254/2008-02-01/meta-data/instance-id' | |
instance_id = Net::HTTP.get_response(URI.parse(url)).body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Striping across EBS volumes | |
http://developer.amazonwebservices.com/connect/thread.jspa?threadID=30122&tstart=0 | |
Create the new EBS volumes | |
Attach them to your instance | |
Use mdadm to create an md0 device in RAID 0 striped mode using the new EBS volumes | |
Stop MySQL | |
Format/mount md0 and copy all your data from the original EBS's mount point to the md0 device's mount point | |
Make any required changes to MySQL so it knows where to find the databases at the new mount point (or unmount the old EBS and remount md0 to the original mount point) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://ec2dream.blogspot.com/2009/03/networking-in-ec2.html | |
#Setup a cron job to update /etc/hosts as often as you like. I do it once per hour on #all my machines | |
# | |
#0 * * * * /usr/local/sbin/hosts -a myaccess -s mysecret >/etc/hosts | |
# | |
#All my machines have this ec2 security key + script + cron approach. I do not have to #run dyndns or any private dns servers to keep track of all my internal server ip #addresses. My /etc/hosts looks like the following on the three machines in the test #cluster: | |
#127.0.0.1 localhost | |
#10.252.202.221 oahu.ec2 oahu | |
#10.253.115.175 maui.ec2 maui | |
#10.253.114.190 hawaii.ec2 hawaii |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Check Replication Slave Status | |
# http://forge.mysql.com/tools/tool.php?id=6 | |
## Matthew Montgomery ## | |
## [email protected] ## | |
repeat_alert_interval=15 # minutes | |
lock_file=/tmp/slave_alert.lck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# mysqlbackup | |
# Developed In: bash — Contributed by: Partha Dutta | |
# http://forge.mysql.com/tools/tool.php?id=14 | |
# mysqlbackup - Perform mysql backup | |
slave_backup=0 | |
backup_host=localhost |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Backup mysql binary logs | |
#Developed In: bash — Contributed by: Partha Dutta | |
# http://forge.mysql.com/tools/search.php?page=7 | |
# mysqlbinlogbackup - backup binary logs | |
slave= | |
slaves= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://blog.dbadojo.com/2008/03/mysql-master-master-replication-table.html | |
http://www.xaprb.com/blog/2008/10/04/how-to-check-mysql-replication-integrity-continually/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/431025/mysql-replication-one-website-many-servers-different-continents | |
Don't use master-master replication, ever. There is no mechanism for resolving conflicts. If you try to write to both masters at the same time (or write to one master before it has caught up with changes you previously wrote to the other one), then you will end up with a broken replication scenario. The service won't stop, they'll just drift further and further apart making reconciliation impossible. | |
Don't use MySQL replication without some well-designed monitoring to check that it's working ok. Don't assume that becuase you've configured it correctly initially it'll either keep working, OR stay in sync. | |
DO have a well-documented, well-tested procedure for recovering slaves from being out of sync or stopped. Have a similarly documented procedure for installing a new slave from scratch. | |
Your application may need sufficient intelligence to know that a slave is out of sync or stopped, and that it shou |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Restoring a MySQL Replication with corrupted binlogs! | |
Posted on December 30th, 2005 by Basil | |
Major assumption: you have a safe, but halted replication you want to restore from. | |
Situation — Your replication server is down or simply the MySQL slave has stopped, possible because the hard drive filled up and your binlogs got corrupted beyond repair? Some might have the luxury to start a new snapshot from the main DB server, lets call it the Master DB server. But what if you can’t afford to do a read-lock on the server? (Which would be most of the times for production servers with decent traffic). Well — since you planned ahead - you should have multiple replication servers running — it helps to reduce your read load with the round-robin method anyways. | |
Here’s some things I did to get our primary MySQL replication slave up to date using the planned, redundant replication server, secondary Slave. | |
So, on a regular day, Master DB replicates its binlog to Primary slave and Master DB replicates to secondatry slav |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replicate the manager | |
# http://matt.simerson.net/computing/sql/mrm/mysql_replicate_manager.pl | |
#!/usr/bin/perl -w | |
use strict; | |
=head1 NAME | |
mysql_replicate_manager.pl - Mysql Replication Manager |
OlderNewer