You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pure PHP Implementation of MySQL replication protocol. This allow you to receive event like insert, update, delete with their data and raw SQL queries.
10
10
11
11
Based on a great work of creators:https://github.com/noplay/python-mysql-replication and https://github.com/fengxiangyun/mysql-replication
'eventsOnly' - array to listen on events (full list in [ConstEventType.php](https://github.com/krowinski/php-mysql-replication/blob/master/src/MySQLReplication/Definitions/ConstEventType.php) file)
99
+
'eventsOnly' - array to listen on events (full list in [ConstEventType.php](https://github.com/moln/php-mysql-replication/blob/master/src/MySQLReplication/Definitions/ConstEventType.php) file)
93
100
94
-
'eventsIgnore' - array to ignore events (full list in [ConstEventType.php](https://github.com/krowinski/php-mysql-replication/blob/master/src/MySQLReplication/Definitions/ConstEventType.php) file)
101
+
'eventsIgnore' - array to ignore events (full list in [ConstEventType.php](https://github.com/moln/php-mysql-replication/blob/master/src/MySQLReplication/Definitions/ConstEventType.php) file)
95
102
96
103
'tablesOnly' - array to only listen on given tables (default all tables)
All examples are available in the [examples directory](https://github.com/krowinski/php-mysql-replication/tree/master/example)
128
+
All examples are available in the [examples directory](https://github.com/moln/php-mysql-replication/tree/master/example)
122
129
123
130
This example will dump all replication events to the console:
124
131
@@ -397,14 +404,14 @@ FAQ
397
404
Well first of all mysql don't give you async calls. You usually need to program this in your application (by event dispaching and adding to some queue system and if your db have many point of entry like web, backend other microservices its not always cheap to add processing to all of them. But using mysql replication protocol you can lisen on write events and process then asynchronously (best combo it's to add item to some queue system like rabbitmq, redis or kafka). Also in invalidate cache, search engine replication, real time analytics and audits.
398
405
399
406
2.### It's awsome ! but what is the catch ?
400
-
Well first of all you need to know that a lot of events may come through, like if you update 1 000 000 records in table "bar" and you need this one insert from your table "foo" Then all must be processed by script and you need to wait for your data. This is normal and this how it's work. You can speed up using [config options](https://github.com/krowinski/php-mysql-replication#configuration).
407
+
Well first of all you need to know that a lot of events may come through, like if you update 1 000 000 records in table "bar" and you need this one insert from your table "foo" Then all must be processed by script and you need to wait for your data. This is normal and this how it's work. You can speed up using [config options](https://github.com/moln/php-mysql-replication#configuration).
401
408
Also if script crashes you need to save from time to time position form binlog (or gtid) to start from this position when you run this script again to avoid duplicates.
402
409
403
410
3.### I need to process 1 000 000 records and its taking forever!!
404
411
Like I mention in 1 point use queue system like rabbitmq, redis or kafka, they will give you ability to process data in multiple scripts.
405
412
406
413
4.### I have a problem ? you script is missing something ! I have found a bug !
407
-
Create an [issue](https://github.com/krowinski/php-mysql-replication/issues) I will try to work on it in my free time :)
414
+
Create an [issue](https://github.com/moln/php-mysql-replication/issues) I will try to work on it in my free time :)
408
415
409
416
5.### How much its give overhead to mysql server ?
410
417
It work like any other mysql in slave mode and its giving same overhead.
0 commit comments