[update] May be my use (or misuse) of the seamless_database_pool gem.
I just setup a master/slave setup on Rails3 using seamless_database_pool. Does this mean that the reads are definitely NOT being redirected to the slave?
How can I check this at the MySQL level?
I was hoping show processlist would do this, but I’m not seeing any processes.
[update]
Running show processlist on the master displays the queries being run, so I guess the READs are not being passed to the slave.
The bin_log file just has the following (9’s and x’s added):
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
\# at 4
\#xxxxxxx 99:99:99 server id 2 end_log_pos 106 Start: binlog v 4, server v 5.1.52-log created xxxx 99:99:99 at startup
ROLLBACK/*!*/;
BINLOG '
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxx
'/*!*/;
\# at 106
\#xxxx 99:99:99 server id 2 end_log_pos 125 Stop
DELIMITER ;
\# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
Thanks
It is possible that the processes are too quick for you to catch on “show processlist”. If that is the case, you might be able to turn on logging in my.cnf.
Otherwise, I understand that a slave MySQL is recommended to have binary logging turned on, and you can inspect that with the “mysqlbinlog” utility.
You would go to the directory where MySQL binlogs are stored (on Linux it’s usually /var/lib/mysql or /var/lib/mysql/data), check the various bin files to get the latest – something like thisisyourbinfile.001723 – and just run mysqlbinlog on it. The output is pretty messy, but can be easily parsed with sed or searched with grep.
There are also utilities which will intercept MySQL packets at the network level, and display them on standard output. Most are based on tcpdump, and you actually need little more than tcpdump itself:
e.g. http://www.megalinux.net/using-tcpdump-for-mysql-query-logging/