Pg_chameleon is a replication tool from MySQL to PostgreSQL developed in Python 2.7 and Python 3.3+
The system relies on the mysql-replication library to pull the changes from MySQL and covert them into a jsonb object.
A plpgsql function decodes the jsonb and replays the changes into the PostgreSQL database.
The tool requires an initial replica setup which pulls the data from MySQL in read only mode.
This is done by the tool running FLUSH TABLE WITH READ LOCK; .
The tool can pull the data from a cascading replica when the MySQL slave is configured with log-slave-updates.
Changelog from 1.0-alpha.2
- Basic DDL Support (CREATE/DROP/ALTER TABLE, DROP PRIMARY KEY)
- Replica from multiple MySQL schema or servers
- Python 3 support
Installation in virtualenv
For working properly you should use virtualenv for installing the requirements via pip
No daemon yet
The script should be executed in a screen session to keep it running. Currently there's no respawning of the process on failure nor failure detector.
psycopg2 requires python and postgresql dev files
The psycopg2's pip installation requires the python development files and postgresql source code.
Please refer to your distribution for fulfilling those requirements.
DDL replica limitations
DDL and DML mixed in the same transaction are not decoded in the right order. This can result in a replica breakage caused by a wrong jsonb descriptor if the DML change the data on the same table modified by the DDL. I know the issue and I'm working on a solution.
Test please!
Please submit the issues you find.
Bear in mind this is an alpha release. if you use the software in production keep an eye on the process to ensure the data is correctly replicated.