rodrigogs / mysql-events

A node package that watches a MySQL database and runs callbacks on matched events.
BSD 3-Clause "New" or "Revised" License
136 stars 52 forks source link

AWS MySql RSD not working #33

Closed AviFix closed 3 years ago

AviFix commented 3 years ago

Hi

I'm trying to monitor my MySQL rds DB. I get the log message "Waiting for database vents" bu nothing happens when I change values in the DB tables

I'm using this example code `

const MySQLEvents = require('@rodrigogs/mysql-events');

const program = async () => {
    const instance = new MySQLEvents({
        host: DB_HOST,
        user: DB_USER,
        password: DB_PASSWORD,
     }, {
         startAtEnd: true,
    });

    await instance.start();

    instance.addTrigger({
        name: 'Whole database instance',
        expression: '*',
        statement: MySQLEvents.STATEMENTS.ALL,
        onEvent: (event) => {
            console.log(event);
        },
    });

     instance.on(MySQLEvents.EVENTS.CONNECTION_ERROR, console.error);
     instance.on(MySQLEvents.EVENTS.ZONGJI_ERROR, console.error);
};

program()
    .then(() => console.log('Waiting for database vents...'))
    .catch(console.error);

`

Any ideas?

Chonne commented 3 years ago

In your parameter group, is binlog_format set to "ROW"? I think I had the same issue, RDS' default value being "MIXED".

Also, if you use RDS and decide to eventually use the latest binlog position, keep in mind that RDS regularly purges the binlogs, unless you set the binlog retention yourself (not as a mysql config parameter): https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/mysql_rds_set_configuration.html#mysql_rds_set_configuration-usage-notes.binlog-retention-hours

AviFix commented 3 years ago

Thanks a lot That fixed it

AltayAkkus commented 3 years ago

Thanks a lot That fixed it

mind closing the issue :smile: