Agent for monitoring conflicts in mysql database replication
python, python-pip, mysql-server, mysql-client mysql-utilities
Download and install Vagrant from http://www.vagrantup.com
The development environment has 3 virtual machines that start with the command:
vagrant up
Let's configure a ring model replication with 3 hosts like the following configuration:
Replica1 is master of Replica2
Replica2 is master of Replica3
Replica3 is master of Replica1
To configure this environment, set the following configurations in each VM:
- Access VM:
vagrant ssh replica1
- Create configuration file for DBCAgent in
/tmp/dbcagent_config.ini
with the content:
[slave]
host = 10.10.10.3
user = replicator
password = 123456
database = dbexample
- Create replication with the command:
mysqlreplicate --master=replicator:[email protected] \
--slave=replicator:[email protected] --rpl-user=replicator:123456
- Access VM:
vagrant ssh replica2
- Create configuration file for DBCAgent in
/tmp/dbcagent_config.ini
with the content:
[slave]
host = 10.10.10.4
user = replicator
password = 123456
database = dbexample
- Create replication with the command:
mysqlreplicate --master=replicator:[email protected] \
--slave=replicator:[email protected] --rpl-user=replicator:123456
- Access VM:
vagrant ssh replica3
- Create configuration file for DBCAgent in
/tmp/dbcagent_config.ini
with the content:
[slave]
host = 10.10.10.5
user = replicator
password = 123456
database = dbexample
- Create replication with the command:
mysqlreplicate --master=replicator:[email protected] \
--slave=replicator:[email protected] --rpl-user=replicator:123456
Run agent as user mysql:
cd /vagrant/dbcagent
sudo -u mysql python dbcagent.py