0

i have now setup a Master => Slave setup, after hard fightning its now working and this is great.

the next step is, how can tell the slave if i create a new table/stroed procured or function on my Master its need to copy that to?

right now i need to run my sync script for on the master and the slave, i think if i got a lot of slaves this will be a big problem, so i hope there are a friendly person there can explain what to do now?

so what i need is i'm only need to consentrat about my Master setup, and lat the slaves copy every thing from my master and not only the row's i, can i that? and how.

1 Answer 1

1

The intent of replication is that the dataset on the Slave is always identical to what is on the Master.

But, Stored Procedures, Stored Functions, Triggers, and Events may (or may not) do things that should not be re-done on the slave. Therefore, you must decide case by case whether you want them to be on both servers.

To apply a CREATE to all your slaves -- that should be as simple as a script that connects to each slave and performs the same query.

mysqldump is cautious about dumping such Routines, for fear that you will use the dump to initialize a Slave.

The prime example of something that should not be on the Slaves: A Trigger that Inserts a row into another table. And you have Row Based Replication. The Insert is already sent to the Slave via RBR, and the Slave has no way to perform a Trigger on something in the replication stream anyway.

3
  • Thanks sound good, now i'm a little confuset, when i have setup my Master => will MySQL not selv handle selects on all master+slaves or shout i tell it every time i create a select in SQL? i know i don't need to insert into slaves ofc. but i think what happen when i send a select to my Master will its spilt this out on all slaves server or shout i tell it every time i create a single select? Commented Jun 14, 2015 at 9:42
  • A SELECT will be performed only on the one machine you send it to. Any machine can handle a SELECT. You should write only to the Master and let replication propagate it to the Slave(s). There are add-on load balancers / proxies that send queries to different machines. However, using that for a SELECT may lead to problems with "critical reads".
    – Rick James
    Commented Jun 14, 2015 at 16:57
  • Thanks a lot, :) i will read more op on it and look how a proxy server will working width MySQL so thanks a lot ^^ Commented Jun 15, 2015 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.