Hi!
I have the following configuration:
1 master (192.168.82.161) and 1 slave (192.168.82.162). And mysql-proxy running on another
machine (192.168.82.163).
I've started mysql-proxy with the following configuration:
mysql-proxy --admin-username=root --admin-password=root
--admin-lua-script=/usr/local/lib/mysql-proxy/lua/admin.lua
--proxy-lua-script=/root/mqlr/mysql-proxy/first_example.lua --proxy-backend-addresses
192.168.82.161:3306 --proxy-backend-addresses 192.168.82.162:3306
The Lua script (first_example.lua) consists on this:
function read_query(packet)
if string.byte(packet) == proxy.COM_BINLOG_DUMP then
print("Received the packet COM_BINLOG_DUMP")
proxy.queries:append(1, packet)
return proxy.PROXY_SEND_QUERY
end
if string.byte(packet) == proxy.COM_QUERY then
print("Received the query: " .. string.sub(packet, 2))
end
if string.byte(packet) == proxy.COM_CREATE_DB then
print("Received the create database statement: " .. string.sub(packet, 2))
end
end
--
I start the mysql-proxy, and the master and slave. In the slave I use this configuration:
CHANGE MASTER TO MASTER_HOST='192.168.82.163', MASTER_USER='repl',
MASTER_PASSWORD='repl', MASTER_LOG_FILE='mysqld-bin.000001', MASTER_LOG_POS=0,
MASTER_PORT=4040;
After that I start the slave, and everything goes OK. I receive on the mysql-proxy the
following:
Received the query: SELECT UNIX_TIMESTAMP()
Received the query: SHOW VARIABLES LIKE 'SERVER_ID'
Received the packet COM_BINLOG_DUMP
--
But when I execute some statement on the master like create database x, or some SQL query
I don't receive anything on the mysql-proxy. It was supposed to do the prints that I've
write on the lua script.
So, can someone help me with this? Maybe I am misunderstanding mysql-proxy functioning.
Thanks in advance,
Miguel Araújo
On May 25, 2010, at 4:28 PM, Mats Kindahl wrote:
> On 05/25/2010 05:24 PM, Miguel Araújo wrote:
>> Hi.
>>
>> Does anyone knows how mysq-proxy interacts with replication?
>> I've never used mysql-proxy, and I need an application that stand between the
> master and the slave to analyze the updates that go through the master to the slave. I
> wonder if I should start with mysq-proxy instead of starting from the scratch.
>> Thank you.
>>
>> Regards,
>> Miguel Araújo
>>
>
> Hi again Miguel! :)
>
> Yes, I think it is a good idea to start with the proxy instead of
> starting from scratch.
>
> What is it you want to do?
>
> Best wishes,
> Mats Kindahl
>
> --
> Mats Kindahl
> Lead Software Developer
> MySQL Replication, Oracle
>
>
> --
> MySQL Replication Mailing List
> For list archives: http://lists.mysql.com/replication
> To unsubscribe: http://lists.mysql.com/replication?unsub=1
>