Category: MySQL

MySQL Monitoring With myq_gadgets

Great set of utilities for monitoring MySQL performance: https://github.com/jayjanssen/myq_gadgets/ Here are the steps to install:

The tools will be in the myq_gadgets-master folder. There’s no installer so you can just start using the tools immediately. For instructions see the enclosed README.txt. Also this presentation demonstrates many of the features: http://www.percona.com/live/mysql-conference-2013/sites/default/files/slides/myq_gadgets%20talk.pdf

Read More »

Sync MySQL Slave From Another Slave On Amazon AWS

I was looking for a procedure to setup a new MySQL replication slave on Amazon AWS without having to do a MySQL dump of the master. Ended up using a couple of AWS features to make this an easy process. Let’s assume that we have a master server (master01) and a slave (slave01). We want to create a new slave (slave02). We’ll do this without taking the master offline and without doing a MySQL dump. This is especially important with large databases. A couple of notes before we start: On AWS we put MySQL storage on it’s own EBS storage volume. We create a new empty volume, partition, add LVM and then format with xfs. This makes it easy to add additional storage in the future. We prefer to use the innodb-file-per-table setting in my.cnf to force MySQL to use a separate file for each InnoDB table. This keeps all the files

Read More »

MySQL Defrag Script

Here’s a great script for optimizing MySQL tables: http://www.dufault.info/blog/a-script-to-optimize-fragmented-tables-in-mysql/ You can install and run with:

Read More »

Force MySQL to UTF-8 Encoding

Recently learned that mysql-proxy does to issue SET statements to read-only slaves when doing read/write splitting. This create a problem when the client wants to set the character set. The work around is to force all connections to the server to the desired character set which in this case is UTF-8. Add the following lines to the “[mysqld]” section of /etc/my.cnf on the server:

Read More »

Change MySQL InnoDB Log File Size

Here’s my procedure for changing innodb_log_file_size: SET GLOBAL innodb_fast_shutdown = false; SET GLOBAL innodb_max_dirty_pages_pct = 0; /sbin/service mysqld restart /sbin/service mysqld stop rm -f /var/lib/mysql/ib_logfile[01] Edit /etc/my.cnf and set new value for innodb_log_file_size /sbin/service mysqld start Here’s a handy sql command to determine a good log file size:

then do this:

to get the MB per minute. Set the log file size to be large enough to hold one hour of logs. See http://www.mysqlperformanceblog.com/2008/11/21/how-to-calculate-a-good-innodb-log-file-size/ for the full discussion.

Read More »

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.