Download the PHP package userqq/mysql-binlog without Composer
On this page you can find all versions of the php package userqq/mysql-binlog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download userqq/mysql-binlog
More information about userqq/mysql-binlog
Files in userqq/mysql-binlog
Package mysql-binlog
Short Description MySQL/MariaDB binlog listener
License MIT
Informations about the package mysql-binlog
Pure php MySQL/MariaDB replica client.
This package enables you to react to changes in your database without creating additional load on it, such as triggers, and performs faster than similar solutions. It impersonates a replica and uses binlog from MySQL/MariaDB to track changes in the database. When data changes, a database writes an event to binlog, which could be converted to JSON. This JSON can be sent to any destination, such as Apache Kafka, Kinesis, RabbitMQ or directly to other databases such as MongoDB, ClickHouse, Elastic to ensure fast and efficient data processing. With this package, you can have a copy of your database with a delay of minutes or even seconds, no matter how large your database is.
It can be useful for companies that want to keep a copy of their data in other systems to ensure more reliable storage or to process data with other tools. also it be used to send data to message queues, making it easier to process and analyze data in real-time. Therefore, companies can take advantage of the benefits of message queueing systems, such as load balancing, scalability, and fault-tolerance, while still maintaining a reliable copy of their data in other systems.
Installation
This package can be installed as a Composer dependency.
Сonfiguration
Database configuration
In order to parse data from the binlog without additional actions and without excessive requests to the information_schema, the database must be properly configured. This allows for the re-reading of the data types and column names without additional requests, and thus the data stored in the binlog can be re-read even without the database, while still providing all the details about the data.
This library requires the binlog_row_metadata
option, which is available in MySQL >= 8.0.1 or in MariaDB >= 10.5.0. The binlog_row_metadata
option must be set to FULL
to ensure that all necessary metadata is included in the binlog for proper parsing.
Just add the following config from example below to your database configuration, then restart the database and prune old binary logs:
This will flush the current binary log to disk and then remove all binary logs before the current time.
Usually you can find config in /etc/mysql
directory.
Binlog reader configuration
To simplify configuration library exposes UserQQ\MySQL\Binlog\Config
class:
Here is a list of available configuration options:
Please refer to Config.php
for more details
Run the application
Then just create an instance of UserQQ\MySQL\Binlog\EventsIterator
and iterate over it.
Run inserts, updates, and deletes on your database and see how it reacts!
See the examples
folder for more examples.
All versions of mysql-binlog with dependencies
ext-gmp Version *
ext-pcntl Version *
amphp/amp Version ^3
amphp/file Version ^3
amphp/log Version v2.0.0-beta.2
amphp/socket Version ^2
monolog/monolog Version ^3
revolt/event-loop Version ^1