MySQL partition is full

Saturday, September 5th, 2009

MySQL databases are located on /var/lib/mysql, if you create a partition for /var and and big enough to hold your databases MySQL will stop working because not enough space to put the data. Below is the easy way to fix it:
(more…)

SocialTwist Tell-a-Friend

Replacing A Failed Hard Drive In A Software RAID1 Array

Tuesday, June 23rd, 2009

I was checking Development MySQL server (what did you know, I am not that lazy) and I found errors at /var/log/messages, I assume the secondary HDD (/dev/hdb) failed. Fiuh, I am lucky configured this server using Software-Raid1 otherwise all data has gone.

Jun 19 15:51:56 dbdemo smartd[2117]: Device: /dev/hdb, 37997 Currently unreadable (pending) sectors
Jun 19 15:51:56 dbdemo smartd[2117]: Device: /dev/hdb, 37997 Offline uncorrectable sectors
Jun 19 16:21:57 dbdemo smartd[2117]: Device: /dev/hdb, 38010 Currently unreadable (pending) sectors
Jun 19 16:21:57 dbdemo smartd[2117]: Device: /dev/hdb, 38010 Offline uncorrectable sectors
Jun 19 16:23:47 dbdemo kernel: hdb: task_in_intr: status=0x59 { DriveReady SeekComplete DataRequest Error }

Luckily, uncle Google very nice to me and show me article on Howtoforge.com, following the article I am confident to replace failed harddisk. Below is my Raid configuration:

Array: /dev/md0; Member: /dev/hda1 /dev/hdb1; Raid: 1; Filesystem: ext3fs; mountpoint: /boot
Array: /dev/md1; Member: /dev/hda2 /dev/hdb2; Raid: 0; Filesystem: swap; mountpoint: swap
Array: /dev/md2; Member: /dev/hda3 /dev/hdb3; Raid: 1; Filesystem: ext3fs; mountpoint: /

Summary of Howtoforge’s article is below:

(more…)

SocialTwist Tell-a-Friend

SQL Error: Table ‘mysql.proc’ doesn’t exist

Thursday, June 18th, 2009

Today I upgraded my HeidiSQL into version 4, but when I am running it on the MySQL server 5.0 I got error

"SQL Error: Table 'mysql.proc' doesn't exist"

After googling around, found that this error caused HeidiSQL requires table Mysql.proc which is not exist. Table Mysql.proc is used to store procedure. But wait, I am using MySQL 5.0.x which already support Procedures and Views!! so How come this error show up??

After some tought, the are several reason why this error came up although you are using MySQL 5.

  1. You are upgrading from MySQL 4.x
  2. Your MySQL 5.x installation didn’t smooth

And in my case, it was reason no. 1, as I am remember I was once upgrade mysql server a year ago. So how to fix it? (more…)

SocialTwist Tell-a-Friend

Script to Monitor Replication

Monday, February 9th, 2009

Since I sometimes get replication problem, so I make several script to check replication automatically and report to me:

To check replication status when I in the console and playing with replication configuration or when I have nothing to do yet I want to see a black screen :D

monitorreplication.sh

#!/bin/bash
while [ 1 ]
do
        # Your code goes here
        echo ""
        date
        echo "=============================="
        mysql -u backup -pmysqlback -e "show slave status\G;"

        # Modify sleep time (in seconds) as needed below
        sleep 10
done

Another scripts to send replication status via email
(more…)

SocialTwist Tell-a-Friend

Replication stop – Relay log file corrupt

Monday, February 9th, 2009

Okay it’s the second time this problem arise, so I’ll put a blog here just incase it happen again in near future. The replication on slave server just stop working with error

Could not parse relay log event entry. The possible reasons are: the master’s binary log is corrupted (you can check this by running ‘mysqlbinlog’ on the binary log), the slave’s relay log is corrupted (you can check this by running ‘mysqlbinlog’ on the relay log), a network problem, or a bug in the master’s or slave’s MySQL code. If you want to check the master’s binary log or slave’s relay log, you will be able to know their names by issuing ‘SHOW SLAVE STATUS’ on this slave.

Googling up and check several paramters:

on master server:

mysql> show master status\G;
*************************** 1. row ***************************
File: replication.011
Position: 130848689
Binlog_do_db:
Binlog_ignore_db:
1 row in set (0.00 sec)

on slave server:

mysql> show slave status\G;
*************************** 1. row ***************************
Master_Host: 10.10.105.11
Master_User: repl
Master_Port: 3306
Connect_retry: 60
Master_Log_File: replication.011
Read_Master_Log_Pos: 91831752
Relay_Log_File: dragon-relay-bin.183
Relay_Log_Pos: 3551175
Relay_Master_Log_File: replication.011
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_do_db:
Replicate_ignore_db:
Last_errno: 0
Last_error: Could not parse relay log event entry. The possible
reasons are: the master's binary log is corrupted (you can check
this by running 'mysqlbinlog' on the binary log), the slave's
relay log is corrupted (you can check this by running 'mysqlbinlog'
 on the relay log), a network problem, or a bug in the master's or
slave's MySQL code. If you want to check the master's binary log or
slave's relay log, you will be able to know their names by issuing
'SHOW SLAVE STATUS' on this slave.
Skip_counter: 0
Exec_master_log_pos: 74359528
Relay_log_space: 21023399

[root@dragon mysql]# tail -f dragon.rpxholding.com.err
081129  0:54:24 Error in Log_event::read_log_event(): 'read error',
 data_len: 148, event_type: 2 081129  0:54:24 Error reading relay
log event: slave SQL thread aborted because of I/O error 081129 0:54:24
Slave: Could not parse relay log event entry. The possible reasons are:
the master's binary log is corrupted (you can check this by running
'mysqlbinlog' on the binary log),  the slave's relay log is corrupted
(you can check this by running 'mysqlbinlog' on the relay log), a network
problem, or a bug in the master's or slave's MySQL code. If you want to
check the master's binary log or slave's relay log, you will be able to
know their names by issuing 'SHOW SLAVE STATUS' on this slave. Error_code: 0

Slave IO and SQL are not running. What caused the problem  ? binlog file at master is not corrupted. That’s great and very good news. But relay log file at slave is corrupted. That’s what make replication can’t read it. Fixing the problem:

(more…)

SocialTwist Tell-a-Friend