MySQL Tech-Feed (en)

Galera Arbitrator (garbd)

Shinguz - Sat, 2013-08-17 16:59

It took me quite a while to find out how the beast Galera Arbitrator (garbd) works. To safe your time here a short summary:

How to start Galera Arbitrator (garbd)

shell> ./garbd --address gcomm://192.168.13.1,192.168.13.2 --group "Our Galera Cluster" --log /tmp/garbd.log --daemon

How to stop Galera Arbitrator (gardb)

shell> killall garbd

How to start Galera Arbitrator (garbd) with a configuration file

shell>./garbd --cfg /tmp/garb.cnf --daemon

The configuration file looks as follows:

# …

Taxonomy upgrade extras:  Galera  Start  Stop 

Galera Cluster for MySQL and hardware load balancer

Shinguz - Wed, 2013-08-14 21:30

Our bigger customers where we help to deploy Galera Cluster for MySQL set-ups have some commercial hardware (e.g. F5 or Cisco) for load balancing instead of software load balancers.

For those hardware load balancer it is not possible to see if a Galera node is available or not because the MySQL daemon is still running and responding on port 3306 but the service is not available nonetheless.
So the load balancer still serves the Galera node while he feeds for example a joiner node with a SST. This would lead …


Taxonomy upgrade extras: 

To UNION or not to UNION...

Shinguz - Sun, 2013-07-28 12:42

Recently a forum question
[ 1
] got my attention:

*Is there any performance issue with Union?

I used union all sometime back and it was performance issue just to make an opinion that we should used union in query.*

The question itself was not too interesting because the answer is easy: It depends. But I wanted to see if there was an improvement in this common problem over time in MySQL.

Test set-up

So I prepared a little test to simulate some of the possible scenarios:

