2

We're trying to setup some basic MySQL Master/Slave replication at our company, and we're confused regarding the unique server_id requirement on replica servers. Quoting the mysql docs:

On the source and each replica, you must set the server_id system variable to establish a unique replication ID in the range from 1 to 2^32 − 1. “Unique” means that each ID must be different from every other ID in use by any other source or replica in the replication topology.

The docs go on to describe another relevant MySQL variable, the server_uuid, emphasis mine:

The MySQL server generates a true UUID in addition to the default or user-supplied server ID set in the server_id system variable. This is available as the global, read-only variable server_uuid.

... When using MySQL replication, sources and replicas know each other's UUIDs.

The docs explicitly elaborate that the server_id is of course still necessary:

The presence of the server_uuid system variable does not change the requirement for setting a unique server_id value for each MySQL server as part of preparing and running MySQL replication, as described earlier in this section.

My question is, why have this manually-set server-id be a requirement, when these more-or-less-guaranteed-unique UUIDs are always available and present?

1
  • The server_id is old; simply set them to distinct values, such as simply 1,2,3,... GTIDs and UUIDs are new. I can't tell if there is any need for server_id anymore. Possibly the documentation has not yet been updated.
    – Rick James
    Apr 5 at 20:12

1 Answer 1

0

You are quoted from the MySQL Docs on this, but you ask why.

The introduction of GTID replication lets each binlog event be represented as a UUID and a transaction number.

What if you do not want to use GTID but you want to set up replication ?

You can run CHANGE MASTER TO using MASTER_AUTO_POSITION=0 to sidestep GTID interpolation. This is why server_id must still be present and ready for use.

You can also deactivate GTID on a primary server and set up, replication the old fashion way. Again, server_id must still be present and ready for use.

What about replicating from older versions of MySQL ? Again, server_id must still be present and ready for use.

Your Answer

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

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