Permalink: http://bit.ly/1rNFRsO
The stripped down stored procedure shown below will accept any
Data Manipulation Language statement as its parameter and
automatically log the statement and create table backup copies
before the statement is executed. The logging functionality is
similar to MySQL's binary log but exclusive to DML statements and
is useful for table data recovery operations, such as undoing the
last table data change or to revert databases back to a certain
point in time. All this is done exclusively using stored routines
(procedures and functions).
Its assumed that the databases and tables that will be used are
already formed to specific business requirements since DDL
statements will not be logged by the stored procedure. Though
logging of table data changes can also be achieved using
triggers, it is not practical to alter each and …
December 1, 2014 By Severalnines
MariaDB 10 supports multi-source replication, and each MariaDB Galera node can have up to 64 masters connected to it. So it is possible to use a MariaDB Cluster as an aggregator for many single-instance MariaDB master servers.
In this blog post, we are going to show you how to setup multi-source replication with MariaDB Galera Cluster, where one of the Galera nodes is acting as slave to 3 MariaDB masters (see diagram below). If you would like to set this up with Percona XtraDB Cluster or Galera Cluster (Codership), please read this post instead.
MariaDB GTID vs MySQL GTID
MariaDB has a different implementation of Global Transaction ID (GTID), and is enabled by default starting from MariaDB 10.0.2. Multi-source replication in MariaDB works …
[Read more]
I spent the last 4 years at SkySQL/MariaDB working on versions of
MySQL that could be “suitable for the cloud”. I strongly
believed that the world needed a version of MySQL that could work
in the cloud even better than its comparable version on bare
metal. Users and administrators wanted to benefit from the use of
cloud infrastructures and at the same time they wanted to achieve
the same performance and overall stability of their installations
on bare metal. Unfortunately, ACID-compliant databases in the
cloud suffer from the issues that any centrally controlled and
strictly persistent system can get when hosted on highly
distributed and natively stateless infrastructures.
In this post I am not going to talk about the improvements needed
for MySQL in the cloud - I will tackle this topic in
a future post. Today I'd like to focus on the business side
of RDS and Aurora.
In the last 4 years I had endless discussions over …
Or how wsrep_on can bring you to have a cluster with usless data.
This is a WARNING article, and it comes out after I have being working on define internal blueprint on how to perform DDL operation using RSU safely.
The fun, if fun we want to call it, comes as usual by the fact that I am a curious guy and I often do things my way and not always following the official instructions.
Anyhow, lets us go straight to the point and describe what can happen on ANY MySQL/Galera installation.
The environment
The test environment, MySQL/Galera (Percona PXC 5.6.20 version).
The cluster was based on three nodes local no geographic distribution, no other replication in place then Galera.
Haproxy on one application node, simple application writing in this table:
Table: tbtest1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
… |
High season is coming, how do you make sure that MySQL will handle the increased load? Stress tests could help with that, but it’s not a good idea to run them in a production environment. In this case Select_scan, Select_full_join and other MySQL counters could quickly give you an idea of how many queries are not performing well and could cause a performance degradation as the load goes up.
Select_scan from SHOW GLOBAL STATUS indicates how many full table scans were done since last MySQL restart. Scanning the entire table is a resource intensive operation. It also forces MySQL to store unnecessary data in the buffer pool, wasting memory and IO resources.
Full scan of a tiny table would be quite fast so missing indexes could stay invisible until the load rises or the dataset grows up. This could also be the case for developers who work with too small data sets on their dev boxes. To prevent performance issues all newly added …
[Read more]Often enough I find MySQL benchmark results where the difference between results is 1% or even less and some conclusions are drawn. Now it is not that 1% is not important – especially when you’re developing the product you should care about those 1% improvements or regressions because they tend to add up. However with such a small difference it is very important to understand whenever this is for real or it is just the natural variance for your baseline test.
Take a look at this graph:
Click the image for a larger view)
This is the result for a simple in-memory, read-only “select by primary key” SysBench benchmark on dedicated physical hardware that is otherwise idle, simple 1 socket system. I tried to stabilize it as much as possible, for example …
[Read more]There were two nasty MySQL replication bugs in two different 5.6 releases that would make it difficult to upgrade slaves to MySQL 5.6 while still connected to MySQL 5.5 master. The first of those bugs is MySQL bug 72610 which affects 5.6.19. Essentially this bug is triggered when the table structure on the slave is different from the table structure on the master which leads to unnecessarily large amount of RAM usage while replicating events that affect that table. The amount of RAM used would generally be more noticeable when the replicated transaction consists of thousands of RBR events. The most common way this affects how we upgrade a replication hierarchy, is when we have the master running MySQL 5.5 and the slave running MySQL 5.6 and we have transactions involving DATETIME column(s). Tables with DATETIME columns will have different underlying structure when created on MySQL 5.5 versus when created on MySQL 5.6. Ideally you would avoid creating …
[Read more]There were two nasty MySQL replication bugs in two different 5.6 releases that would make it difficult to upgrade slaves to MySQL 5.6 while still connected to MySQL 5.5 master.
The first of those bugs is MySQL bug 72610 which affects 5.6.19. Essentially this bug is triggered when the table structure on the slave is different from the table structure on the master which leads to unnecessarily large amount of RAM usage while replicating events that affect that table. The amount of RAM used would generally be more noticeable when the replicated transaction consists of thousands of RBR events.
The most common way this affects how we upgrade a replication hierarchy, is when we have the master running MySQL 5.5 and the slave running MySQL 5.6 and we have transactions involving DATETIME column(s). Tables with DATETIME columns will have different …
[Read more]With the query rewrite framework in the latest MySQL (Optimizer/InnoDB/Replication) labs release, you get the opportunity to author plugins that can rewrite queries. You can choose whether to rewrite the queries before and/or after parsing. Today I am going to walk you through how to write a pre-parse query rewrite plugin.
When would you want to use a pre-parse query rewrite plugin? The greatest benefit compared to post-parse rewrites — which I cover in a separate post — is the efficiency, especially the lack of overhead for those queries that are actually rewritten. Typical cases where you may want to write a pre-parse plugin are:
- When you want to remove certain specific clauses from queries. For example, perhaps you want to remove all ENGINE …
I log into a lot of different servers running MySQL and one of the first things I do is create a file in my home directory called ‘.my.cnf’ with my credentials to that local mysql instance:
[client] user=root password=secret
This means I don’t have to type my password in every time, nor am I tempted to include it on the command line with -p and get the dreaded (but completely accurate):
Warning: Using a password on the command line interface can be insecure.
MySQL 5.6 introduces a utility to make this easier and more secure. First, let’s start with a new mysqld instance with a blank root password and make it more secure:
[vagrant@localhost ~]$ mysqladmin -u root password New password:secret Confirm new password:secret [vagrant@localhost ~]$ mysql -u root ERROR 1045 (28000): Access denied for user …[Read more]