CREATE TABLE `u` (
  `id` int(10) …

Taxonomy upgrade extras: 

MySQL and Secure Linux (SELinux)

Shinguz - Thu, 2013-06-20 16:40

Maybe you experienced some strange behaviour with MySQL: Everything is installed correctly and should work. But it does not.

Symptoms we have seen:

  • MySQL starts/stops properly when started/stopped with service mysqld restart but MySQL does not start when a server is rebooted.
  • Or after upgrading MySQL binaries mysqld will not start at all any more.
  • Or after relocating MySQL datadir or changing default port MySQL does not start any more.
shell> service mysqld start
MySQL Daemon failed to start.
Starting …

Taxonomy upgrade extras:  Selinux 

Unbreakable MySQL Cluster with Galera and Linux Virtual Server (LVS)

Shinguz - Thu, 2013-06-13 17:13

Recently we had to set-up a 3-node Galera Cluster with a Load Balancer in front of it. Because Galera Cluster nodes (mysqld) still reply to TCP requests on port 3306 when they are expelled from the Cluster it is not sufficient to just leave it to the Load Balancer to check the port if a Galera node is properly running or not.

We used the wsrep_notify_cmd variable to hook our own script into the Galera Cluster which disables each Node on the Load Balancer when its state changed.

# my.cnf
#
[mysqld] …

Taxonomy upgrade extras:  Galera  Cluster  Mysql Cluster  High Availability  Load Balancer  Keepalived  Lvs  Vip 

Galera Cluster for MariaDB training

Shinguz - Mon, 2013-06-03 10:19

You are running already MariaDB or MySQL databases in production but you have higher requirements in database availability? If you want to solve these High Availability requirements with Galera Cluster this training is the right one for you.

Requirements

You are used in operating demanding MariaDB/MySQL databases. Further you are familiar with the Linux console and rule the most important UNIX commands.

Audience

  • MariaDB/MySQL application developer
  • MariaDB and MySQL database administrators
  • System …

Taxonomy upgrade extras: 

We need you: MySQL DBA for FromDual Support line

Shinguz - Tue, 2013-04-02 11:17

FromDual is looking for professional, enthusiastic and experienced people who:

  • Know MySQL, Percona Server or MariaDB extensively
  • Are Familiar with the open source eco-system
  • Know how to operate database systems, as a DBA or a DevOps
  • Understand what can go wrong in operating a database
  • Are happy to work autonomously, remotely and to communicate with IRC, Skype, Mail and Phone
  • Are comfortable on Linux systems
  • Are team players, keen to contribute to the growth of the company
  • Are Comfortable dealing direct …

Taxonomy upgrade extras: 

Switching from MySQL/MyISAM to Galera Cluster

Shinguz - Tue, 2013-03-12 08:23

Switching from MySQL/MyISAM to Galera Cluster requires that all tables (except those from the mysql, information_schema and performance_schema) are using the InnoDB Storage Engine.

For altering the Storage Engine of the tables we wrote a script (alter_engine.pl) long time ago already. Because we have made many of those switches recently we have extended its functionality.

New features

  • Recognizes VIEW’s and does NOT try to alter their Storage Engine (bug).
  • Script is MySQL version aware. Complain if …

Taxonomy upgrade extras:  Galera  Myisam  Innodb  Storage Engine 

Block MySQL traffic for maintenance windows

Shinguz - Mon, 2013-02-18 22:32

From time to time some maintenance work on the MySQL database has to be done. During the maintenance window we do not want to have application traffic on the database.

Sometimes it is hard to shut down all applications spread over the whole company. Or we want to allow only some specific hosts to access mysql from remote (for example the monitoring system or the backup server).

For this purpose we can use the Linux packet filtering.

To see what packet filtering rules are available we can run the following …


Taxonomy upgrade extras: 

mpm Agent Lock file

Shinguz - Mon, 2013-02-11 11:05

The mpm agent writes a lock file to prevent that several instances are running at the same time and piling up and possibly slow down the system.

This is the message for. There are several reasons why this message can occur:

  • Agent are started too frequently or are locked by something
  • Agent died and did not clean the lock file
  • Agent quit before cleaning the lock file

Theoretically this message should disappear after a while (10 tries?). You can also try to kill process (3366 in this case) and …


Taxonomy upgrade extras: 

Bootstrapping Galera Cluster the new way

Shinguz - Tue, 2013-02-05 19:18

A while ago it was pretty inconvenient to start a complete Galera Cluster from scratch. Rolling restart an such things are already working well but bootstrapping was a pain.

With Galera v2.2 new functionality came in. We tried it out and it did not work as documented. :-( Thanks to Teemu’s help we found there was a documentation bug in the Galera documentation.

The settings which were working for us are:

wsrep_cluster_address = "gcomm://192.168.1.2,192.168.1.3?pc.wait_prim=no"

And when all …


Taxonomy upgrade extras:  Galera  Cluster 

Shinguz Cheat Sheet

Shinguz - Wed, 2013-01-30 15:03

Copy a directory structure from one to an other server:

tar zcvf - mysql | ssh mysql@laptop3 "cd /home ; tar zxvf -"

Taxonomy upgrade extras: 

Privileges of MySQL backup user for mysqldump

Shinguz - Tue, 2012-12-11 21:34

Some MySQL customers do not want to use the root user for mysqldump backups. For this user you have to grant the following minimal MySQL privileges:

mysqldump --single-transaction (InnoDB)

CREATE USER 'backup'@'localhost' IDENTIFIED BY 'secret';
GRANT SELECT, SHOW VIEW, RELOAD, REPLICATION CLIENT, EVENT, TRIGGER ON *.* TO 'backup'@'localhost';

mysqldump --lock-all-tables (MyISAM)

GRANT LOCK TABLES ON *.* TO 'backup'@'localhost';

If we missed a privilege please let us know.


Taxonomy upgrade extras:  Restore  Recovery  Backup  Mysqldump 

Shrinking InnoDB system tablespace file ibdata1 PoC

Shinguz - Sat, 2012-12-08 13:43

In this weeks MySQL workshop we were discussing, beside other things, about the innodb_file_per_table parameter and its advantages of enabling it. In addition there was a discussion if the InnoDB system tablespace file can be shrinked once it has been grown very large or not. We all know the answer: The InnoDB system tablespace file does never shrink again.

But why should it not be possible? Other databases like for example Oracle can shrink or even get rid of tablespace files… After some …


Taxonomy upgrade extras:  Innodb  Tablespace  Ibdata1  Innochecksum 

Last login of MySQL database users

Shinguz - Sat, 2012-12-01 10:05

MySQL hosting providers can easily loose the overview over their customers and which user or schema is still in use and which not.

The MySQL database becomes bigger and bigger, uses more and more RAM and disk space and the backup takes longer and longer.

In this situation it would be nice to know which MySQL database user has logged in within the last 6 months for example. MySQL database users who did not login within a defined period can be backuped and removed from the production MySQL database.

The …


Taxonomy upgrade extras:  User  Login Trigger  Logon Trigger  Logging  Audit  Hoster  Hosting  Sql/Psm 

MySQL backup to file, gzip and load in one step

Shinguz - Fri, 2012-11-30 00:26

When a MySQL Slave is set-up with mysqldump you have 2 possibilities:

  • You dump into a file and then load the data into the Slave with the mysql client utility.
  • You dump directly into the mysql client utility.

The first possibility has the advantage that you can start the load again if it failed. You can look into the file (and do some changes if needed).
The second possibility has the advantage that you do not need disk space and that it is possibly faster. But when the load fails you have to start from …


Taxonomy upgrade extras:  Backup  Compress 

Resize XFS file system for MySQL

Shinguz - Sat, 2012-11-17 14:30

Important: Before you start any operation mentioned below do a proper file system backup of your XFS file system you want to resize. If MySQL is running on this mount point do this with a stopped mysqld. Alternatively you can also use mysqldump to do the MySQL backup but test the restore time before continuing to not experience ugly surprises…

All these operations have to be performed as the root user. First we want to see what mount points are available:

shell> df -h
Filesystem            Size …

Taxonomy upgrade extras:  Xfs  File System 

MySQL tmpdir on RAM-disk

Shinguz - Thu, 2012-11-15 19:15

MySQL temporary tables are created either in memory (as MEMORY tables) or on disk (as MyISAM tables). How many tables went to disk and how many tables went to memory you can find with:

mysql> SHOW GLOBAL STATUS LIKE 'Created_tmp%tables';
+-------------------------+----------+
| Variable_name           | Value    |
+-------------------------+----------+
| Created_tmp_disk_tables | 49094    |
| Created_tmp_tables      | 37842181 |
+-------------------------+----------+

Tables created in memory are …


Taxonomy upgrade extras:  Temporary  Memory Table  Myisam  Temporary Table  Tmpdir 

Galera Cluster Nagios Plugin

Shinguz - Fri, 2012-09-14 10:49

Based on customer feedback we have decided to add a plugin Galera Cluster for MySQL to our MySQL Nagios/Icinga Plugins.

The module checks, if the node is in status Primary and if the expected amount of Galera Cluster nodes is available. If not, a warning or an alarm is returned.

The script is written in Perl and is Nagios Plugin API v3.0 compatible.

You can download it from our download page.

If you have suggestions for improvements, please contact us. Bugs can be reported at our bugs database.

The …


Taxonomy upgrade extras:  Monitoring  Galera  Plugin  Cluster  Nagios 

Galera Cluster discussions at FrOSCon 2012

Shinguz - Mon, 2012-08-27 17:18

During and after Henriks great talk about Galera Cluster at the FrOSCon 2012 in St. Augustin we found 2 important things related to Galera Cluster for MySQL:

  • The InnoDB double write buffer (innodb_doublewrite) should not be disabled anymore for Galera when using v2.0 and higher!!! The reason for this is: When MySQL crashes InnoDB pages might get corrupted during the crash. They would be fixed by the blocks from the double write buffer during auto-recovery. But if the double write buffer is disabled they …

Taxonomy upgrade extras:  Galera  Cluster  Mysql Cluster  Channel  Failover  Replication 

Pages

Subscribe to FromDual aggregator - MySQL Tech-Feed (en)