1
votes

I have a couple of servers and I want to prepare a Master - Slave Mysql replication for one database. The both servers have many databases and I don't want to altere the secuence of ID generation. For example, after I have prepared the configuration I don't want to have in the tables just even numbers for the all the IDs in one of servers.

The replicated database (slave server) will be not accesed for write.

Is posible to configure that scenario? Many thanks in advance.

1
It was my fault don't understand the documentation well and mixed the parameters server_id and auto_increment_increment. Now I have configured it and it works well. The only thing to keep in mind is to add the parameters in my.cnf within the [mysqld] section. I didn’t, and it did not run until I’ve been realised that was for this reason. I'm not sure if I must to delete this question as it could not contribute with anything to other users. - MikeBau

1 Answers

1
votes

Update: The server_id has nothing to do with id generation. It just needs to be a unique integer greater than 0 on each server in your replica-set.


Below is my original answer, which was my guess about what you were asking about, because it's the only feature I could think of that has to do with both replication and auto-increment id generation.

You don't need to change id generation for simple replication.

The scenario where you might use auto_increment_increment=2 is the master-master replication, where two servers replicate from each other, and you want to minimize the risk of split-brain if an insert occurs on both servers. But this is not the scenario you describe.

If you have one master, and it's the only server you write changes on directly, and the replica(s) that replicate from that master are all read-only, then you don't need to change the auto_increment_increment.