Quantcast
Channel: MySQL Forums - Replication
Viewing all articles
Browse latest Browse all 1562

Master to Slaves replication setup problem (no replies)

$
0
0
Hello everyone,

I would like to hear the help/opinions/suggestions of everyone in this forum.

I am still a newbie in MySQL but wanted to enhance further my knowledge about it. I am currently setting up a Mysql 5.5 Replication environment with 1 Master to many Slaves, and the setup is almost done. The current setup is configured wherein the Master could function also as a slave to each Slaves, and each Slaves could also function as a Master to the real Master server. This setup is done so that both Master and Slaves could update each other. And both sides(Master and Slaves) could already replicate with each other. The next setup is to configure the real Master server to send data(e.g. upon insert) to each specific Slaves(e.g. Slave1, Slave2, etc.) depending on what I inserted, e.g., I insert in the real Master server a record for Slave1 and another one for Slave2, both of this data are for specific Slaves and should not exist in the other Slaves other than the real Master. I know both insert statements will be logged in Master binary log before every connected Slaves will pull that log, but I do not know if its possible to have such configuration, my question are:

1. Is it possible to have this kind of configuration? If not, how should I do this kind of requirement?
2. Is there a way to limit the binary log output to a specific statement(e.g. upon INSERT) only, so that each Slave relay log will only have its specific SQL statement to execute?
3. Is there a way to filter out the binary log of Master while the Slaves Relay log is copying the Masters binary log?
4. I have also tried using a db TRIGGER created in the Slaves to filter out the record of each Slaves depending on its unique Slave server id field, as I have got an idea by reading the the ff. entries: http://forums.mysql.com/read.php?99,55023,55024#msg-55024, http://rpbouman.blogspot.com/2005/11/using-udf-to-raise-errors-from-inside.html but it seems that what I tried fails and the record is still inserted. Any idea on how I should do the TRIGGER, if it is possible? Example code snippet is below:


Please note also that this TRIGGER is only applied to the Slaves.
CODE:
-----Begin------
CREATE TRIGGER myTrigger BEFORE INSERT ON test
FOR EACH ROW
BEGIN
IF (NEW.server_id = 'Slave 1') THEN
/* Insert into test */
ELSE
/* Reject and do not insert into test */
END IF;
END;
-----End------


Hope I have clearly explained the situation. I would appreciate any opinion/suggestion/help that anyone can give.

Thanks in advance.

Regards,
Ben

Viewing all articles
Browse latest Browse all 1562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>