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
* - Change: drop support for < 8.2
- Change: moved to enums, promoted properties
- Added: logger for more socket info
- Added: slave_uuid support
- Change: config no longer static
- Chore: typos in README/code
- Chore: replace/remove old urls from code
- Chore: changed variables to underscore
- Added: support caching_sha2_password
- Change: BinLogServerInfo static calls removed also added method getServerInfo to MySQLReplicationFactory
Pure PHP Implementation of MySQL replication protocol. This allow you to receive event like insert, update, delete with their data and raw SQL queries.
7
+
Pure PHP Implementation of MySQL replication protocol. This allows you to receive event like insert, update, delete with their data and raw SQL queries.
10
8
11
9
Based on a great work of creators:https://github.com/noplay/python-mysql-replication and https://github.com/fengxiangyun/mysql-replication
12
10
@@ -29,11 +27,16 @@ composer install -o
29
27
30
28
Compatibility (based on integration tests)
31
29
=========
30
+
PHP
32
31
32
+
- php 8.2
33
+
- php 8.3
34
+
35
+
MYSQL
33
36
- mysql 5.5
34
37
- mysql 5.6
35
38
- mysql 5.7
36
-
- mysql 8.0 (ONLY with mysql_native_password)
39
+
- mysql 8.0 (mysql_native_password and caching_sha2_password supported)
37
40
- mariadb 5.5
38
41
- mariadb 10.0
39
42
- mariadb 10.1
@@ -83,7 +86,7 @@ Available options:
83
86
84
87
'mariaDbGtid' - MariaDB GTID marker(s) to start from (format 1-1-3,0-1-88)
85
88
86
-
'slaveId' - script slave id for identification (SHOW SLAVE HOSTS)
89
+
'slaveId' - script slave id for identification (default: 666) (SHOW SLAVE HOSTS)
87
90
88
91
'binLogFileName' - bin log file name to start from
89
92
@@ -103,6 +106,8 @@ Available options:
103
106
104
107
'heartbeatPeriod' - sets the interval in seconds between replication heartbeats. Whenever the master's binary log is updated with an event, the waiting period for the next heartbeat is reset. interval is a decimal value having the range 0 to 4294967 seconds and a resolution in milliseconds; the smallest nonzero value is 0.001. Heartbeats are sent by the master only if there are no unsent events in the binary log file for a period longer than interval.
105
108
109
+
'saveUuid' - sets slave uuid for identification (default: 0015d2b6-8a06-4e5e-8c07-206ef3fbd274)
110
+
106
111
Similar projects
107
112
=========
108
113
Ruby: https://github.com/y310/kodama
@@ -394,27 +399,42 @@ FAQ
394
399
=========
395
400
396
401
1.### Why and when need php-mysql-replication ?
397
-
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
402
399
-
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).
401
-
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.
403
+
Well first of all MYSQL don't give you async calls. You usually need to program this in your application (by event dispatching and adding to some queue system
404
+
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
405
+
protocol you can listen on write events and process then asynchronously (the best combo it's to add item to some queue system like rabbitmq, redis or kafka).
406
+
Also in invalidate cache, search engine replication, real time analytics and audits.
407
+
408
+
2.### It's awesome ! but what is the catch ?
409
+
410
+
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
411
+
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
412
+
using [config options](https://github.com/krowinski/php-mysql-replication#configuration).
413
+
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
414
+
duplicates.
402
415
403
416
3.### I need to process 1 000 000 records and its taking forever!!
404
417
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
418
406
419
4.### I have a problem ? you script is missing something ! I have found a bug !
407
420
Create an [issue](https://github.com/krowinski/php-mysql-replication/issues) I will try to work on it in my free time :)
408
421
409
-
5.### How much its give overhead to mysql server ?
410
-
It work like any other mysql in slave mode and its giving same overhead.
422
+
5.### How much its give overhead to MYSQL server ?
423
+
424
+
It work like any other MYSQL in slave mode and its giving same overhead.
411
425
412
426
6.### Socket timeouts error
413
-
To fix this best is to increase db configurations "net_read_timeout" and "net_write_timeout" to 3600. (tx Bijimon)
427
+
428
+
To fix this best is to increase db configurations ```net_read_timeout``` and ```net_write_timeout``` to 3600. (tx Bijimon)
414
429
415
430
7.### Partial updates fix
416
-
Set in my.conf ```binlog_row_image=full``` to fix reciving only partial updates.
417
-
431
+
432
+
Set in my.conf ```binlog_row_image=full``` to fix receiving only partial updates.
433
+
418
434
8.### No replication events when connected to replica server
419
-
Set in my.conf ```log_slave_updates=on``` to fix this (#71)(#66)
435
+
Set in my.conf ```log_slave_updates=on``` to fix this (#71)(#66)
420
436
437
+
9.### "Big" updates / inserts
438
+
Default MYSQL setting generates one big blob of stream this require more RAM/CPU you can change this for smaller stream using
439
+
variable ```binlog_row_event_max_size```[https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_row_event_max_size] to
0 commit comments