We ran across the following error on a MySQL slave server recent: mysql> SHOW SLAVE STATUS \G <snip> Last_Error: Query caused different errors on master and slave. Error on master: 'Deadlock found when trying to get lock; try restarting transaction' (1213), Error on slave: 'no error' (0). Default database: '<database_name>'. Query: '<query>' <snip> In this […]
In posts on June 30 and July 6, I explained how implementing the commands “replace into” and “insert ignore” with TokuDB’s fractal trees data structures can be two orders of magnitude faster than implementing them with B-trees. Towards the end of each post, I hinted at that there are some caveats that complicate the story a little. On July 21st I explained one caveat, secondary keys, and on August 3rd, Rich explained another caveat. In this post, I explain the other …
[Read more]A couple of weeks ago one of my colleagues and I worked on a data corruption case that reminded me that sometimes people make unsafe assumptions without knowing it. This one involved SAN snapshotting that was unsafe.
In a nutshell, the client used SAN block-level replication to maintain a standby/failover MySQL system, and there was a failover that didn't work; both the primary and fallback machine had identically corrupted data files. After running fsck on the replica, the InnoDB data files were entirely deleted.
When we arrived on the scene, there was a data directory with an 800+ GB data file, which we determined had been restored from a SAN snapshot. Accessing this file caused a number of errors, including warnings about accessing data outside of the partition boundaries. We were eventually able to coax the filesystem into truncating the data file back to a size that didn't contain invalid pointers and could be read without …
[Read more]
There is a lot of discussions whenever running MySQL storing data
on NFS is a good idea. There is a lot of things for and against
this and this post is not about them.
The fact is number of people run their databases on NetApp and
other forms of NFS storage and this post is about one of
discoveries in such setup.
There are good reasons to have binary logs on NFS volume - binary logs is exactly the thing you want to survive the server crash - using them you can do point in time recovery from backup.
I was testing high volume replication today using Sysbench:
PLAIN TEXT SQL:
- sysbench --test=oltp --oltp-table-size=10000000 --db-driver=mysql --mysql-user=root --mysql-db=sbsmall --init-rng=1 --max-requests=100000000 --max-time=600 --oltp-test-mode=nontrx --oltp-nontrx-mode=update_nokey --num-threads=8 run
On this box I got …
[Read more]In October 2008, Baron posted How to Check MySQL Replication Integrity Continually. Here at Pythian we have developed a method based on that post, and added “verifying that masters and slaves are in sync” to our standard battery of tests.
We call it “Continual replication sync checking”. This article will explain how it works, how to test and make the procedure non-blocking, benchmarks from the real world, issues we encountered along the way, and …
[Read more]
It is easy for MySQL replication to become bottleneck when Master
server is not seriously loaded and the more cores and hard drives
the get the larger the difference becomes, as long as
replication
remains single thread process. At the same time it is a lot
easier to optimize your system when your replication runs
normally - if you need to add/remove indexes and do other schema
changes you probably would be looking at some methods involving
replication if you can't take your system down. So here comes the
catch in many systems - we find system is in need for
optimization when replication can't catch up but yet optimization
process we're going to use relays on replication being functional
and being able to catch up quickly.
So the question becomes how can we estimate replication capacity, so we can deal with replication load before slave is unable to catch up.
Need to replication capacity is not only needed in case you're …
[Read more]Working on a new set of replication APIs in MariaDB, I have given some thought to the generation of replication events on the master server.
But there is another side of the equation: to apply the generated events on a slave server. This is something that most replication setups will need (unless they replicate to non-MySQL/MariaDB slaves). So it will be good to provide a generic interface for this, otherwise every binlog-like plugin implementation will have to re-invent this themselves.
A central idea in the current design for generating events is that we do not enforce a specific content of events. Instead, the API provides accessors for a lot of different information related to each event, allowing the plugin flexibility in choosing what to include in a …
[Read more]There are few things one is supposed to know about MySQL replication in production, as manual doesn’t always discuss things openly.
This is small set of rules and advices I compiled (some apply to statement based replication only, but row based replication may benefit from one or two too):
-
Don’t use MyISAM. Or in fact, don’t use any
non-transactional engine, if you care about your data. On
either side, master or slave, or both – using non-transactional
engines will cause data drift, as partially executed statements
on master would be fully executed on slave, or simply stop
replication. Of course, every crash has the capacity of getting
your tables desynced from each other and there are absolutely
no guarantees.
This “don’t” can be easily transformed into “do” – just use InnoDB. Bonus point – one doesn’t need to take down the server, to clone a slave from …
I have old applications that need to read (and write) MyISAM tables that themselves receive lots of bulk updates. Time to try MySQL-Proxy.
MySQL Proxy is light on documentation and very few people written anything about working. Most of what I have read says MySQL-Proxy is not ready for prim time. I have hope so I had to give it a try.
I started with thee VMware servers. I setup one master and two read only slaves. I tested the replication with mysqlslap from another independent server and it worked fine. The slave never ran more then a second behind.
I downloaded mysql-proxy-0.8.0.tar.gz (64x version). I …
[Read more]
A few months ago, I reviewed MySQL Admin Cookbook. Today I am
reviewing High Availability MySQL Cookbook from Packt Publishing
by Alex Davies. Overall, I found the book to contain some
good hidden Gems.
The book is a mixture of MySQL Cluster (NDB), Replication
schemes, some performance tuning, some minor kernel tweaking, and
some more exotic approaches to common High Availability problems.
Overall, I found this book very informative and a good
read.
Now the specifics, the book starts out on NDB and stays focused
on this fact for about 60% of the book. The next 20% is on mySQL
replication then about 10% of the book is on tweaking kernel,
mysql, network settings to get the most out of …