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?
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.