This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
node-task/node_modules/mysql2/examples/binlog-watcher.js

17 lines
486 B
JavaScript

var mysql = require('../test/common').createConnection();
var through2 = require('through2');
var binlogStream = mysql.createBinlogStream({
serverId: 123, // slave ID, first field in "show slave hosts" sql response
// you can also specify slave host, username, password and port
masterId: 0,
filename: 'mysql-bin.000007',
binlogPos: 120,
flags: 1, // 1 = "non-blocking mode"
});
binlogStream.pipe(through2.obj(function(obj, enc, next) {
console.log(obj);
next();
}));