Error
Error Code:
1650
MySQL Error 1650: Conflicting Replica Server IDs
Description
This error indicates a clash between the replica's configured `server_id` and the `--replicate-same-server-id` startup option. It typically occurs when a MySQL replica attempts to start or connect to a master, but its identification settings are inconsistent with the intended replication strategy, preventing proper replication from initiating.
Error Message
The requested server id %d clashes with the replica startup option --replicate-same-server-id
Known Causes
3 known causesMismatched Server IDs
The replica's `server_id` is different from the master's, yet the `--replicate-same-server-id` option is enabled, which is intended for scenarios where master and replica share the same ID.
Incorrect Option Usage
The `--replicate-same-server-id` option is enabled in the replica's configuration without a clear understanding of its specific purpose or when it is truly needed for the replication topology.
Duplicate Server IDs
Both the master and replica servers are configured with the exact same `server_id`, and the `--replicate-same-server-id` option is also active, leading to an invalid or confusing state for replication.
Solutions
3 solutions available1. Adjust Server ID in Replication Configuration easy
Modify the server ID to a unique value that doesn't conflict with existing replica configurations.
1
Identify the conflicting server ID. The error message will usually indicate the problematic ID (e.g., `%d`).
2
Locate your MySQL configuration file (e.g., `my.cnf` or `my.ini`). This is often found in `/etc/mysql/`, `/etc/`, or the MySQL installation directory.
3
Open the configuration file with a text editor.
4
Find the `server-id` directive within the `[mysqld]` section. If it's set to the conflicting ID, change it to a unique positive integer that is not currently in use by any other replica in your replication topology. A common practice is to use sequential numbers.
[mysqld]
server-id = <new_unique_server_id>
5
Save the configuration file.
6
Restart the MySQL server for the changes to take effect.
sudo systemctl restart mysql
2. Remove or Correct `replicate-same-server-id` Directive easy
Disable or correct the `replicate-same-server-id` option if it's causing a conflict.
1
Locate your MySQL configuration file (e.g., `my.cnf` or `my.ini`).
2
Open the configuration file with a text editor.
3
Look for the `replicate-same-server-id` directive within the `[mysqld]` or `[replication]` section. This option is typically used for specific advanced scenarios and can cause this error if not properly managed.
4
If this directive is present and causing the conflict, you have two options:
1. **Remove it:** If you don't intend to use this feature or if it's misconfigured, simply delete the line.
2. **Correct it:** If you intended to use `replicate-same-server-id`, ensure that the `server-id` is set to a value that is *not* used by any other replica. This directive effectively tells a replica to use its own `server-id` as the ID of the server it's replicating from. If your `server-id` is already in use by another replica, this will cause a clash.
1. **Remove it:** If you don't intend to use this feature or if it's misconfigured, simply delete the line.
2. **Correct it:** If you intended to use `replicate-same-server-id`, ensure that the `server-id` is set to a value that is *not* used by any other replica. This directive effectively tells a replica to use its own `server-id` as the ID of the server it's replicating from. If your `server-id` is already in use by another replica, this will cause a clash.
# Option 1: Remove the directive
# replicate-same-server-id
# Option 2: Ensure server-id is unique if using this directive
# [mysqld]
# server-id = <unique_server_id>
# replicate-same-server-id
5
Save the configuration file.
6
Restart the MySQL server.
sudo systemctl restart mysql
3. Verify and Update Replication Metadata advanced
Ensure that the replication metadata in the master and replica are consistent and don't contain conflicting IDs.
1
Connect to your MySQL replica server.
mysql -u <username> -p
2
Check the current replication status and identify the master's server ID.
SHOW REPLICA STATUS\G
3
Note the `Master_Server_ID` from the output of `SHOW REPLICA STATUS`. This is the ID of the server the replica is attempting to connect to.
4
Compare this `Master_Server_ID` with the `server-id` configured on your replica. If they are the same, and this ID is also used by another replica, you have a conflict.
5
If a conflict is detected, you'll need to either:
a) Change the `server-id` of the replica (as described in Solution 1).
b) If the replica is supposed to replicate from a different master, update the `CHANGE REPLICATION SOURCE TO` (or `CHANGE MASTER TO` in older versions) command to point to the correct master and ensure its `server-id` is unique. If `replicate-same-server-id` is being used, ensure the master's `server-id` is distinct.
a) Change the `server-id` of the replica (as described in Solution 1).
b) If the replica is supposed to replicate from a different master, update the `CHANGE REPLICATION SOURCE TO` (or `CHANGE MASTER TO` in older versions) command to point to the correct master and ensure its `server-id` is unique. If `replicate-same-server-id` is being used, ensure the master's `server-id` is distinct.
CHANGE REPLICATION SOURCE TO SOURCE_HOST='<new_master_host>', SOURCE_USER='<replication_user>', SOURCE_PASSWORD='<replication_password>', SOURCE_PORT=<replication_port>, SOURCE_SERVER_ID=<correct_master_server_id>;
6
After making any necessary configuration changes or `CHANGE REPLICATION SOURCE TO` commands, restart the replica's I/O thread.
START REPLICA IO_THREAD;
7
If changes were made to the `server-id` in the configuration file, restart the entire MySQL server.
sudo systemctl restart mysql