0

I am using @rodrigogs/mysql-events to listen to DB events on an mysql DB. So far works pretty well, except that I am getting the following error when I have more than one client listening to the DB:

A slave with the same server_uuid/server_id as this slave has connected to the master

Through some research I was told that each client are seen as replication servers by the core server, and as such must each present a different serverId in order to avoid collision.

As per the @rodrigogs/mysql-events documentation, I did pass the "serverID" option as shown below, but the errors continue to happen, and the binlog only reports connections from Server ID 2. What am I missing?

const instance = new MySQLEvents(DBcon, {
        startAtEnd: true,
        serverId: 5,
        excludedSchemas: {
                mysql: true,
        }
});
ChrisF
  • 57
  • 9

1 Answers1

0

So I found the solution. Turns out that the above configuration is correct. I had an error in some downstream code. I also improved it so that each client uses a different serverId, depending on the host environment:

const instance = new MySQLEvents(DBcon, {
        startAtEnd: true,
        serverId: process.env.HOSTNAME == ProdHost ? 5 : 66,
        excludedSchemas: {
                mysql: true,
        }
});
ChrisF
  • 57
  • 9