Error: A slave with the same server_uuid/server_id as this slave has connected to the master;
See original GitHub issueHi @rodrigogs,
Has been working great! But looking at the log error I saw a new one:
‘A slave with the same server_uuid/server_id as this slave has connected to the master; the first event 'mysql-bin.000089' at 43535345, the last event read from '/mysql/binlog/mysql-bin.000089' at 56994447, the last byte read from '/mysql/binlog/mysql-bin.000089' at 56994447.’, sqlState: ‘HY000’ }
I have 2 databases (Production, Development ) And have 2 listeners that gives this error
My Code Dev
const mysql = require('mysql');
var MySQLEvents = require("@rodrigogs/mysql-events");
const schemaName ='nms';
My Code Prod
const mysql = require('mysql');
var MySQLEvents = require("@rodrigogs/mysql-events");
const schemaName ='nmsProd';
Same code for both
const db_config = { host: '35.234.131.94', user:XXX', password: XXX', database: schemaName, };
let connectDB = mysql.createConnection(db_config);
let instance = new MySQLEvents(connectDB, {
startAtEnd: true,
excludedSchemas: {
mysql: true
},
});
startTrigers();
function handleDisconnect() {
console.log('handleDisconnect');
connectDB.destroy();
connectDB = mysql.createConnection(db_config);
connectDB.connect(function (err) {
if (err) {
console.log(' Error when connecting to db (DBERR001):', err);
setTimeout(handleDisconnect, 1000);
}
else{
// startTrigers();
}
});
}
instance.on(MySQLEvents.EVENTS.CONNECTION_ERROR, (err) => {
console.log('Connection is asleep (time to wake it up): ', err);
setTimeout(handleDisconnect, 1000);
handleDisconnect();
});
instance.on(MySQLEvents.EVENTS.ZONGJI_ERROR, console.error);
function startTrigers() {
instance.start();
instance.addTrigger({
name: 'ALERT_INSERTED',
expression: schemaName + '.nms_alert',
statement: MySQLEvents.STATEMENTS.INSERT,
onEvent: (event) => {
console.log("", new Date());
console.log("==== ALERT INSERTED ===");
sendAlert(event);
},
});
Do I have to change something?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
error 1236 A slave with the same server_uuid/server_id as this ...
This is for example needed for replication using GTIDs. The server UUID is stored in the file auto.cnf which is located in the...
Read more >What does this error mean "A slave with the same server_uuid ...
I am running a multi-source replica and this error is from just 1 source. here is the complete error: Got fatal error 1236...
Read more >Slaves with same server_id / server_uuid compete for master ...
How to repeat: Try to set up replication with two slaves with same server_uuid Suggested fix: Reject the new connection with an appropriate ......
Read more >error 1236 A slave with the same server_uuid/server_id as this ...
error 1236 A slave with the same server_uuid/server_id as this slave has connected to the master · - retransmitir datos a un servidor....
Read more >Replication slave loses connection and does not recover
A recurring problem on a replicated MariaDB 10.3.8 instance (running ... (A slave with the same server_uuid/server_id as this slave has co) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
please don’t flame me, i’m really new with nodejs, i don’t know exactly what i’m doing. But to solve this problem I assigned a random value, (more precisely the current date) so I know it will never have the same value.
is this totally wrong?
Hi, I have this error before, my environment was a master and some slave database, there is replication from slave-db to master-db and if I using mysql-events plugin to connect from another vm, it get error (A slave with the same server_uuid/server_id as this slave has connected…) Found solustion by connect with another user with REPLICATION_SLAVE & REPLICATION_CLIENT privileges and unique server_id from concurrent connection https://dba.stackexchange.com/questions/231414/error-a-slave-with-the-same-server-uuid-server-id-as-this-slave-has-connected