Posted on December 29, 2008 by Alex
Every hour, we saw the diskspace on our root partition go up from 45 % to 90 % and come back to 45 %. Initially thought mysql was processing some temp tables and in the next hour we kept watching the temp location. In terms of files / diskspace usage using “du / ls” nothing [...]
Filed under: mysql | Tagged: disk, mysql | 3 Comments »
Posted on August 12, 2008 by Alex
Problem Statement : 386 GB of MySQL 5.0 Compressed MyISAM tables (Merge engine used) need to be migrated to MySQL 5.1 Compressed/Partitioned tables. Also we had to add a few new columns and change the datatype of few existing columns.
Initial plan : Setup the MySQL 5.1 database with the schema with partitioning to which the [...]
Filed under: mysql | Tagged: mysql, Technology | 3 Comments »
Posted on May 13, 2008 by Alex
One of our peer group developers contacted me today stating that they were inserting a value of 10 in one of the columns in their tables. But after the insert, when they query the table they were getting the value as 0.
Logged into the box to check what was happening. Luckily binlog was turned on [...]
Filed under: mysql | Tagged: binlog, mysql | Leave a Comment »
Posted on April 25, 2008 by Alex
The slave failed with the error that the relay binlog is corrupt. It had copied close to 12 binlogs from the master and they were yet to be applied. Unfortunately those binlogs have been purged on the master. Now to sync up cleanly we might have to refresh data from the master which can be [...]
Filed under: mysql | Tagged: corruption, mysql, relay log, replication, slave | Leave a Comment »
Posted on April 7, 2008 by Alex
All production servers are normally installed using kickstart files. Unfortunately, the ks file had a bug that it didnt add a swap partition if there was only one logical or physical disk.
Once the database was setup without swap, the configuration was sized such that all processes fit into memory. But we started seeing OOM killing [...]
Filed under: mysql | Tagged: linux, mysql, OOM, swap | 1 Comment »
Posted on April 4, 2008 by Alex
Whenever we load data into a MySQL database the following settings can help speed up the import.
innodb_flush_log_at_trx_commit = 0
innodb_support_xa = 0
skip-innodb_doublewrite
If the host doesn’t have slaves, and if log-bin is turned on, turning it off using set SQL_LOG_BIN=0 or commenting out log-bin in my.cnf will also help. Similarly disabling other logs like update [...]
Filed under: mysql | Tagged: data load, mysql, optimization | Leave a Comment »
Posted on April 4, 2008 by Alex
The following one liner helps to sync a slave that is facing duplicate entry errors.
while [ 1 ]; do if [ `mysql -u root -e "show slave status \G;" | grep "Duplicate entry" | wc -l` -eq 1 ] ; then mysql -u root -e “stop slave; set global sql_slave_skip_counter=1; start slave;”; fi; sleep [...]
Filed under: mysql | Tagged: bash, corruption, mysql, relay log, replication, sync | 1 Comment »
Posted on April 3, 2008 by Alex
On a RHEL 4u4 host run the following wget commands to get the necessary source code.
wget http://gd.tuwien.ac.at/graphics/gimp/gtk/v2.6/glib-2.6.4.tar.bz2
wget http://dev.mysql.com/get/Downloads/MySQL-Proxy/mysql-proxy-0.6.1.tar.gz/from/http://mysql.easynet.be/
wget http://luaforge.net/frs/download.php/3132/lua5_1_3_Sources.tar.gz
wget http://monkey.org/~provos/libevent-1.3d.tar.gz
Untar all the files and run configure , make and make install.
To tackle few of the hiccups that you might encounter, you can install glib on to a location that is different from your root.
For Glib [...]
Filed under: mysql | Tagged: build, mysql, mysql-proxy, rhel | Leave a Comment »
Posted on March 30, 2008 by Alex
For commenting the following snippets can be used :
sudo perl -i -p -e ‘ print “#” . ” ” if !/^#/ && /^read-only/; ‘ /etc/my.cnf
sed -i -e ’s/^read-only/#&/g’ cnf
For uncommenting you can use the following snippets :
sudo perl -i -p -e ’s/^#// if /^#/ && /read-only/; ‘ /etc/my.cnf
sed -i -e ’s/^#*read-only/read-only/g’ cnf
Filed under: mysql | Tagged: commet, inline, my.cnf, perl, sed | Leave a Comment »
Comment/Uncomment all cron tab entries in one shot
Comment :
sed -i -e ‘/^[ ]*[0-9]/ s/^/#/g’ /var/spool/cron/mysql
Uncomment :
sed -i -e ‘/^#*[ ]*[0-9]/ s/^#*[ ]*//g’ /var/spool/cron/mysql
Filed under: mysql | Tagged: comment, crontab, sed | Leave a Comment »